// Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/reporter/MavenEventReporter.java
// public interface MavenEventReporter {
//     void print(Object message);
// 
//     void print(Xpp3Dom element);
// 
//     /**
//      * Close the reporter at the end of the Maven execution. No call to
//      * {@link #print(Object)} or {@link #print(Xpp3Dom)} will be made after the
//      * invocation of this method.
//      *
//      * @see EventSpy#close()
//      */
//     void close();
// }
// 
// Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/reporter/OutputStreamEventReporter.java
// public class OutputStreamEventReporter implements MavenEventReporter {
// 
//     final PrintWriter out;
//     final XMLWriter xmlWriter;
// 
//     public OutputStreamEventReporter(OutputStream out) {
//         this(new OutputStreamWriter(out, Charset.forName("UTF-8")));
//     }
// 
//     public OutputStreamEventReporter(Writer out) {
//         if (out instanceof PrintWriter) {
//             this.out = (PrintWriter) out;
//         } else {
//             this.out = new PrintWriter(out, true);
//         }
//         this.xmlWriter = new PrettyPrintXMLWriter(out);
//         xmlWriter.startElement("mavenExecution");
// 
//     }
// 
//     @Override
//     public synchronized void print(Object message) {
//         String comment = new Timestamp(System.currentTimeMillis()) + " - " + message;
//         XmlWriterUtil.writeComment(xmlWriter, comment);
//         XmlWriterUtil.writeLineBreak(xmlWriter);
// 
//         out.flush();
//     }
// 
//     @Override
//     public synchronized void print(Xpp3Dom element) {
//         Xpp3DomWriter.write(xmlWriter, element);
//         XmlWriterUtil.writeLineBreak(xmlWriter);
// 
//         out.flush();
//     }
// 
//     @Override
//     public synchronized void close() {
//         xmlWriter.endElement();
//         out.flush();
//     }
// }


import org.apache.maven.eventspy.EventSpy;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.hamcrest.CoreMatchers;
import org.jenkinsci.plugins.pipeline.maven.eventspy.reporter.MavenEventReporter;
import org.jenkinsci.plugins.pipeline.maven.eventspy.reporter.OutputStreamEventReporter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;
/*
 * The MIT License
 *
 * Copyright (c) 2016, CloudBees, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package org.jenkinsci.plugins.pipeline.maven.eventspy;




/**
 * @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
 */
public class JenkinsMavenEventSpyTest {

    JenkinsMavenEventSpy spy;
    MavenEventReporter reporter;
    StringWriter writer = new StringWriter();
    MavenProject project;

    @Before
    public void before() throws Exception {
// Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/reporter/MavenEventReporter.java
// public interface MavenEventReporter {
//     void print(Object message);
// 
//     void print(Xpp3Dom element);
// 
//     /**
//      * Close the reporter at the end of the Maven execution. No call to
//      * {@link #print(Object)} or {@link #print(Xpp3Dom)} will be made after the
//      * invocation of this method.
//      *
//      * @see EventSpy#close()
//      */
//     void close();
// }
// 
// Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/reporter/OutputStreamEventReporter.java
// public class OutputStreamEventReporter implements MavenEventReporter {
// 
//     final PrintWriter out;
//     final XMLWriter xmlWriter;
// 
//     public OutputStreamEventReporter(OutputStream out) {
//         this(new OutputStreamWriter(out, Charset.forName("UTF-8")));
//     }
// 
//     public OutputStreamEventReporter(Writer out) {
//         if (out instanceof PrintWriter) {
//             this.out = (PrintWriter) out;
//         } else {
//             this.out = new PrintWriter(out, true);
//         }
//         this.xmlWriter = new PrettyPrintXMLWriter(out);
//         xmlWriter.startElement("mavenExecution");
// 
//     }
// 
//     @Override
//     public synchronized void print(Object message) {
//         String comment = new Timestamp(System.currentTimeMillis()) + " - " + message;
//         XmlWriterUtil.writeComment(xmlWriter, comment);
//         XmlWriterUtil.writeLineBreak(xmlWriter);
// 
//         out.flush();
//     }
// 
//     @Override
//     public synchronized void print(Xpp3Dom element) {
//         Xpp3DomWriter.write(xmlWriter, element);
//         XmlWriterUtil.writeLineBreak(xmlWriter);
// 
//         out.flush();
//     }
// 
//     @Override
//     public synchronized void close() {
//         xmlWriter.endElement();
//         out.flush();
//     }
// }


// Path: maven-spy/src/test/java/org/jenkinsci/plugins/pipeline/maven/eventspy/JenkinsMavenEventSpyTest.java
import org.apache.maven.eventspy.EventSpy;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.hamcrest.CoreMatchers;
import org.jenkinsci.plugins.pipeline.maven.eventspy.reporter.MavenEventReporter;
import org.jenkinsci.plugins.pipeline.maven.eventspy.reporter.OutputStreamEventReporter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.MatcherAssert.assertThat;

/*
 * The MIT License
 *
 * Copyright (c) 2016, CloudBees, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package org.jenkinsci.plugins.pipeline.maven.eventspy;




/**
 * @author <a href="mailto:cleclerc@cloudbees.com">Cyrille Le Clerc</a>
 */
public class JenkinsMavenEventSpyTest {

    JenkinsMavenEventSpy spy;
    MavenEventReporter reporter;
    StringWriter writer = new StringWriter();
    MavenProject project;

    @Before
    public void before() throws Exception {
        reporter = new OutputStreamEventReporter(writer);