You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2017/04/15 00:57:07 UTC
[4/4] maven-surefire git commit: [SUREFIRE-1363] Java 1.6 features
@Override and Charset
[SUREFIRE-1363] Java 1.6 features @Override and Charset
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/11511f4a
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/11511f4a
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/11511f4a
Branch: refs/heads/SUREFIRE-1363
Commit: 11511f4a943b836bb82afcefb1d8fa715e2c634e
Parents: 0039f56
Author: Tibor17 <ti...@lycos.com>
Authored: Sat Apr 15 02:56:34 2017 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat Apr 15 02:56:36 2017 +0200
----------------------------------------------------------------------
.../plugin/failsafe/IntegrationTestMojo.java | 50 +++++++++++++++++++
.../maven/plugin/failsafe/VerifyMojo.java | 17 +++++++
.../xmlsummary/FailsafeSummaryXmlUtils.java | 2 +-
.../failsafe/MarshallerUnmarshallerTest.java | 2 +-
.../maven/plugin/failsafe/RunResultTest.java | 2 +-
.../plugin/surefire/AbstractSurefireMojo.java | 30 ++++++++++++
.../plugin/surefire/SurefireProperties.java | 2 +
.../booterclient/ChecksumCalculator.java | 14 +++---
.../surefire/booterclient/ForkStarter.java | 16 ++++--
.../OutputStreamFlushableCommandline.java | 2 +
.../lazytestprovider/TestLessInputStream.java | 16 ++++++
.../TestProvidingInputStream.java | 4 ++
.../output/DeserializedStacktraceWriter.java | 4 ++
.../booterclient/output/ForkClient.java | 1 +
.../output/NativeStdErrStreamConsumer.java | 1 +
.../output/ThreadedStreamConsumer.java | 3 ++
.../surefire/log/PluginConsoleLogger.java | 6 +++
.../report/ConsoleOutputFileReporter.java | 4 ++
.../surefire/report/DefaultReporterFactory.java | 2 +
.../surefire/report/DirectConsoleOutput.java | 4 ++
.../report/NullConsoleOutputReceiver.java | 4 ++
.../surefire/report/StatelessXmlReporter.java | 29 ++++-------
.../surefire/report/TestSetRunListener.java | 16 ++++++
.../Utf8RecodingDeferredFileOutputStream.java | 10 ++--
.../surefire/report/WrappedReportEntry.java | 7 +++
.../booterclient/MockNotifiableTestStream.java | 4 ++
.../surefire/booterclient/MockReporter.java | 16 ++++++
.../TestSetMockReporterFactory.java | 1 +
.../TestProvidingInputStreamTest.java | 3 ++
.../report/DefaultReporterFactoryTest.java | 10 ++++
.../report/StatelessXmlReporterTest.java | 7 +--
.../maven/surefire/spi/CustomizedImpl.java | 1 +
.../apache/maven/surefire/spi/DefaultImpl.java | 1 +
.../org/apache/maven/surefire/spi/SPImpl1.java | 1 +
.../org/apache/maven/surefire/spi/SPImpl2.java | 1 +
.../maven/plugin/surefire/SurefirePlugin.java | 51 ++++++++++++++++++++
.../plugin/surefire/SurefirePluginTest.java | 2 +
.../report/AbstractSurefireReportMojo.java | 4 ++
.../surefire/report/FailsafeReportMojo.java | 6 +++
.../surefire/report/PluginConsoleLogger.java | 6 +++
.../surefire/report/SurefireReportMojo.java | 4 ++
.../stubs/SurefireRepMavenProjectStub.java | 1 +
.../stubs/SurefireRepMavenProjectStub2.java | 1 +
.../runorder/RunEntryStatisticsMap.java | 4 ++
.../maven/surefire/NonAbstractClassFilter.java | 1 +
.../maven/surefire/SpecificTestClassFilter.java | 1 +
.../surefire/booter/BaseProviderFactory.java | 26 ++++++++++
.../maven/surefire/booter/CommandReader.java | 5 ++
.../surefire/booter/ForkingReporterFactory.java | 2 +
.../surefire/booter/ForkingRunListener.java | 18 +++++++
.../surefire/booter/MasterProcessCommand.java | 34 +++++--------
.../surefire/booter/SurefireReflector.java | 1 +
.../surefire/providerapi/AbstractProvider.java | 1 +
.../surefire/report/CategorizedReportEntry.java | 3 ++
.../surefire/report/ConsoleOutputCapture.java | 6 +++
.../report/DefaultDirectConsoleReporter.java | 2 +
.../report/LegacyPojoStackTraceWriter.java | 4 ++
.../surefire/report/SimpleReportEntry.java | 10 ++++
.../apache/maven/surefire/suite/RunResult.java | 2 +
.../surefire/testset/TestListResolver.java | 10 ++++
.../maven/surefire/util/CloseableIterator.java | 2 +-
.../surefire/util/DefaultDirectoryScanner.java | 1 +
.../util/DefaultRunOrderCalculator.java | 3 ++
.../maven/surefire/util/DefaultScanResult.java | 5 ++
.../apache/maven/surefire/util/RunOrder.java | 1 +
.../apache/maven/surefire/util/TestsToRun.java | 2 +
.../surefire/util/internal/ByteBuffer.java | 1 +
.../util/internal/DaemonThreadFactory.java | 2 +
.../surefire/util/internal/DumpFileUtils.java | 4 +-
.../surefire/util/internal/StringUtils.java | 20 ++++----
.../maven/surefire/util/internal/UrlUtils.java | 51 +++++++-------------
.../surefire/booter/SurefireReflectorTest.java | 2 +
.../report/LegacyPojoStackTraceWriterTest.java | 1 +
.../maven/surefire/util/UrlUtilsTest.java | 1 +
.../util/internal/ConcurrencyUtilsTest.java | 1 +
.../apache/maven/surefire/booter/Classpath.java | 3 ++
.../maven/surefire/booter/ForkedBooter.java | 4 ++
.../surefire/booter/IsolatedClassLoader.java | 3 ++
.../maven/surefire/booter/LazyTestsToRun.java | 7 +++
.../surefire/booter/PropertiesWrapper.java | 1 +
.../maven/surefire/booter/ProviderFactory.java | 3 ++
.../maven/surefire/booter/TypeEncodedValue.java | 9 ++--
.../surefire/booter/CommandReaderTest.java | 6 ++-
.../org/apache/maven/surefire/booter/Foo.java | 7 +++
.../surefire/group/match/AndGroupMatcher.java | 2 +
.../group/match/InverseGroupMatcher.java | 3 ++
.../surefire/group/match/JoinGroupMatcher.java | 1 +
.../surefire/group/match/OrGroupMatcher.java | 2 +
.../group/match/SingleGroupMatcher.java | 3 ++
.../maven/surefire/its/ForkModeTestNGIT.java | 1 +
.../its/fixture/FailsafeOutputValidator.java | 1 +
.../surefire/its/fixture/OutputValidator.java | 2 +-
...urefire1082ParallelJUnitParameterizedIT.java | 2 +
.../log/api/ConsoleLoggerDecorator.java | 2 +-
.../surefire/log/api/NullConsoleLogger.java | 6 +++
.../surefire/log/api/PrintStreamLogger.java | 2 +-
.../report/ClassNameStackTraceFilter.java | 1 +
.../surefire/report/NullStackTraceFilter.java | 1 +
.../surefire/report/PojoStackTraceWriter.java | 4 ++
.../surefire/report/RunnableTestClass1.java | 1 +
.../surefire/report/RunnableTestClass2.java | 1 +
.../common/junit3/JUnit3TestChecker.java | 1 +
.../common/junit3/JUnit3TestCheckerTest.java | 2 +
.../surefire/common/junit4/JUnit4Reflector.java | 2 +
.../common/junit4/JUnit4RunListener.java | 4 ++
.../common/junit4/JUnit4StackTraceWriter.java | 4 ++
.../common/junit4/JUnit4TestChecker.java | 1 +
.../maven/surefire/junit4/MockReporter.java | 9 ++++
.../common/junit4/JUnit4RunListenerTest.java | 1 +
.../surefire/junit4/JUnit4TestCheckerTest.java | 2 +
.../common/junit48/JUnit46StackTraceWriter.java | 2 +
.../common/junit48/JUnit48TestChecker.java | 1 +
.../maven/surefire/junit/JUnit3Provider.java | 2 +
.../maven/surefire/junit/JUnitTestSet.java | 2 +
.../surefire/junit/PojoAndJUnit3Checker.java | 1 +
.../maven/surefire/junit/PojoTestSet.java | 2 +
.../junit/TestListenerInvocationHandler.java | 3 ++
.../maven/surefire/junit/JUnitTestSetTest.java | 9 ++++
.../maven/surefire/junit4/JUnit4Provider.java | 4 ++
.../surefire/junitcore/AsynchronousRunner.java | 2 +
.../junitcore/ConcurrentRunListener.java | 10 ++++
.../surefire/junitcore/JUnitCoreProvider.java | 4 ++
.../junitcore/JUnitCoreRunListener.java | 1 +
.../junitcore/NonConcurrentRunListener.java | 2 +
.../surefire/junitcore/SynchronousRunner.java | 2 +
.../maven/surefire/junitcore/TestMethod.java | 1 +
.../pc/AbstractThreadPoolStrategy.java | 1 +
.../surefire/junitcore/pc/InvokerStrategy.java | 1 +
.../surefire/junitcore/pc/NullBalancer.java | 3 ++
.../surefire/junitcore/pc/ParallelComputer.java | 2 +
.../maven/surefire/junitcore/pc/Scheduler.java | 4 ++
.../junitcore/pc/ThreadResourcesBalancer.java | 3 ++
.../junitcore/DefaultConsoleReporter.java | 6 +++
.../pc/ParallelComputerBuilderTest.java | 2 +
.../surefire/junitcore/pc/RangeMatcher.java | 2 +
.../junitcore/pc/SchedulingStrategiesTest.java | 1 +
.../surefire/testng/utils/FailFastListener.java | 7 +++
.../surefire/testng/utils/FailFastNotifier.java | 2 +
.../utils/GroupMatcherMethodSelector.java | 2 +
.../surefire/testng/utils/MethodSelector.java | 2 +
.../maven/surefire/testng/TestNGExecutor.java | 1 +
.../maven/surefire/testng/TestNGProvider.java | 4 ++
.../maven/surefire/testng/TestNGReporter.java | 9 ++++
.../testng/conf/AbstractDirectConfigurator.java | 2 +
.../testng/conf/TestNG60Configurator.java | 1 +
.../testng/conf/TestNGMapConfigurator.java | 2 +
.../plugins/surefire/report/ReportTestCase.java | 1 +
.../surefire/report/ReportTestSuite.java | 1 +
.../surefire/report/TestSuiteXmlParser.java | 3 ++
.../surefire/report/ReportTestCaseTest.java | 1 +
.../surefire/report/ReportTestSuiteTest.java | 1 +
.../report/SurefireReportParserTest.java | 1 +
.../surefire/report/TestSuiteXmlParserTest.java | 6 +++
153 files changed, 699 insertions(+), 119 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index ddfbe7d..1ad317f 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -350,11 +350,13 @@ public class IntegrationTestMojo
@Parameter( property = "failsafe.shutdown", defaultValue = "testset" )
private String shutdown;
+ @Override
protected int getRerunFailingTestsCount()
{
return rerunFailingTestsCount;
}
+ @Override
@SuppressWarnings( "unchecked" )
protected void handleSummary( RunResult summary, Exception firstForkException )
throws MojoExecutionException, MojoFailureException
@@ -418,17 +420,20 @@ public class IntegrationTestMojo
}
}
+ @Override
@SuppressWarnings( "deprecation" )
protected boolean isSkipExecution()
{
return isSkip() || isSkipTests() || isSkipITs() || isSkipExec();
}
+ @Override
protected String getPluginName()
{
return "failsafe";
}
+ @Override
protected String[] getDefaultIncludes()
{
return new String[]{ "**/IT*.java", "**/*IT.java", "**/*ITCase.java" };
@@ -440,11 +445,13 @@ public class IntegrationTestMojo
return "https://maven.apache.org/surefire/maven-failsafe-plugin/xsd/failsafe-test-report.xsd";
}
+ @Override
public boolean isSkipTests()
{
return skipTests;
}
+ @Override
public void setSkipTests( boolean skipTests )
{
this.skipTests = skipTests;
@@ -460,6 +467,7 @@ public class IntegrationTestMojo
this.skipITs = skipITs;
}
+ @Override
@SuppressWarnings( "deprecation" )
@Deprecated
public boolean isSkipExec()
@@ -467,6 +475,7 @@ public class IntegrationTestMojo
return skipExec;
}
+ @Override
@SuppressWarnings( "deprecation" )
@Deprecated
public void setSkipExec( boolean skipExec )
@@ -474,31 +483,37 @@ public class IntegrationTestMojo
this.skipExec = skipExec;
}
+ @Override
public boolean isSkip()
{
return skip;
}
+ @Override
public void setSkip( boolean skip )
{
this.skip = skip;
}
+ @Override
public File getBasedir()
{
return basedir;
}
+ @Override
public void setBasedir( File basedir )
{
this.basedir = basedir;
}
+ @Override
public File getTestClassesDirectory()
{
return testClassesDirectory;
}
+ @Override
public void setTestClassesDirectory( File testClassesDirectory )
{
this.testClassesDirectory = testClassesDirectory;
@@ -509,6 +524,7 @@ public class IntegrationTestMojo
* {@link #useSystemClassLoader} is ignored and the {@link org.apache.maven.surefire.booter.IsolatedClassLoader} is
* used instead. See the resolution of {@link #getClassLoaderConfiguration() ClassLoaderConfiguration}.
*/
+ @Override
public File getClassesDirectory()
{
File artifact = getProject().getArtifact().getFile();
@@ -516,6 +532,7 @@ public class IntegrationTestMojo
return isDefaultClsDir ? ( isJarArtifact( artifact ) ? artifact : defaultClassesDirectory ) : classesDirectory;
}
+ @Override
public void setClassesDirectory( File classesDirectory )
{
this.classesDirectory = toAbsoluteCanonical( classesDirectory );
@@ -526,21 +543,25 @@ public class IntegrationTestMojo
this.defaultClassesDirectory = toAbsoluteCanonical( defaultClassesDirectory );
}
+ @Override
public File getReportsDirectory()
{
return reportsDirectory;
}
+ @Override
public void setReportsDirectory( File reportsDirectory )
{
this.reportsDirectory = reportsDirectory;
}
+ @Override
public String getTest()
{
return test;
}
+ @Override
public void setTest( String test )
{
this.test = test;
@@ -556,101 +577,121 @@ public class IntegrationTestMojo
this.summaryFile = summaryFile;
}
+ @Override
public boolean isPrintSummary()
{
return printSummary;
}
+ @Override
public void setPrintSummary( boolean printSummary )
{
this.printSummary = printSummary;
}
+ @Override
public String getReportFormat()
{
return reportFormat;
}
+ @Override
public void setReportFormat( String reportFormat )
{
this.reportFormat = reportFormat;
}
+ @Override
public boolean isUseFile()
{
return useFile;
}
+ @Override
public void setUseFile( boolean useFile )
{
this.useFile = useFile;
}
+ @Override
public String getDebugForkedProcess()
{
return debugForkedProcess;
}
+ @Override
public void setDebugForkedProcess( String debugForkedProcess )
{
this.debugForkedProcess = debugForkedProcess;
}
+ @Override
public int getForkedProcessTimeoutInSeconds()
{
return forkedProcessTimeoutInSeconds;
}
+ @Override
public void setForkedProcessTimeoutInSeconds( int forkedProcessTimeoutInSeconds )
{
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
}
+ @Override
public int getForkedProcessExitTimeoutInSeconds()
{
return forkedProcessExitTimeoutInSeconds;
}
+ @Override
public void setForkedProcessExitTimeoutInSeconds( int forkedProcessExitTimeoutInSeconds )
{
this.forkedProcessExitTimeoutInSeconds = forkedProcessExitTimeoutInSeconds;
}
+ @Override
public double getParallelTestsTimeoutInSeconds()
{
return parallelTestsTimeoutInSeconds;
}
+ @Override
public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds )
{
this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds;
}
+ @Override
public double getParallelTestsTimeoutForcedInSeconds()
{
return parallelTestsTimeoutForcedInSeconds;
}
+ @Override
public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds )
{
this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds;
}
+ @Override
public boolean isUseSystemClassLoader()
{
return useSystemClassLoader;
}
+ @Override
public void setUseSystemClassLoader( boolean useSystemClassLoader )
{
this.useSystemClassLoader = useSystemClassLoader;
}
+ @Override
public boolean isUseManifestOnlyJar()
{
return useManifestOnlyJar;
}
+ @Override
public void setUseManifestOnlyJar( boolean useManifestOnlyJar )
{
this.useManifestOnlyJar = useManifestOnlyJar;
@@ -668,27 +709,32 @@ public class IntegrationTestMojo
// ignore
}
+ @Override
protected void addPluginSpecificChecksumItems( ChecksumCalculator checksum )
{
checksum.add( skipITs );
checksum.add( summaryFile );
}
+ @Override
public Boolean getFailIfNoSpecifiedTests()
{
return failIfNoSpecifiedTests;
}
+ @Override
public void setFailIfNoSpecifiedTests( boolean failIfNoSpecifiedTests )
{
this.failIfNoSpecifiedTests = failIfNoSpecifiedTests;
}
+ @Override
public int getSkipAfterFailureCount()
{
return skipAfterFailureCount;
}
+ @Override
public String getShutdown()
{
return shutdown;
@@ -706,22 +752,26 @@ public class IntegrationTestMojo
this.includes = includes;
}
+ @Override
public File[] getSuiteXmlFiles()
{
return suiteXmlFiles.clone();
}
+ @Override
@SuppressWarnings( "UnusedDeclaration" )
public void setSuiteXmlFiles( File[] suiteXmlFiles )
{
this.suiteXmlFiles = suiteXmlFiles.clone();
}
+ @Override
public String getRunOrder()
{
return runOrder;
}
+ @Override
@SuppressWarnings( "UnusedDeclaration" )
public void setRunOrder( String runOrder )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
index a56d521..0ad7f80 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/VerifyMojo.java
@@ -161,6 +161,7 @@ public class VerifyMojo
private volatile PluginConsoleLogger consoleLogger;
+ @Override
public void execute()
throws MojoExecutionException, MojoFailureException
{
@@ -248,11 +249,13 @@ public class VerifyMojo
return null;
}
+ @Override
public boolean isSkipTests()
{
return skipTests;
}
+ @Override
public void setSkipTests( boolean skipTests )
{
this.skipTests = skipTests;
@@ -268,73 +271,87 @@ public class VerifyMojo
this.skipITs = skipITs;
}
+ @Override
@Deprecated
public boolean isSkipExec()
{
return skipExec;
}
+ @Override
@Deprecated
public void setSkipExec( boolean skipExec )
{
this.skipExec = skipExec;
}
+ @Override
public boolean isSkip()
{
return skip;
}
+ @Override
public void setSkip( boolean skip )
{
this.skip = skip;
}
+ @Override
public boolean isTestFailureIgnore()
{
return testFailureIgnore;
}
+ @Override
public void setTestFailureIgnore( boolean testFailureIgnore )
{
this.testFailureIgnore = testFailureIgnore;
}
+ @Override
public File getBasedir()
{
return basedir;
}
+ @Override
public void setBasedir( File basedir )
{
this.basedir = basedir;
}
+ @Override
public File getTestClassesDirectory()
{
return testClassesDirectory;
}
+ @Override
public void setTestClassesDirectory( File testClassesDirectory )
{
this.testClassesDirectory = testClassesDirectory;
}
+ @Override
public File getReportsDirectory()
{
return reportsDirectory;
}
+ @Override
public void setReportsDirectory( File reportsDirectory )
{
this.reportsDirectory = reportsDirectory;
}
+ @Override
public Boolean getFailIfNoTests()
{
return failIfNoTests;
}
+ @Override
public void setFailIfNoTests( boolean failIfNoTests )
{
this.failIfNoTests = failIfNoTests;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java
index 7993a05..a2abf27 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java
@@ -1 +1 @@
-package org.apache.maven.plugin.failsafe.xmlsummary;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.surefire.suite.RunResult;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.FileOutp
utStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
* @since 2.20
*/
public final class FailsafeSummaryXmlUtils
{
public static final Charset UTF8 = Charset.forName( "UTF-8" );
private FailsafeSummaryXmlUtils()
{
throw new IllegalStateException( "No instantiable constructor." );
}
public static RunResult toRunResult( File failsafeSummaryXml ) throws JAXBException
{
FailsafeSummary failsafeSummary = JAXB.unmarshal( failsafeSummaryXml, FailsafeSummary.class );
return new RunResult( failsafeSummary.getCompleted(), failsafeSummary.getErrors(),
failsafeSummary.getFailures(), failsafeSummary.getSkipped(),
failsafeSummary.getFailureMessage(), failsafeSummary.isTimeout()
);
}
public static void fromRunResultToFile( R
unResult fromRunResult, File toFailsafeSummaryXml )
throws JAXBException, IOException
{
fromRunResultToFile( fromRunResult, toFailsafeSummaryXml, UTF8 );
}
public static void fromRunResultToFile( RunResult fromRunResult, File toFailsafeSummaryXml, Charset encoding )
throws JAXBException, IOException
{
FailsafeSummary summary = new FailsafeSummary();
summary.setCompleted( fromRunResult.getCompletedCount() );
summary.setFailureMessage( fromRunResult.getFailure() );
summary.setErrors( fromRunResult.getErrors() );
summary.setFailures( fromRunResult.getFailures() );
summary.setSkipped( fromRunResult.getSkipped() );
summary.setTimeout( fromRunResult.isTimeout() );
summary.setResult( ErrorType.fromValue( fromRunResult.getFailsafeCode() ) );
String unmarshalled = JAXB.marshal( summary, encoding );
OutputStreamWriter os = new OutputStreamWriter( new FileOutputStr
eam( toFailsafeSummaryXml ), encoding );
try
{
os.write( unmarshalled );
os.flush();
}
finally
{
os.close();
}
}
public static void writeSummary( RunResult mergedSummary, File mergedSummaryFile, boolean inProgress,
Charset encoding )
throws IOException, JAXBException
{
if ( !mergedSummaryFile.getParentFile().isDirectory() )
{
//noinspection ResultOfMethodCallIgnored
mergedSummaryFile.getParentFile().mkdirs();
}
if ( mergedSummaryFile.exists() && inProgress )
{
RunResult runResult = toRunResult( mergedSummaryFile );
mergedSummary = mergedSummary.aggregate( runResult );
}
fromRunResultToFile( mergedSummary, mergedSummaryFile, encoding );
}
}
\ No newline at end of file
+package org.apache.maven.plugin.failsafe.xmlsummary;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.surefire.suite.RunResult;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.FileOutp
utStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
* @since 2.20
*/
public final class FailsafeSummaryXmlUtils
{
private FailsafeSummaryXmlUtils()
{
throw new IllegalStateException( "No instantiable constructor." );
}
public static RunResult toRunResult( File failsafeSummaryXml ) throws JAXBException
{
FailsafeSummary failsafeSummary = JAXB.unmarshal( failsafeSummaryXml, FailsafeSummary.class );
return new RunResult( failsafeSummary.getCompleted(), failsafeSummary.getErrors(),
failsafeSummary.getFailures(), failsafeSummary.getSkipped(),
failsafeSummary.getFailureMessage(), failsafeSummary.isTimeout()
);
}
public static void fromRunResultToF
ile( RunResult fromRunResult, File toFailsafeSummaryXml )
throws JAXBException, IOException
{
fromRunResultToFile( fromRunResult, toFailsafeSummaryXml, UTF_8 );
}
public static void fromRunResultToFile( RunResult fromRunResult, File toFailsafeSummaryXml, Charset encoding )
throws JAXBException, IOException
{
FailsafeSummary summary = new FailsafeSummary();
summary.setCompleted( fromRunResult.getCompletedCount() );
summary.setFailureMessage( fromRunResult.getFailure() );
summary.setErrors( fromRunResult.getErrors() );
summary.setFailures( fromRunResult.getFailures() );
summary.setSkipped( fromRunResult.getSkipped() );
summary.setTimeout( fromRunResult.isTimeout() );
summary.setResult( ErrorType.fromValue( fromRunResult.getFailsafeCode() ) );
String unmarshalled = JAXB.marshal( summary, encoding );
OutputStreamWriter os = new OutputStreamWriter( new FileOu
tputStream( toFailsafeSummaryXml ), encoding );
try
{
os.write( unmarshalled );
os.flush();
}
finally
{
os.close();
}
}
public static void writeSummary( RunResult mergedSummary, File mergedSummaryFile, boolean inProgress,
Charset encoding )
throws IOException, JAXBException
{
if ( !mergedSummaryFile.getParentFile().isDirectory() )
{
//noinspection ResultOfMethodCallIgnored
mergedSummaryFile.getParentFile().mkdirs();
}
if ( mergedSummaryFile.exists() && inProgress )
{
RunResult runResult = toRunResult( mergedSummaryFile );
mergedSummary = mergedSummary.aggregate( runResult );
}
fromRunResultToFile( mergedSummary, mergedSummaryFile, encoding );
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/MarshallerUnmarshallerTest.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/MarshallerUnmarshallerTest.java b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/MarshallerUnmarshallerTest.java
index 4386d71..c9e2cd4 100644
--- a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/MarshallerUnmarshallerTest.java
+++ b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/MarshallerUnmarshallerTest.java
@@ -1 +1 @@
-package org.apache.maven.plugin.failsafe;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummary;
import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils;
import org.apache.maven.plugin.failsafe.xmlsummary.JAXB;
import org.junit.Test;
import java.io.File;
import java.io.FileWriter;
import java.util.List;
import static org.apache.maven.plugin.failsafe.xmlsummary.ErrorType.FAILURE;
import static org.fest.assertions.Assertions.assertThat;
public class MarshallerUnmarshallerTest
{
@Test
public void shouldUnmarshallExistingXmlFile() throws Exception
{
File xml = new File( "target/test-classes/org/apache/maven/plugin/failsafe/failsafe-summary.xml" );
FailsafeSummary summary = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( summary.getCompleted() )
.isEqualTo( 7 );
assertThat( summary.getErrors() )
.isEqualTo( 1 );
assertThat( summary.getFailures() )
.isEqualTo( 2 );
assertThat( summary.getSkipped() )
.isEqualTo( 3 );
assertThat( summary.getFailureMessage() )
.contains( "There
was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
assertThat( summary.getFailureMessage() )
.contains( "There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
+ "\n\tat org.apache.maven.plugin.surefire.booterclient.ForkStarter"
+ ".awaitResultsDone(ForkStarter.java:489)"
);
List<String> exceptionMessages = summary.extractExceptionMessageLines();
assertThat( exceptionMessages )
.hasSize( 1 );
assertThat( exceptionMessages.get( 0 ) )
.isEqualTo( "ExecutionException There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
summary.setFailureMessa
ge( null );
assertThat( summary.extractExceptionMessageLines() )
.isEmpty();
}
@Test
public void shouldEqualTwoSameXml() throws Exception
{
File xml = new File( "target/test-classes/org/apache/maven/plugin/failsafe/failsafe-summary.xml" );
FailsafeSummary summary1 = JAXB.unmarshal( xml, FailsafeSummary.class );
FailsafeSummary summary2 = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( summary1 )
.isEqualTo( summary2 );
}
@Test
public void shouldMarshallAndUnmarshallSameXml() throws Exception
{
FailsafeSummary expected = new FailsafeSummary();
expected.setResult( FAILURE );
expected.setTimeout( true );
expected.setCompleted( 7 );
expected.setErrors( 1 );
expected.setFailures( 2 );
expected.setSkipped( 3 );
expected.setFailureMessage( "There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
+ "\n\tat org.apache.maven.plugin.surefire.booterclient.ForkStarter"
+ ".awaitResultsDone(ForkStarter.java:489)"
);
File xml = File.createTempFile( "failsafe-summary", ".xml" );
String xmlText = JAXB.marshal( expected, FailsafeSummaryXmlUtils.UTF8 );
FileWriter fileWriter = new FileWriter( xml );
fileWriter.write( xmlText );
fileWriter.flush();
fileWriter.close();
FailsafeSummary actual = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( actual )
.isEqualTo( expected );
List<String> exceptionMessages = actual.extractExceptionMessageLines();
assertThat( exceptionMessages )
.hasSize( 1 );
assertThat( exceptionMessages.get( 0 ) )
.isEqualTo( "There was an error in the forked
processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
}
}
\ No newline at end of file
+package org.apache.maven.plugin.failsafe;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummary;
import org.apache.maven.plugin.failsafe.xmlsummary.JAXB;
import org.junit.T
est;
import java.io.File;
import java.io.FileWriter;
import java.util.List;
import static org.apache.maven.plugin.failsafe.xmlsummary.ErrorType.FAILURE;
import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
import static org.fest.assertions.Assertions.assertThat;
public class MarshallerUnmarshallerTest
{
@Test
public void shouldUnmarshallExistingXmlFile() throws Exception
{
File xml = new File( "target/test-classes/org/apache/maven/plugin/failsafe/failsafe-summary.xml" );
FailsafeSummary summary = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( summary.getCompleted() )
.isEqualTo( 7 );
assertThat( summary.getErrors() )
.isEqualTo( 1 );
assertThat( summary.getFailures() )
.isEqualTo( 2 );
assertThat( summary.getSkipped() )
.isEqualTo( 3 );
assertThat( summary.getFailureMessage() )
.contains( "There was
an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
assertThat( summary.getFailureMessage() )
.contains( "There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
+ "\n\tat org.apache.maven.plugin.surefire.booterclient.ForkStarter"
+ ".awaitResultsDone(ForkStarter.java:489)"
);
List<String> exceptionMessages = summary.extractExceptionMessageLines();
assertThat( exceptionMessages )
.hasSize( 1 );
assertThat( exceptionMessages.get( 0 ) )
.isEqualTo( "ExecutionException There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
summary.setFailureMessage(
null );
assertThat( summary.extractExceptionMessageLines() )
.isEmpty();
}
@Test
public void shouldEqualTwoSameXml() throws Exception
{
File xml = new File( "target/test-classes/org/apache/maven/plugin/failsafe/failsafe-summary.xml" );
FailsafeSummary summary1 = JAXB.unmarshal( xml, FailsafeSummary.class );
FailsafeSummary summary2 = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( summary1 )
.isEqualTo( summary2 );
}
@Test
public void shouldMarshallAndUnmarshallSameXml() throws Exception
{
FailsafeSummary expected = new FailsafeSummary();
expected.setResult( FAILURE );
expected.setTimeout( true );
expected.setCompleted( 7 );
expected.setErrors( 1 );
expected.setFailures( 2 );
expected.setSkipped( 3 );
expected.setFailureMessage( "There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
+ "\n\tat org.apache.maven.plugin.surefire.booterclient.ForkStarter"
+ ".awaitResultsDone(ForkStarter.java:489)"
);
File xml = File.createTempFile( "failsafe-summary", ".xml" );
String xmlText = JAXB.marshal( expected, UTF_8 );
FileWriter fileWriter = new FileWriter( xml );
fileWriter.write( xmlText );
fileWriter.flush();
fileWriter.close();
FailsafeSummary actual = JAXB.unmarshal( xml, FailsafeSummary.class );
assertThat( actual )
.isEqualTo( expected );
List<String> exceptionMessages = actual.extractExceptionMessageLines();
assertThat( exceptionMessages )
.hasSize( 1 );
assertThat( exceptionMessages.get( 0 ) )
.isEqualTo( "There was an error in the forked processtest "
+ "subsystem#no method RuntimeException Hi There!"
);
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java
index fa7ac8e..39d47ce 100644
--- a/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java
+++ b/maven-failsafe-plugin/src/test/java/org/apache/maven/plugin/failsafe/RunResultTest.java
@@ -1 +1 @@
-package org.apache.maven.plugin.failsafe;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils;
import org.apache.maven.surefire.suite.RunResult;
import org.junit.
Test;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import static org.fest.assertions.Assertions.assertThat;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
* @since 2.20
*/
public class RunResultTest
{
@Test
public void testAggregatedValues()
{
RunResult simple = getSimpleAggregate();
assertThat( simple.getCompletedCount() )
.isEqualTo( 20 );
assertThat( simple.getErrors() )
.isEqualTo( 3 );
assertThat( simple.getFailures() )
.isEqualTo( 7 );
assertThat( simple.getSkipped() )
.isEqualTo( 4 );
assertThat( simple.getFlakes() )
.isEqualTo( 2 );
}
@Test
public void testSerialization()
throws IOException, JAXBException
{
writeReadCheck( getSimpleAggregate() );
}
@Test
public void test
Failures()
throws IOException, JAXBException
{
writeReadCheck( new RunResult( 0, 1, 2, 3, "stacktraceHere", false ) );
}
@Test
public void testSkipped()
throws IOException, JAXBException
{
writeReadCheck( new RunResult( 3, 2, 1, 0, null, true ) );
}
@Test
public void testAppendSerialization()
throws IOException, JAXBException
{
RunResult simpleAggregate = getSimpleAggregate();
RunResult additional = new RunResult( 2, 1, 2, 2, "msg " + ( (char) 0x0E01 ), true );
File summary = File.createTempFile( "failsafe", "test" );
FailsafeSummaryXmlUtils.writeSummary( simpleAggregate, summary, false, FailsafeSummaryXmlUtils.UTF8 );
FailsafeSummaryXmlUtils.writeSummary( additional, summary, true, FailsafeSummaryXmlUtils.UTF8 );
RunResult actual = FailsafeSummaryXmlUtils.toRunResult( summary );
//noinspection ResultOfMethodCallIgnored
summary.de
lete();
RunResult expected = simpleAggregate.aggregate( additional );
assertThat( expected.getCompletedCount() )
.isEqualTo( 22 );
assertThat( expected.getErrors() )
.isEqualTo( 4 );
assertThat( expected.getFailures() )
.isEqualTo( 9 );
assertThat( expected.getSkipped() )
.isEqualTo( 6 );
assertThat( expected.getFlakes() )
.isEqualTo( 2 );
assertThat( expected.getFailure() )
.isEqualTo( "msg " + ( (char) 0x0E01 ) );
assertThat( expected.isTimeout() )
.isTrue();
assertThat( actual )
.isEqualTo( expected );
}
@Test
public void shouldAcceptAliasCharset()
{
Charset charset1 = IntegrationTestMojo.toCharset( "UTF8" );
assertThat( charset1.name() ).isEqualTo( "UTF-8" );
Charset charset2 = IntegrationTestMojo.toCharset( "utf8" );
assert
That( charset2.name() ).isEqualTo( "UTF-8" );
}
private void writeReadCheck( RunResult expected )
throws IOException, JAXBException
{
File tmp = File.createTempFile( "test", "xml" );
FailsafeSummaryXmlUtils.fromRunResultToFile( expected, tmp );
RunResult actual = FailsafeSummaryXmlUtils.toRunResult( tmp );
//noinspection ResultOfMethodCallIgnored
tmp.delete();
assertThat( actual )
.isEqualTo( expected );
}
private RunResult getSimpleAggregate()
{
RunResult resultOne = new RunResult( 10, 1, 3, 2, 1 );
RunResult resultTwo = new RunResult( 10, 2, 4, 2, 1 );
return resultOne.aggregate( resultTwo );
}
}
\ No newline at end of file
+package org.apache.maven.plugin.failsafe;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils;
import org.apache.maven.surefire.suite.RunResult;
import org.junit.
Test;
import javax.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
import static org.fest.assertions.Assertions.assertThat;
/**
* @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
* @since 2.20
*/
public class RunResultTest
{
@Test
public void testAggregatedValues()
{
RunResult simple = getSimpleAggregate();
assertThat( simple.getCompletedCount() )
.isEqualTo( 20 );
assertThat( simple.getErrors() )
.isEqualTo( 3 );
assertThat( simple.getFailures() )
.isEqualTo( 7 );
assertThat( simple.getSkipped() )
.isEqualTo( 4 );
assertThat( simple.getFlakes() )
.isEqualTo( 2 );
}
@Test
public void testSerialization()
throws IOException, JAXBException
{
writ
eReadCheck( getSimpleAggregate() );
}
@Test
public void testFailures()
throws IOException, JAXBException
{
writeReadCheck( new RunResult( 0, 1, 2, 3, "stacktraceHere", false ) );
}
@Test
public void testSkipped()
throws IOException, JAXBException
{
writeReadCheck( new RunResult( 3, 2, 1, 0, null, true ) );
}
@Test
public void testAppendSerialization()
throws IOException, JAXBException
{
RunResult simpleAggregate = getSimpleAggregate();
RunResult additional = new RunResult( 2, 1, 2, 2, "msg " + ( (char) 0x0E01 ), true );
File summary = File.createTempFile( "failsafe", "test" );
FailsafeSummaryXmlUtils.writeSummary( simpleAggregate, summary, false, UTF_8 );
FailsafeSummaryXmlUtils.writeSummary( additional, summary, true, UTF_8 );
RunResult actual = FailsafeSummaryXmlUtils.toRunResult( summary );
//noinspection ResultOfMethodCal
lIgnored
summary.delete();
RunResult expected = simpleAggregate.aggregate( additional );
assertThat( expected.getCompletedCount() )
.isEqualTo( 22 );
assertThat( expected.getErrors() )
.isEqualTo( 4 );
assertThat( expected.getFailures() )
.isEqualTo( 9 );
assertThat( expected.getSkipped() )
.isEqualTo( 6 );
assertThat( expected.getFlakes() )
.isEqualTo( 2 );
assertThat( expected.getFailure() )
.isEqualTo( "msg " + ( (char) 0x0E01 ) );
assertThat( expected.isTimeout() )
.isTrue();
assertThat( actual )
.isEqualTo( expected );
}
@Test
public void shouldAcceptAliasCharset()
{
Charset charset1 = IntegrationTestMojo.toCharset( "UTF8" );
assertThat( charset1.name() ).isEqualTo( "UTF-8" );
Charset charset2 = IntegrationTestMojo.toCharse
t( "utf8" );
assertThat( charset2.name() ).isEqualTo( "UTF-8" );
}
private void writeReadCheck( RunResult expected )
throws IOException, JAXBException
{
File tmp = File.createTempFile( "test", "xml" );
FailsafeSummaryXmlUtils.fromRunResultToFile( expected, tmp );
RunResult actual = FailsafeSummaryXmlUtils.toRunResult( tmp );
//noinspection ResultOfMethodCallIgnored
tmp.delete();
assertThat( actual )
.isEqualTo( expected );
}
private RunResult getSimpleAggregate()
{
RunResult resultOne = new RunResult( 10, 1, 3, 2, 1 );
RunResult resultTwo = new RunResult( 10, 2, 4, 2, 1 );
return resultOne.aggregate( resultTwo );
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 16c25ec..f2c32d0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -710,10 +710,12 @@ public abstract class AbstractSurefireMojo
protected abstract int getRerunFailingTestsCount();
+ @Override
public abstract List<String> getIncludes();
public abstract File getIncludesFile();
+ @Override
public abstract void setIncludes( List<String> includes );
public abstract File getExcludesFile();
@@ -761,6 +763,7 @@ public abstract class AbstractSurefireMojo
private volatile PluginConsoleLogger consoleLogger;
+ @Override
public void execute()
throws MojoExecutionException, MojoFailureException
{
@@ -2544,21 +2547,25 @@ public abstract class AbstractSurefireMojo
this.testNgArtifact = testNgArtifact;
}
+ @Override
@Nonnull public String getProviderName()
{
return "org.apache.maven.surefire.testng.TestNGProvider";
}
+ @Override
public boolean isApplicable()
{
return testNgArtifact != null;
}
+ @Override
public void addProviderProperties() throws MojoExecutionException
{
convertTestNGParameters();
}
+ @Override
public Classpath getProviderClasspath()
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -2571,20 +2578,24 @@ public abstract class AbstractSurefireMojo
final class JUnit3ProviderInfo
implements ProviderInfo
{
+ @Override
@Nonnull public String getProviderName()
{
return "org.apache.maven.surefire.junit.JUnit3Provider";
}
+ @Override
public boolean isApplicable()
{
return true;
}
+ @Override
public void addProviderProperties() throws MojoExecutionException
{
}
+ @Override
public Classpath getProviderClasspath()
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -2609,20 +2620,24 @@ public abstract class AbstractSurefireMojo
this.junitDepArtifact = junitDepArtifact;
}
+ @Override
@Nonnull public String getProviderName()
{
return "org.apache.maven.surefire.junit4.JUnit4Provider";
}
+ @Override
public boolean isApplicable()
{
return junitDepArtifact != null || isAnyJunit4( junitArtifact );
}
+ @Override
public void addProviderProperties() throws MojoExecutionException
{
}
+ @Override
public Classpath getProviderClasspath()
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -2645,6 +2660,7 @@ public abstract class AbstractSurefireMojo
this.junitDepArtifact = junitDepArtifact;
}
+ @Override
@Nonnull public String getProviderName()
{
return "org.apache.maven.surefire.junitcore.JUnitCoreProvider";
@@ -2655,6 +2671,7 @@ public abstract class AbstractSurefireMojo
return junitDepArtifact != null && isJunit47Compatible( junitDepArtifact );
}
+ @Override
public boolean isApplicable()
{
final boolean isJunitArtifact47 = isAnyJunit4( junitArtifact ) && isJunit47Compatible( junitArtifact );
@@ -2662,12 +2679,14 @@ public abstract class AbstractSurefireMojo
return isAny47ProvidersForcers && ( isJunitArtifact47 || is47CompatibleJunitDep() );
}
+ @Override
public void addProviderProperties() throws MojoExecutionException
{
convertJunitCoreParameters();
convertGroupParameters();
}
+ @Override
public Classpath getProviderClasspath()
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -2689,22 +2708,26 @@ public abstract class AbstractSurefireMojo
this.providerName = providerName;
}
+ @Override
public ProviderInfo instantiate( String providerName )
{
return new DynamicProviderInfo( providerName );
}
+ @Override
@Nonnull
public String getProviderName()
{
return providerName;
}
+ @Override
public boolean isApplicable()
{
return true;
}
+ @Override
public void addProviderProperties() throws MojoExecutionException
{
// Ok this is a bit lazy.
@@ -2712,6 +2735,7 @@ public abstract class AbstractSurefireMojo
convertTestNGParameters();
}
+ @Override
public Classpath getProviderClasspath()
throws ArtifactResolutionException, ArtifactNotFoundException
{
@@ -2790,21 +2814,25 @@ public abstract class AbstractSurefireMojo
}
}
+ @Override
public List<String> getExcludes()
{
return excludes;
}
+ @Override
public void setExcludes( List<String> excludes )
{
this.excludes = excludes;
}
+ @Override
public ArtifactRepository getLocalRepository()
{
return localRepository;
}
+ @Override
public void setLocalRepository( ArtifactRepository localRepository )
{
this.localRepository = localRepository;
@@ -3259,11 +3287,13 @@ public abstract class AbstractSurefireMojo
this.project = project;
}
+ @Override
public File getTestSourceDirectory()
{
return testSourceDirectory;
}
+ @Override
public void setTestSourceDirectory( File testSourceDirectory )
{
this.testSourceDirectory = testSourceDirectory;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
index 3663f39..fd2b4fb 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
@@ -92,6 +92,7 @@ public class SurefireProperties
super.clear();
}
+ @Override
public synchronized Enumeration<Object> keys()
{
return Collections.enumeration( items );
@@ -170,6 +171,7 @@ public class SurefireProperties
}
}
+ @Override
public void copyTo( Map<Object, Object> target )
{
target.putAll( this );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
index cc6a808..5931f9e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ChecksumCalculator.java
@@ -19,15 +19,17 @@ package org.apache.maven.plugin.surefire.booterclient;
* under the License.
*/
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
import java.io.File;
-import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.repository.ArtifactRepository;
+
+import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
/**
* @author Kristian Rosenvold
@@ -153,7 +155,7 @@ public class ChecksumCalculator
{
MessageDigest md = MessageDigest.getInstance( "SHA-1" );
String configValue = getConfig();
- md.update( configValue.getBytes( "iso-8859-1" ), 0, configValue.length() );
+ md.update( configValue.getBytes( ISO_8859_1 ), 0, configValue.length() );
byte[] sha1hash = md.digest();
return asHexString( sha1hash );
}
@@ -161,10 +163,6 @@ public class ChecksumCalculator
{
throw new RuntimeException( e );
}
- catch ( UnsupportedEncodingException e )
- {
- throw new RuntimeException( e );
- }
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index b3a3f91..c46cfb6 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -54,7 +54,6 @@ import org.apache.maven.surefire.util.DefaultScanResult;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
@@ -98,7 +97,7 @@ import static org.apache.maven.surefire.util.internal.ConcurrencyUtils.countDown
import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThread;
import static org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
import static org.apache.maven.surefire.util.internal.ObjectUtils.requireNonNull;
-import static org.apache.maven.surefire.util.internal.StringUtils.FORK_STREAM_CHARSET_NAME;
+import static org.apache.maven.surefire.util.internal.StringUtils.ISO_8859_1;
/**
* Starts the fork or runs in-process.
@@ -180,6 +179,7 @@ public class ForkStarter
}
}
+ @Override
@SuppressWarnings( "checkstyle:innerassignment" )
public void run()
{
@@ -205,6 +205,7 @@ public class ForkStarter
}
}
+ @Override
public void close()
{
run();
@@ -340,6 +341,7 @@ public class ForkStarter
{
Callable<RunResult> pf = new Callable<RunResult>()
{
+ @Override
public RunResult call()
throws Exception
{
@@ -404,6 +406,7 @@ public class ForkStarter
{
Callable<RunResult> pf = new Callable<RunResult>()
{
+ @Override
public RunResult call()
throws Exception
{
@@ -618,8 +621,7 @@ public class ForkStarter
CommandLineCallable future =
executeCommandLineAsCallable( cli, testProvidingInputStream, threadedStreamConsumer,
- stdErrConsumer, 0, closer,
- Charset.forName( FORK_STREAM_CHARSET_NAME ) );
+ stdErrConsumer, 0, closer, ISO_8859_1 );
currentForkClients.add( forkClient );
@@ -719,6 +721,7 @@ public class ForkStarter
{
return SHUTDOWN_HOOK_THREAD_FACTORY.newThread( new Runnable()
{
+ @Override
public void run()
{
builder.getImmediateCommands().shutdown( shutdownType );
@@ -731,6 +734,7 @@ public class ForkStarter
{
return SHUTDOWN_HOOK_THREAD_FACTORY.newThread( new Runnable()
{
+ @Override
public void run()
{
builder.getCachableCommands().shutdown( shutdownType );
@@ -743,6 +747,7 @@ public class ForkStarter
{
return SHUTDOWN_HOOK_THREAD_FACTORY.newThread( new Runnable()
{
+ @Override
public void run()
{
for ( TestProvidingInputStream stream : streams )
@@ -769,6 +774,7 @@ public class ForkStarter
{
return pingThreadScheduler.scheduleAtFixedRate( new Runnable()
{
+ @Override
public void run()
{
builder.getImmediateCommands().noop();
@@ -780,6 +786,7 @@ public class ForkStarter
{
return pingThreadScheduler.scheduleAtFixedRate( new Runnable()
{
+ @Override
public void run()
{
for ( TestProvidingInputStream stream : streams )
@@ -794,6 +801,7 @@ public class ForkStarter
{
return timeoutCheckScheduler.scheduleAtFixedRate( new Runnable()
{
+ @Override
public void run()
{
long systemTime = currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
index 0abf42f..eb1ab5b 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/OutputStreamFlushableCommandline.java
@@ -48,6 +48,7 @@ public class OutputStreamFlushableCommandline
this.outputStream = outputStream;
}
+ @Override
public void flush()
throws IOException
{
@@ -71,6 +72,7 @@ public class OutputStreamFlushableCommandline
return process;
}
+ @Override
public FlushReceiver getFlushReceiver()
{
return flushReceiver;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStream.java
index d0ae47a..521130c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestLessInputStream.java
@@ -62,10 +62,12 @@ public final class TestLessInputStream
this.builder = builder;
}
+ @Override
public void provideNewTest()
{
}
+ @Override
public void skipSinceNextTest()
{
if ( canContinue() )
@@ -75,6 +77,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void shutdown( Shutdown shutdownType )
{
if ( canContinue() )
@@ -84,6 +87,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void noop()
{
if ( canContinue() )
@@ -186,6 +190,7 @@ public final class TestLessInputStream
{
iterableCachable = new Iterable<Command>()
{
+ @Override
public Iterator<Command> iterator()
{
return new CIt();
@@ -270,11 +275,13 @@ public final class TestLessInputStream
{
private Node node = TestLessInputStreamBuilder.this.head;
+ @Override
public boolean hasNext()
{
return examineNext( false ) != null;
}
+ @Override
public Command next()
{
Command command = examineNext( true );
@@ -285,6 +292,7 @@ public final class TestLessInputStream
return command;
}
+ @Override
public void remove()
{
throw new UnsupportedOperationException();
@@ -307,10 +315,12 @@ public final class TestLessInputStream
private final class ImmediateCommands
implements NotifiableTestStream
{
+ @Override
public void provideNewTest()
{
}
+ @Override
public void skipSinceNextTest()
{
Lock lock = rwLock.readLock();
@@ -328,6 +338,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void shutdown( Shutdown shutdownType )
{
Lock lock = rwLock.readLock();
@@ -345,6 +356,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void noop()
{
Lock lock = rwLock.readLock();
@@ -387,10 +399,12 @@ public final class TestLessInputStream
private final class CachableCommands
implements NotifiableTestStream
{
+ @Override
public void provideNewTest()
{
}
+ @Override
public void skipSinceNextTest()
{
Lock lock = rwLock.readLock();
@@ -408,6 +422,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void shutdown( Shutdown shutdownType )
{
Lock lock = rwLock.readLock();
@@ -425,6 +440,7 @@ public final class TestLessInputStream
}
}
+ @Override
public void noop()
{
Lock lock = rwLock.readLock();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
index 69f73a2..35cb2d4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/lazytestprovider/TestProvidingInputStream.java
@@ -82,6 +82,7 @@ public final class TestProvidingInputStream
}
}
+ @Override
public void skipSinceNextTest()
{
if ( canContinue() )
@@ -91,6 +92,7 @@ public final class TestProvidingInputStream
}
}
+ @Override
public void shutdown( Shutdown shutdownType )
{
if ( canContinue() )
@@ -100,6 +102,7 @@ public final class TestProvidingInputStream
}
}
+ @Override
public void noop()
{
if ( canContinue() )
@@ -150,6 +153,7 @@ public final class TestProvidingInputStream
/**
* Signal that a new test is to be provided.
*/
+ @Override
public void provideNewTest()
{
if ( canContinue() )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
index 952feb8..b5a53b4 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/DeserializedStacktraceWriter.java
@@ -46,22 +46,26 @@ public class DeserializedStacktraceWriter
this.stackTrace = stackTrace;
}
+ @Override
public String smartTrimmedStackTrace()
{
return smartTrimmed;
}
// Trimming or not is decided on the forking side
+ @Override
public String writeTraceToString()
{
return stackTrace;
}
+ @Override
public String writeTrimmedTraceToString()
{
return stackTrace;
}
+ @Override
public SafeThrowable getThrowable()
{
return new SafeThrowable( message );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
index 7aaa0f1..b02ae54 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ForkClient.java
@@ -151,6 +151,7 @@ public class ForkClient
return defaultReporterFactory;
}
+ @Override
public final void consumeLine( String s )
{
if ( isNotBlank( s ) )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/NativeStdErrStreamConsumer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/NativeStdErrStreamConsumer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/NativeStdErrStreamConsumer.java
index 0ddc392..d460583 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/NativeStdErrStreamConsumer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/NativeStdErrStreamConsumer.java
@@ -39,6 +39,7 @@ public final class NativeStdErrStreamConsumer
this.defaultReporterFactory = defaultReporterFactory;
}
+ @Override
public void consumeLine( String line )
{
InPluginProcessDumpSingleton.getSingleton().dumpText( line, defaultReporterFactory );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
index ff9c238..972eaa7 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java
@@ -73,6 +73,7 @@ public final class ThreadedStreamConsumer
* e.g. acquire-next-test which means that {@link ForkClient} could hang on waiting for old test to complete
* and therefore the plugin could be permanently in progress.
*/
+ @Override
public void run()
{
while ( !ThreadedStreamConsumer.this.stop.get() )
@@ -111,6 +112,7 @@ public final class ThreadedStreamConsumer
thread.start();
}
+ @Override
public void consumeLine( String s )
{
if ( stop.get() && !thread.isAlive() )
@@ -130,6 +132,7 @@ public final class ThreadedStreamConsumer
}
}
+ @Override
public void close()
throws IOException
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java
index d93813e..0f1217c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java
@@ -45,6 +45,7 @@ public final class PluginConsoleLogger
return mojoLogger.isDebugEnabled();
}
+ @Override
public void debug( String message )
{
if ( mojoLogger.isDebugEnabled() )
@@ -66,6 +67,7 @@ public final class PluginConsoleLogger
return mojoLogger.isInfoEnabled();
}
+ @Override
public void info( String message )
{
if ( mojoLogger.isInfoEnabled() )
@@ -79,6 +81,7 @@ public final class PluginConsoleLogger
return mojoLogger.isWarnEnabled();
}
+ @Override
public void warning( String message )
{
if ( mojoLogger.isWarnEnabled() )
@@ -100,6 +103,7 @@ public final class PluginConsoleLogger
return mojoLogger.isErrorEnabled();
}
+ @Override
public void error( String message )
{
if ( mojoLogger.isErrorEnabled() )
@@ -108,6 +112,7 @@ public final class PluginConsoleLogger
}
}
+ @Override
public void error( String message, Throwable t )
{
if ( mojoLogger.isErrorEnabled() )
@@ -116,6 +121,7 @@ public final class PluginConsoleLogger
}
}
+ @Override
public void error( Throwable t )
{
if ( mojoLogger.isErrorEnabled() )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
index f9e59fe..682686c 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleOutputFileReporter.java
@@ -52,16 +52,19 @@ public class ConsoleOutputFileReporter
this.reportNameSuffix = reportNameSuffix;
}
+ @Override
public void testSetStarting( ReportEntry reportEntry )
{
close();
reportEntryName = reportEntry.getName();
}
+ @Override
public void testSetCompleted( ReportEntry report )
{
}
+ @Override
@SuppressWarnings( "checkstyle:emptyblock" )
public void close()
{
@@ -79,6 +82,7 @@ public class ConsoleOutputFileReporter
}
}
+ @Override
public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
{
try
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
index b4a6f30..3b8d765 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
@@ -86,6 +86,7 @@ public class DefaultReporterFactory
listeners = new ConcurrentLinkedQueue<TestSetRunListener>();
}
+ @Override
public RunListener createReporter()
{
TestSetRunListener testSetRunListener =
@@ -159,6 +160,7 @@ public class DefaultReporterFactory
listeners.add( listener );
}
+ @Override
public RunResult close()
{
mergeTestHistoryResult();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
index 25312aa..ab33cb8 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DirectConsoleOutput.java
@@ -50,6 +50,7 @@ public class DirectConsoleOutput
}
+ @Override
public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
{
final PrintStream stream = stdout ? sout : serr;
@@ -64,14 +65,17 @@ public class DirectConsoleOutput
}
}
+ @Override
public void testSetStarting( ReportEntry reportEntry )
{
}
+ @Override
public void testSetCompleted( ReportEntry report )
{
}
+ @Override
public void close()
{
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
index e18f3aa..327c77d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullConsoleOutputReceiver.java
@@ -37,18 +37,22 @@ class NullConsoleOutputReceiver
{
}
+ @Override
public void testSetStarting( ReportEntry reportEntry )
{
}
+ @Override
public void testSetCompleted( ReportEntry report )
{
}
+ @Override
public void close()
{
}
+ @Override
public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
{
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/11511f4a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index 397c4c1..c57123e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -25,6 +25,7 @@ import org.apache.maven.shared.utils.xml.XMLWriter;
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.ReporterException;
import org.apache.maven.surefire.report.SafeThrowable;
+import org.apache.maven.surefire.util.internal.StringUtils;
import java.io.File;
import java.io.FileOutputStream;
@@ -32,8 +33,6 @@ import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -44,6 +43,7 @@ import java.util.StringTokenizer;
import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType;
import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
+import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
// CHECKSTYLE_OFF: LineLength
@@ -81,10 +81,6 @@ import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
*/
public class StatelessXmlReporter
{
- private static final String ENCODING = "UTF-8";
-
- private static final Charset ENCODING_CS = Charset.forName( ENCODING );
-
private final File reportsDirectory;
private final String reportNameSuffix;
@@ -129,7 +125,7 @@ public class StatelessXmlReporter
try
{
XMLWriter ppw = new PrettyPrintXMLWriter( fw );
- ppw.setEncoding( ENCODING );
+ ppw.setEncoding( StringUtils.UTF_8.name() );
createTestSuiteElement( ppw, testSetReportEntry, testSetStats, testSetReportEntry.elapsedTimeAsString() );
@@ -302,7 +298,7 @@ public class StatelessXmlReporter
private static OutputStreamWriter getWriter( FileOutputStream fos )
{
- return new OutputStreamWriter( fos, ENCODING_CS );
+ return new OutputStreamWriter( fos, UTF_8 );
}
private static void getAddMethodEntryList( Map<String, List<WrappedReportEntry>> methodRunHistoryMap,
@@ -540,7 +536,7 @@ public class StatelessXmlReporter
// there's nothing better we can do! :-(
// SUREFIRE-456
out.write( ByteConstantsHolder.AMP_BYTES );
- out.write( String.valueOf( b ).getBytes( ENCODING ) );
+ out.write( String.valueOf( b ).getBytes( UTF_8 ) );
out.write( ';' ); // & Will be encoded to amp inside xml encodingSHO
}
else
@@ -612,17 +608,10 @@ public class StatelessXmlReporter
static
{
- try
- {
- CDATA_START_BYTES = "<![CDATA[".getBytes( ENCODING );
- CDATA_END_BYTES = "]]>".getBytes( ENCODING );
- CDATA_ESCAPE_STRING_BYTES = "]]><![CDATA[>".getBytes( ENCODING );
- AMP_BYTES = "&#".getBytes( ENCODING );
- }
- catch ( UnsupportedEncodingException e )
- {
- throw new RuntimeException( e );
- }
+ CDATA_START_BYTES = "<![CDATA[".getBytes( UTF_8 );
+ CDATA_END_BYTES = "]]>".getBytes( UTF_8 );
+ CDATA_ESCAPE_STRING_BYTES = "]]><![CDATA[>".getBytes( UTF_8 );
+ AMP_BYTES = "&#".getBytes( UTF_8 );
}
}
}