You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2014/10/26 00:59:44 UTC
[4/5] git commit: o Update to maven-parent 25,
fix tons of rat and checkstyle errors
o Update to maven-parent 25, fix tons of rat and checkstyle errors
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/e4ff0329
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/e4ff0329
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/e4ff0329
Branch: refs/heads/master
Commit: e4ff03293e74a2e049fdd9fe4a8e03753568e8a9
Parents: 2e62ff4
Author: Andreas Gudian <ag...@apache.org>
Authored: Sun Oct 26 00:57:48 2014 +0200
Committer: Andreas Gudian <ag...@apache.org>
Committed: Sun Oct 26 00:57:48 2014 +0200
----------------------------------------------------------------------
CONTRIBUTING.md | 19 ++
.../plugin/failsafe/IntegrationTestMojo.java | 21 +-
.../maven/plugin/failsafe/VerifyMojo.java | 4 +-
.../plugin/surefire/AbstractSurefireMojo.java | 247 +++++++++--------
.../maven/plugin/surefire/ClasspathCache.java | 7 +-
.../maven/plugin/surefire/ProviderList.java | 2 +
.../surefire/StartupReportConfiguration.java | 4 +-
.../plugin/surefire/SurefireProperties.java | 20 +-
.../surefire/booterclient/BooterSerializer.java | 5 +-
.../booterclient/ChecksumCalculator.java | 3 +-
.../booterclient/ForkConfiguration.java | 30 ++-
.../surefire/booterclient/ForkNumberBucket.java | 29 +-
.../surefire/booterclient/ForkStarter.java | 13 +-
.../OutputStreamFlushableCommandline.java | 3 -
.../TestProvidingInputStream.java | 6 +-
.../output/ThreadedStreamConsumer.java | 11 +-
.../report/ConsoleOutputFileReporter.java | 4 +-
.../plugin/surefire/report/ConsoleReporter.java | 3 -
.../surefire/report/DefaultReporterFactory.java | 22 +-
.../plugin/surefire/report/FileReporter.java | 5 +-
.../surefire/report/FileReporterUtils.java | 4 +-
.../surefire/report/PrettyPrintXMLWriter.java | 4 +
.../plugin/surefire/report/ReportEntryType.java | 12 +-
.../surefire/report/StatelessXmlReporter.java | 15 +-
.../surefire/report/TestSetRunListener.java | 13 +-
.../plugin/surefire/report/TestSetStats.java | 7 +-
.../Utf8RecodingDeferredFileOutputStream.java | 1 +
.../surefire/report/WrappedReportEntry.java | 9 +-
.../plugin/surefire/util/DependencyScanner.java | 15 +-
.../plugin/surefire/util/DirectoryScanner.java | 5 +-
.../maven/plugin/surefire/util/Relocator.java | 7 +-
.../maven/plugin/surefire/util/ScannerUtil.java | 16 +-
.../surefire/util/SpecificFileFilter.java | 4 +
.../surefire/report/SurefireReportParser.java | 3 +-
.../surefire/report/TestSuiteXmlParser.java | 4 +-
.../maven/surefire/report/RunStatistics.java | 7 -
.../report/DefaultReporterFactoryTest.java | 65 +++--
.../report/StatelessXmlReporterTest.java | 16 +-
.../maven/surefire/report/FileReporterTest.java | 4 +-
.../maven/plugin/surefire/SurefirePlugin.java | 25 +-
.../src/site/markdown/newerrorsummary.md | 19 ++
.../report/AbstractSurefireReportMojo.java | 17 +-
.../surefire/report/FailsafeReportMojo.java | 9 +-
.../report/SurefireReportGenerator.java | 269 ++++++++++---------
.../surefire/report/SurefireReportMojo.java | 10 +-
.../surefire/report/SurefireReportOnlyMojo.java | 4 +-
pom.xml | 2 +-
.../surefire/runorder/RunEntryStatistics.java | 1 +
.../runorder/ThreadedExecutionScheduler.java | 1 +
.../maven/surefire/SpecificTestClassFilter.java | 5 +
.../surefire/booter/BaseProviderFactory.java | 4 +-
.../surefire/booter/ForkingRunListener.java | 14 +-
.../surefire/booter/ProviderParameterNames.java | 1 +
.../surefire/booter/SurefireReflector.java | 7 +-
.../surefire/providerapi/SurefireProvider.java | 2 +-
.../maven/surefire/report/ConsoleLogger.java | 2 +-
.../surefire/report/ConsoleOutputCapture.java | 4 +-
.../ConsoleOutputReceiverForCurrentThread.java | 9 +-
.../report/DefaultDirectConsoleReporter.java | 1 +
.../report/LegacyPojoStackTraceWriter.java | 6 +-
.../maven/surefire/report/ReportEntry.java | 18 +-
.../maven/surefire/report/SafeThrowable.java | 1 +
.../surefire/testset/RunOrderParameters.java | 2 +-
.../util/DefaultRunOrderCalculator.java | 4 +-
.../maven/surefire/util/DefaultScanResult.java | 10 +-
.../maven/surefire/util/ReflectionUtils.java | 1 +
.../maven/surefire/util/RunOrderCalculator.java | 34 +--
.../surefire/util/internal/ByteBuffer.java | 8 +-
.../surefire/util/internal/StringUtils.java | 5 +-
.../report/LegacyPojoStackTraceWriterTest.java | 19 ++
.../surefire/util/RunOrderCalculatorTest.java | 2 +-
.../maven/surefire/booter/BooterConstants.java | 48 ++--
.../surefire/booter/BooterDeserializer.java | 4 +-
.../apache/maven/surefire/booter/Classpath.java | 18 +-
.../surefire/booter/ClasspathConfiguration.java | 5 +-
.../maven/surefire/booter/ForkedBooter.java | 9 +-
.../surefire/booter/IsolatedClassLoader.java | 4 +-
.../maven/surefire/booter/KeyValueSource.java | 1 +
.../maven/surefire/booter/LazyTestsToRun.java | 3 +-
.../surefire/booter/PropertiesWrapper.java | 13 +-
.../surefire/booter/ProviderConfiguration.java | 1 +
.../maven/surefire/booter/ProviderFactory.java | 9 +-
.../surefire/booter/StartupConfiguration.java | 2 +-
.../maven/surefire/booter/TypeEncodedValue.java | 34 +--
.../surefire/booter/PropertiesWrapperTest.java | 4 +-
.../surefire/booter/SurefireReflectorTest.java | 3 +-
.../surefire/group/match/AndGroupMatcher.java | 5 +
.../surefire/group/match/GroupMatcher.java | 5 +
.../group/match/InverseGroupMatcher.java | 5 +
.../surefire/group/match/JoinGroupMatcher.java | 5 +
.../surefire/group/match/OrGroupMatcher.java | 5 +
.../group/match/SingleGroupMatcher.java | 5 +
.../its/Junit47StaticInnerClassTestsIT.java | 19 ++
.../its/fixture/SurefireLauncherTest.java | 19 ++
.../Surefire569RunTestFromDependencyJarsIT.java | 19 ++
.../surefire/report/PojoStackTraceWriter.java | 3 +-
.../surefire/report/SmartStackTraceParser.java | 6 +-
.../surefire/common/junit3/JUnit3Reflector.java | 4 +
.../surefire/common/junit4/JUnit4Reflector.java | 17 +-
.../common/junit4/JUnit4RunListener.java | 9 +-
.../common/junit4/JUnitTestFailureListener.java | 19 ++
.../common/junit48/JUnit48Reflector.java | 5 +-
.../common/junit48/JUnit48TestChecker.java | 8 +-
.../maven/surefire/junit/JUnit3Provider.java | 5 +-
.../maven/surefire/junit/JUnitTestSet.java | 4 +
.../maven/surefire/junit/PojoTestSet.java | 4 +
.../maven/surefire/junit/SurefireTestSet.java | 4 +
.../junit/TestListenerInvocationHandler.java | 4 +
.../maven/surefire/junit4/JUnit4Provider.java | 35 ++-
.../junitcore/ConfigurableParallelComputer.java | 2 +-
.../surefire/junitcore/JUnitCoreProvider.java | 6 +-
.../surefire/junitcore/SynchronousRunner.java | 1 +
.../maven/surefire/junitcore/TestSet.java | 6 +-
.../maven/surefire/junitcore/pc/Balancer.java | 6 +-
.../surefire/junitcore/pc/InvokerStrategy.java | 3 +-
.../surefire/junitcore/pc/ParallelComputer.java | 6 +-
.../junitcore/pc/ParallelComputerBuilder.java | 37 +--
.../junitcore/pc/ParallelComputerUtil.java | 13 +-
.../junitcore/pc/SchedulingStrategy.java | 3 -
.../junitcore/pc/SharedThreadPoolStrategy.java | 4 +-
.../surefire/junitcore/pc/ShutdownStatus.java | 1 +
.../utils/GroupMatcherMethodSelector.java | 5 +
.../surefire/testng/utils/MethodSelector.java | 8 +-
.../testng/TestNGDirectoryTestSuite.java | 17 +-
.../maven/surefire/testng/TestNGExecutor.java | 2 +
.../maven/surefire/testng/TestNGProvider.java | 7 +-
.../maven/surefire/testng/TestNGReporter.java | 1 -
.../surefire/testng/TestNGXmlTestSuite.java | 10 +-
.../maven/surefire/testng/TestNgTestSuite.java | 3 +-
.../testng/conf/AbstractDirectConfigurator.java | 8 +
.../surefire/testng/conf/Configurator.java | 4 +
.../testng/conf/TestNGMapConfigurator.java | 3 +-
.../surefire/report/SurefireReportParser.java | 3 +-
.../surefire/report/TestSuiteXmlParser.java | 6 +-
134 files changed, 1064 insertions(+), 658 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4041b4d..1985ce1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,22 @@
+<!--
+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.
+-->
+
Guidelines for contributing
===========
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 1d47248..91fdfa7 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
@@ -163,7 +163,7 @@ public class IntegrationTestMojo
*/
@Parameter( property = "failsafe.parallel.forcedTimeout" )
private double parallelTestsTimeoutForcedInSeconds;
-
+
/**
* A list of <include> elements specifying the tests (by pattern) that should be included in testing. When not
* specified and when the <code>test</code> parameter is not specified, the default includes will be <code><br/>
@@ -219,7 +219,8 @@ public class IntegrationTestMojo
@Parameter( property = "failsafe.rerunFailingTestsCount", defaultValue = "0" )
protected int rerunFailingTestsCount;
- protected int getRerunFailingTestsCount() {
+ protected int getRerunFailingTestsCount()
+ {
return rerunFailingTestsCount;
}
@@ -264,8 +265,8 @@ public class IntegrationTestMojo
{
if ( StringUtils.isEmpty( encoding ) )
{
- getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING +
- ", i.e. build is platform dependent!" );
+ getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ + ", i.e. build is platform dependent!" );
return ReaderFactory.FILE_ENCODING;
}
else
@@ -471,19 +472,23 @@ public class IntegrationTestMojo
this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
}
- public double getParallelTestsTimeoutInSeconds() {
+ public double getParallelTestsTimeoutInSeconds()
+ {
return parallelTestsTimeoutInSeconds;
}
- public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds ) {
+ public void setParallelTestsTimeoutInSeconds( double parallelTestsTimeoutInSeconds )
+ {
this.parallelTestsTimeoutInSeconds = parallelTestsTimeoutInSeconds;
}
- public double getParallelTestsTimeoutForcedInSeconds() {
+ public double getParallelTestsTimeoutForcedInSeconds()
+ {
return parallelTestsTimeoutForcedInSeconds;
}
- public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds ) {
+ public void setParallelTestsTimeoutForcedInSeconds( double parallelTestsTimeoutForcedInSeconds )
+ {
this.parallelTestsTimeoutForcedInSeconds = parallelTestsTimeoutForcedInSeconds;
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 fb41b93..f9abed0 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
@@ -60,8 +60,8 @@ public class VerifyMojo
private boolean skipTests;
/**
- * Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite
- * convenient on occasion.
+ * Set this to 'true' to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but
+ * quite convenient on occasion.
*
* @since 2.4.3-alpha-2
*/
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 3d5e149..7398a25 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
@@ -1,3 +1,4 @@
+// CHECKSTYLE_OFF: FileLength|RegexpHeader
package org.apache.maven.plugin.surefire;
/*
@@ -207,8 +208,8 @@ public abstract class AbstractSurefireMojo
protected File testSourceDirectory;
/**
- * A file containing include patterns.
- * Blank lines, or lines starting with # are ignored. If {@code includes} are also specified these patterns are appended.
+ * A file containing include patterns. Blank lines, or lines starting with # are ignored. If {@code includes} are
+ * also specified these patterns are appended.
*/
@Parameter
protected File includesFile;
@@ -229,8 +230,8 @@ public abstract class AbstractSurefireMojo
protected List<String> excludes;
/**
- * A file containing exclude patterns.
- * Blank lines, or lines starting with # are ignored. If {@code excludes} are also specified these patterns are appended.
+ * A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If {@code excludes} are
+ * also specified these patterns are appended.
*/
@Parameter
protected File excludesFile;
@@ -316,11 +317,13 @@ public abstract class AbstractSurefireMojo
protected Boolean failIfNoTests;
/**
- * <strong>DEPRECATED</strong> since version 2.14. Use <code>forkCount</code> and <code>reuseForks</code> instead.<br/>
+ * <strong>DEPRECATED</strong> since version 2.14. Use <code>forkCount</code> and <code>reuseForks</code> instead.
* <br/>
- * Option to specify the forking mode. Can be "never", "once", "always", "perthread". "none" and "pertest" are also accepted
- * for backwards compatibility. "always" forks for each test-class. "perthread" will create <code>threadCount</code>
- * parallel forks, each executing one test-class. See also parameter <code>reuseForks</code>.<br/>
+ * <br/>
+ * Option to specify the forking mode. Can be "never", "once", "always", "perthread". "none" and "pertest" are also
+ * accepted for backwards compatibility. "always" forks for each test-class. "perthread" will create
+ * <code>threadCount</code> parallel forks, each executing one test-class. See also parameter
+ * <code>reuseForks</code>.<br/>
*
* @since 2.1
*/
@@ -373,8 +376,9 @@ public abstract class AbstractSurefireMojo
protected boolean childDelegation;
/**
- * (TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one of the groups specified here will
- * be included in test run, if specified.<br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
+ * (TestNG/JUnit47 provider with JUnit4.8+ only) Groups for this test. Only classes/methods/etc decorated with one
+ * of the groups specified here will be included in test run, if specified.<br/>
+ * For JUnit, this parameter forces the use of the 4.7 provider<br/>
* This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
*
* @since 2.2
@@ -383,8 +387,9 @@ public abstract class AbstractSurefireMojo
protected String groups;
/**
- * (TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups specified in this list will
- * specifically not be run.<br/>For JUnit, this parameter forces the use of the 4.7 provider<br/>
+ * (TestNG/JUnit47 provider with JUnit4.8+ only) Excluded groups. Any methods/classes/etc with one of the groups
+ * specified in this list will specifically not be run.<br/>
+ * For JUnit, this parameter forces the use of the 4.7 provider<br/>
* This parameter is ignored if the <code>suiteXmlFiles</code> parameter is specified.
*
* @since 2.2
@@ -430,15 +435,16 @@ public abstract class AbstractSurefireMojo
protected int threadCount;
/**
- * Option to specify the number of VMs to fork in parallel in order to execute the tests.
- * When terminated with "C", the number part is multiplied with the number of CPU cores. Floating point value are only accepted together with "C".
- * If set to "0", no VM is forked and all tests are executed within the main process.<br/>
+ * Option to specify the number of VMs to fork in parallel in order to execute the tests. When terminated with "C",
+ * the number part is multiplied with the number of CPU cores. Floating point value are only accepted together with
+ * "C". If set to "0", no VM is forked and all tests are executed within the main process.<br/>
* <br/>
* Example values: "1.5C", "4"<br/>
* <br/>
- * The system properties and the <code>argLine</code> of the forked processes may contain the place holder string <code>${surefire.forkNumber}</code>,
- * which is replaced with a fixed number for each of the parallel forks, ranging from <code>1</code> to the effective value of <code>forkCount</code>
- * times the maximum number of parallel Surefire executions in maven parallel builds, i.e. the effective value of the <code>-T</code> command line
+ * The system properties and the <code>argLine</code> of the forked processes may contain the place holder string
+ * <code>${surefire.forkNumber}</code>, which is replaced with a fixed number for each of the parallel forks,
+ * ranging from <code>1</code> to the effective value of <code>forkCount</code> times the maximum number of parallel
+ * Surefire executions in maven parallel builds, i.e. the effective value of the <code>-T</code> command line
* argument of maven core.
*
* @since 2.14
@@ -550,20 +556,19 @@ public abstract class AbstractSurefireMojo
/**
* (JUnit 4.7 provider) This attribute allows you to specify the concurrency in test methods, i.e.:
* <ul>
- * <li>number of concurrent methods if <code>threadCount</code> is 0 or unspecified</li>
- * <li>limited concurrency of methods if <code>useUnlimitedThreads</code> is set to <strong>true</strong></li>
- * <li>if <code>threadCount</code> and certain thread-count parameters are > 0 for <code>parallel</code>, the
- * concurrency is computed from ratio. For instance parallel=all and the ratio between
- * <code>threadCountSuites</code>:<code>threadCountClasses</code>:<em>threadCountMethods</em> is
- * 2:3:<em>5</em>, there is 50% of <code>threadCount</code> in concurrent methods.</li>
- * <li>as in the previous case but without this leaf thread-count. Example: parallel=all, threadCount=16,
- * threadCountSuites=2, threadCountClasses=3, but threadCountMethods is unspecified leaf, the number of concurrent
- * methods is varying from >= 11 to 14 or 15. The threadCountSuites and threadCountClasses become number of threads.
- * </li>
+ * <li>number of concurrent methods if <code>threadCount</code> is 0 or unspecified</li>
+ * <li>limited concurrency of methods if <code>useUnlimitedThreads</code> is set to <strong>true</strong></li>
+ * <li>if <code>threadCount</code> and certain thread-count parameters are > 0 for <code>parallel</code>, the
+ * concurrency is computed from ratio. For instance parallel=all and the ratio between
+ * <code>threadCountSuites</code>:<code>threadCountClasses</code>:<em>threadCountMethods</em> is 2:3:<em>5</em>,
+ * there is 50% of <code>threadCount</code> in concurrent methods.</li>
+ * <li>as in the previous case but without this leaf thread-count. Example: parallel=all, threadCount=16,
+ * threadCountSuites=2, threadCountClasses=3, but threadCountMethods is unspecified leaf, the number of concurrent
+ * methods is varying from >= 11 to 14 or 15. The threadCountSuites and threadCountClasses become number of
+ * threads.</li>
* </ul>
- *
- * Only makes sense to use in conjunction with the <code>parallel</code> parameter.
- * The default value <code>0</code> behaves same as unspecified one.
+ * Only makes sense to use in conjunction with the <code>parallel</code> parameter. The default value <code>0</code>
+ * behaves same as unspecified one.
*
* @since 2.16
*/
@@ -643,7 +648,8 @@ public abstract class AbstractSurefireMojo
/**
* Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
- * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and "filesystem".
+ * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and
+ * "filesystem".
* <p/>
* <p/>
* Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
@@ -651,13 +657,13 @@ public abstract class AbstractSurefireMojo
* <p/>
* Failed first will run tests that failed on previous run first, as well as new tests for this run.
* <p/>
- * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing
- * the overall execution time. Initially a statistics file is created and every next test run will reorder classes.
+ * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
+ * overall execution time. Initially a statistics file is created and every next test run will reorder classes.
* <p/>
- * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not
- * be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration,
- * so different configurations will have different statistics files, meaning if you change any config
- * settings you will re-run once before new statistics data can be established.
+ * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked
+ * into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different
+ * configurations will have different statistics files, meaning if you change any config settings you will re-run
+ * once before new statistics data can be established.
*
* @since 2.7
*/
@@ -886,7 +892,8 @@ public abstract class AbstractSurefireMojo
private SurefireProperties setupProperties()
{
SurefireProperties sysProps = null;
- try {
+ try
+ {
sysProps = SurefireProperties.loadProperties( systemPropertiesFile );
}
catch ( IOException e )
@@ -1059,8 +1066,8 @@ public abstract class AbstractSurefireMojo
}
Artifact testNgArtifact = getTestNgArtifact();
- if ( testNgArtifact != null){
-
+ if ( testNgArtifact != null )
+ {
DefaultArtifactVersion defaultArtifactVersion = new DefaultArtifactVersion( testNgArtifact.getVersion() );
getProperties().setProperty( "testng.configurator", getConfiguratorName( defaultArtifactVersion ) );
}
@@ -1137,7 +1144,7 @@ public abstract class AbstractSurefireMojo
String usedParallel = ( getParallel() != null ) ? getParallel() : "none";
- if ( !"none".equals( usedParallel ))
+ if ( !"none".equals( usedParallel ) )
{
checkNonForkedThreads( parallel );
}
@@ -1147,9 +1154,12 @@ public abstract class AbstractSurefireMojo
getProperties().setProperty( ProviderParameterNames.THREADCOUNT_PROP, usedThreadCount );
getProperties().setProperty( "perCoreThreadCount", Boolean.toString( getPerCoreThreadCount() ) );
getProperties().setProperty( "useUnlimitedThreads", Boolean.toString( getUseUnlimitedThreads() ) );
- getProperties().setProperty( ProviderParameterNames.THREADCOUNTSUITES_PROP, Integer.toString( getThreadCountSuites() ) );
- getProperties().setProperty( ProviderParameterNames.THREADCOUNTCLASSES_PROP, Integer.toString( getThreadCountClasses() ) );
- getProperties().setProperty( ProviderParameterNames.THREADCOUNTMETHODS_PROP, Integer.toString( getThreadCountMethods() ) );
+ getProperties().setProperty( ProviderParameterNames.THREADCOUNTSUITES_PROP,
+ Integer.toString( getThreadCountSuites() ) );
+ getProperties().setProperty( ProviderParameterNames.THREADCOUNTCLASSES_PROP,
+ Integer.toString( getThreadCountClasses() ) );
+ getProperties().setProperty( ProviderParameterNames.THREADCOUNTMETHODS_PROP,
+ Integer.toString( getThreadCountMethods() ) );
getProperties().setProperty( ProviderParameterNames.PARALLEL_TIMEOUT_PROP,
Double.toString( getParallelTestsTimeoutInSeconds() ) );
getProperties().setProperty( ProviderParameterNames.PARALLEL_TIMEOUTFORCED_PROP,
@@ -1159,9 +1169,11 @@ public abstract class AbstractSurefireMojo
String message =
"parallel='" + usedParallel + '\'' + ", perCoreThreadCount=" + getPerCoreThreadCount() + ", threadCount="
- + usedThreadCount + ", useUnlimitedThreads=" + getUseUnlimitedThreads() +
- ", threadCountSuites=" + getThreadCountSuites() + ", threadCountClasses=" + getThreadCountClasses() +
- ", threadCountMethods=" + getThreadCountMethods() + ", parallelOptimized=" + isParallelOptimized();
+ + usedThreadCount + ", useUnlimitedThreads=" + getUseUnlimitedThreads()
+ + ", threadCountSuites=" + getThreadCountSuites()
+ + ", threadCountClasses=" + getThreadCountClasses()
+ + ", threadCountMethods=" + getThreadCountMethods()
+ + ", parallelOptimized=" + isParallelOptimized();
getLog().info( message );
}
@@ -1172,8 +1184,8 @@ public abstract class AbstractSurefireMojo
{
if ( !( getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountSuites() > 0 ) )
{
- throw new MojoExecutionException( "Use threadCount or threadCountSuites > 0 or useUnlimitedThreads=true " +
- "for parallel='suites'" );
+ throw new MojoExecutionException(
+ "Use threadCount or threadCountSuites > 0 or useUnlimitedThreads=true for parallel='suites'" );
}
setThreadCountClasses( 0 );
setThreadCountMethods( 0 );
@@ -1182,8 +1194,9 @@ public abstract class AbstractSurefireMojo
{
if ( !( getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountClasses() > 0 ) )
{
- throw new MojoExecutionException( "Use threadCount or threadCountClasses > 0 or useUnlimitedThreads=true " +
- "for parallel='classes'" );
+ throw new MojoExecutionException(
+ "Use threadCount or threadCountClasses > 0 or useUnlimitedThreads=true for parallel='classes'"
+ );
}
setThreadCountSuites( 0 );
setThreadCountMethods( 0 );
@@ -1192,8 +1205,9 @@ public abstract class AbstractSurefireMojo
{
if ( !( getUseUnlimitedThreads() || getThreadCount() > 0 ^ getThreadCountMethods() > 0 ) )
{
- throw new MojoExecutionException( "Use threadCount or threadCountMethods > 0 or useUnlimitedThreads=true " +
- "for parallel='methods'" );
+ throw new MojoExecutionException(
+ "Use threadCount or threadCountMethods > 0 or useUnlimitedThreads=true for parallel='methods'"
+ );
}
setThreadCountSuites( 0 );
setThreadCountClasses( 0 );
@@ -1209,12 +1223,12 @@ public abstract class AbstractSurefireMojo
|| getThreadCount() > 0 && getThreadCountSuites() > 0 && getThreadCount() > getThreadCountSuites()
&& getThreadCountClasses() == 0 && getThreadCountMethods() == 0 ) )
{
- throw new MojoExecutionException( "Use useUnlimitedThreads=true, " +
- "or only threadCount > 0, " +
- "or (threadCountSuites > 0 and threadCountClasses > 0), " +
- "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0) " +
- "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) " +
- "for parallel='suitesAndClasses' or 'both'" );
+ throw new MojoExecutionException( "Use useUnlimitedThreads=true, "
+ + "or only threadCount > 0, "
+ + "or (threadCountSuites > 0 and threadCountClasses > 0), "
+ + "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0) "
+ + "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) "
+ + "for parallel='suitesAndClasses' or 'both'" );
}
setThreadCountMethods( 0 );
}
@@ -1229,12 +1243,12 @@ public abstract class AbstractSurefireMojo
|| getThreadCount() > 0 && getThreadCountSuites() > 0 && getThreadCount() > getThreadCountSuites()
&& getThreadCountClasses() == 0 && getThreadCountMethods() == 0 ) )
{
- throw new MojoExecutionException( "Use useUnlimitedThreads=true, " +
- "or only threadCount > 0, " +
- "or (threadCountSuites > 0 and threadCountMethods > 0), " +
- "or (threadCount > 0 and threadCountSuites > 0 and threadCountMethods > 0), " +
- "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) " +
- "for parallel='suitesAndMethods'" );
+ throw new MojoExecutionException( "Use useUnlimitedThreads=true, "
+ + "or only threadCount > 0, "
+ + "or (threadCountSuites > 0 and threadCountMethods > 0), "
+ + "or (threadCount > 0 and threadCountSuites > 0 and threadCountMethods > 0), "
+ + "or (threadCount > 0 and threadCountSuites > 0 and threadCount > threadCountSuites) "
+ + "for parallel='suitesAndMethods'" );
}
setThreadCountClasses( 0 );
}
@@ -1249,12 +1263,12 @@ public abstract class AbstractSurefireMojo
|| getThreadCount() > 0 && getThreadCountClasses() > 0 && getThreadCount() > getThreadCountClasses()
&& getThreadCountSuites() == 0 && getThreadCountMethods() == 0 ) )
{
- throw new MojoExecutionException( "Use useUnlimitedThreads=true, " +
- "or only threadCount > 0, " +
- "or (threadCountClasses > 0 and threadCountMethods > 0), " +
- "or (threadCount > 0 and threadCountClasses > 0 and threadCountMethods > 0), " +
- "or (threadCount > 0 and threadCountClasses > 0 and threadCount > threadCountClasses) " +
- "for parallel='both' or parallel='classesAndMethods'" );
+ throw new MojoExecutionException( "Use useUnlimitedThreads=true, "
+ + "or only threadCount > 0, "
+ + "or (threadCountClasses > 0 and threadCountMethods > 0), "
+ + "or (threadCount > 0 and threadCountClasses > 0 and threadCountMethods > 0), "
+ + "or (threadCount > 0 and threadCountClasses > 0 and threadCount > threadCountClasses) "
+ + "for parallel='both' or parallel='classesAndMethods'" );
}
setThreadCountSuites( 0 );
}
@@ -1267,13 +1281,13 @@ public abstract class AbstractSurefireMojo
&& getThreadCountMethods() == 0
&& getThreadCount() > ( getThreadCountSuites() + getThreadCountClasses() ) ) )
{
- throw new MojoExecutionException( "Use useUnlimitedThreads=true, " +
- "or only threadCount > 0, " +
- "or (threadCountSuites > 0 and threadCountClasses > 0 and threadCountMethods > 0), " +
- "or every thread-count is specified, " +
- "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0 " +
- "and threadCount > threadCountSuites + threadCountClasses) " +
- "for parallel='all'" );
+ throw new MojoExecutionException( "Use useUnlimitedThreads=true, "
+ + "or only threadCount > 0, "
+ + "or (threadCountSuites > 0 and threadCountClasses > 0 and threadCountMethods > 0), "
+ + "or every thread-count is specified, "
+ + "or (threadCount > 0 and threadCountSuites > 0 and threadCountClasses > 0 "
+ + "and threadCount > threadCountSuites + threadCountClasses) "
+ + "for parallel='all'" );
}
}
else
@@ -1288,11 +1302,13 @@ public abstract class AbstractSurefireMojo
&& getThreadCountMethods() == 0;
}
- private static void checkThreadCountEntity(int count, String entity) throws MojoExecutionException
+ private static void checkThreadCountEntity( int count, String entity )
+ throws MojoExecutionException
{
if ( count < 0 )
{
- throw new MojoExecutionException("parallel maven execution does not allow negative thread-count" + entity);
+ throw new MojoExecutionException(
+ "parallel maven execution does not allow negative thread-count" + entity );
}
}
@@ -1379,13 +1395,14 @@ public abstract class AbstractSurefireMojo
isTestNg ? new TestArtifactInfo( testNgArtifact.getVersion(), testNgArtifact.getClassifier() ) : null;
List<File> testXml = getSuiteXmlFiles() != null ? Arrays.asList( getSuiteXmlFiles() ) : null;
TestRequest testSuiteDefinition =
- new TestRequest(testXml, getTestSourceDirectory(), getTest(), getTestMethod(),
- getRerunFailingTestsCount());
- final boolean failIfNoTests;
+ new TestRequest( testXml, getTestSourceDirectory(), getTest(), getTestMethod(),
+ getRerunFailingTestsCount() );
+
+ final boolean actualFailIfNoTests;
if ( isValidSuiteXmlFileConfig() && getTest() == null )
{
- failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
+ actualFailIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
if ( !isTestNg )
{
throw new MojoExecutionException( "suiteXmlFiles is configured, but there is no TestNG dependency" );
@@ -1395,25 +1412,25 @@ public abstract class AbstractSurefireMojo
{
if ( isSpecificTestSpecified() )
{
- failIfNoTests = getEffectiveFailIfNoTests();
- setFailIfNoTests( failIfNoTests );
+ actualFailIfNoTests = getEffectiveFailIfNoTests();
+ setFailIfNoTests( actualFailIfNoTests );
}
else
{
- failIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
+ actualFailIfNoTests = getFailIfNoTests() != null && getFailIfNoTests();
}
- List<String> includes = getIncludeList();
- List<String> excludes = getExcludeList();
+ List<String> actualIncludes = getIncludeList();
+ List<String> actualExcludes = getExcludeList();
List<String> specificTests = getSpecificTests();
directoryScannerParameters =
- new DirectoryScannerParameters( getTestClassesDirectory(), includes, excludes, specificTests,
- failIfNoTests, getRunOrder() );
+ new DirectoryScannerParameters( getTestClassesDirectory(), actualIncludes, actualExcludes,
+ specificTests, actualFailIfNoTests, getRunOrder() );
}
Properties providerProperties = getProperties();
- return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, failIfNoTests,
+ return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, actualFailIfNoTests,
reporterConfiguration, testNg, testSuiteDefinition, providerProperties, null,
false );
}
@@ -1444,7 +1461,7 @@ public abstract class AbstractSurefireMojo
Artifact surefireArtifact = getCommonArtifact();
Classpath inprocClassPath = providerClasspath.
addClassPathElementUrl( surefireArtifact.getFile().getAbsolutePath() )
- .addClassPathElementUrl( getApiArtifact().getFile().getAbsolutePath());
+ .addClassPathElementUrl( getApiArtifact().getFile().getAbsolutePath() );
final Classpath testClasspath = generateTestClasspath();
@@ -1504,7 +1521,8 @@ public abstract class AbstractSurefireMojo
return getSuiteXmlFiles() != null && getSuiteXmlFiles().length > 0;
}
- @Nonnull private List<String> readListFromFile( @Nonnull final File file )
+ @SuppressWarnings( "checkstyle:modifierorder" )
+ private @Nonnull List<String> readListFromFile( @Nonnull final File file )
{
List<String> list;
@@ -1543,42 +1561,43 @@ public abstract class AbstractSurefireMojo
}
}
+ @SuppressWarnings( "checkstyle:modifierorder" )
private @Nonnull List<String> getExcludeList()
{
- List<String> excludes = null;
+ List<String> actualExcludes = null;
if ( isSpecificTestSpecified() )
{
// Check to see if we are running a single test. The raw parameter will
// come through if it has not been set.
// FooTest -> **/FooTest.java
- excludes = new ArrayList<String>();
+ actualExcludes = new ArrayList<String>();
}
else
{
if ( getExcludesFile() != null )
{
- excludes = readListFromFile( getExcludesFile() );
+ actualExcludes = readListFromFile( getExcludesFile() );
}
// If we have excludesFile, and we have excludes, then append excludes to excludesFile content
- if ( excludes == null )
+ if ( actualExcludes == null )
{
- excludes = this.getExcludes();
+ actualExcludes = this.getExcludes();
}
else
{
- maybeAppendList( excludes, this.getExcludes() );
+ maybeAppendList( actualExcludes, this.getExcludes() );
}
// defaults here, qdox doesn't like the end javadoc value
// Have to wrap in an ArrayList as surefire expects an ArrayList instead of a List for some reason
- if ( excludes == null || excludes.size() == 0 )
+ if ( actualExcludes == null || actualExcludes.size() == 0 )
{
- excludes = Arrays.asList( "**/*$*" );
+ actualExcludes = Arrays.asList( "**/*$*" );
}
}
- return filterNulls( excludes );
+ return filterNulls( actualExcludes );
}
private List<String> getIncludeList()
@@ -1616,6 +1635,7 @@ public abstract class AbstractSurefireMojo
return filterNulls( includes );
}
+ @SuppressWarnings( "checkstyle:modifierorder" )
private @Nonnull List<String> filterNulls( @Nonnull List<String> toFilter )
{
List<String> result = new ArrayList<String>( toFilter.size() );
@@ -1784,6 +1804,7 @@ public abstract class AbstractSurefireMojo
}
}
+ @SuppressWarnings( "checkstyle:emptyblock" )
protected int getEffectiveForkCount()
{
if ( effectiveForkCount < 0 )
@@ -1833,7 +1854,8 @@ public abstract class AbstractSurefireMojo
String debugForkedProcess = getDebugForkedProcess();
if ( "true".equals( debugForkedProcess ) )
{
- return "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005";
+ return "-Xdebug -Xnoagent -Djava.compiler=NONE"
+ + " -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005";
}
return debugForkedProcess;
}
@@ -2010,7 +2032,8 @@ public abstract class AbstractSurefireMojo
if ( getClasspathDependencyExcludes() != null )
{
- ArtifactFilter dependencyFilter = new PatternIncludesArtifactFilter( Arrays.asList( getClasspathDependencyExcludes() ) );
+ ArtifactFilter dependencyFilter =
+ new PatternIncludesArtifactFilter( Arrays.asList( getClasspathDependencyExcludes() ) );
classpathArtifacts = this.filterArtifacts( classpathArtifacts, dependencyFilter );
}
@@ -2142,8 +2165,8 @@ public abstract class AbstractSurefireMojo
Artifact artifact = (Artifact) o;
getLog().debug(
- "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
- " Scope: " + artifact.getScope() );
+ "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath()
+ + " Scope: " + artifact.getScope() );
items.add( artifact.getFile().getAbsolutePath() );
}
@@ -2255,7 +2278,8 @@ public abstract class AbstractSurefireMojo
if ( junitArtifact != null )
{
throw new MojoFailureException( "groups/excludedGroups are specified but JUnit version on classpath"
- + " is too old to support groups. Check your dependency:tree to see if your project is picking up an old junit version" );
+ + " is too old to support groups. Check your dependency:tree to see if your project"
+ + " is picking up an old junit version" );
}
throw new MojoFailureException(
"groups/excludedGroups require TestNG or JUnit48+ on project test classpath" );
@@ -2273,6 +2297,7 @@ public abstract class AbstractSurefireMojo
this.testNgArtifact = testNgArtifact;
}
+ @SuppressWarnings( "checkstyle:modifierorder" )
public @Nonnull String getProviderName()
{
return "org.apache.maven.surefire.testng.TestNGProvider";
@@ -2408,6 +2433,10 @@ public abstract class AbstractSurefireMojo
}
+ /**
+ * Provides the Provider information for manually configured providers
+ *
+ */
public class DynamicProviderInfo
implements ConfigurableProviderInfo
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache.java
index ea250c2..b8b2e2d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ClasspathCache.java
@@ -1,4 +1,5 @@
package org.apache.maven.plugin.surefire;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,16 +29,16 @@ import javax.annotation.Nonnull;
*/
public class ClasspathCache
{
- private static final ConcurrentHashMap<String, Classpath> classpaths =
+ private static final ConcurrentHashMap<String, Classpath> CLASSPATHS =
new ConcurrentHashMap<String, Classpath>( 4 );
public static Classpath getCachedClassPath( @Nonnull String artifactId )
{
- return classpaths.get( artifactId );
+ return CLASSPATHS.get( artifactId );
}
public static void setCachedClasspath( @Nonnull String key, @Nonnull Classpath classpath )
{
- classpaths.put( key, classpath );
+ CLASSPATHS.put( key, classpath );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
index 7e56aa4..21e95d2 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ProviderList.java
@@ -45,6 +45,7 @@ public class ProviderList
}
+ @SuppressWarnings( "checkstyle:modifierorder" )
public @Nonnull List<ProviderInfo> resolve( @Nonnull Log log )
{
List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
@@ -65,6 +66,7 @@ public class ProviderList
return autoDetectOneProvider();
}
+ @SuppressWarnings( "checkstyle:modifierorder" )
private @Nonnull List<ProviderInfo> autoDetectOneProvider()
{
List<ProviderInfo> providersToRun = new ArrayList<ProviderInfo>();
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index f44ba3a..12837ed 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -72,6 +72,7 @@ public class StartupReportConfiguration
public static final String PLAIN_REPORT_FORMAT = ConsoleReporter.PLAIN;
+ @SuppressWarnings( "checkstyle:parameternumber" )
public StartupReportConfiguration( boolean useFile, boolean printSummary, String reportFormat,
boolean redirectTestOutputToFile, boolean disableXmlReport,
@Nonnull File reportsDirectory, boolean trimStackTrace, String reportNameSuffix,
@@ -142,7 +143,8 @@ public class StartupReportConfiguration
return reportsDirectory;
}
- public int getRerunFailingTestsCount() {
+ public int getRerunFailingTestsCount()
+ {
return rerunFailingTestsCount;
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 606c26b..7d94368 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
@@ -1,4 +1,5 @@
package org.apache.maven.plugin.surefire;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,14 +19,11 @@ package org.apache.maven.plugin.surefire;
* under the License.
*/
-import org.apache.maven.surefire.booter.Classpath;
-import org.apache.maven.surefire.booter.KeyValueSource;
-import org.apache.maven.surefire.util.internal.StringUtils;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
@@ -36,6 +34,10 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.maven.surefire.booter.Classpath;
+import org.apache.maven.surefire.booter.KeyValueSource;
+import org.apache.maven.surefire.util.internal.StringUtils;
+
/**
* A properties implementation that preserves insertion order.
*/
@@ -111,19 +113,15 @@ public class SurefireProperties
return keySet();
}
- private static final Set<String> keysThatCannotBeUsedAsSystemProperties = new HashSet<String>()
- {{
- add( "java.library.path" );
- add( "file.encoding" );
- add( "jdk.map.althashing.threshold" );
- }};
+ private static final Set<String> KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES = new HashSet<String>(
+ Arrays.asList( "java.library.path", "file.encoding", "jdk.map.althashing.threshold" ) );
public Set<Object> propertiesThatCannotBeSetASystemProperties()
{
Set<Object> result = new HashSet<Object>();
for ( Object key : getStringKeySet() )
{
- if ( keysThatCannotBeUsedAsSystemProperties.contains( key ) )
+ if ( KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES.contains( key ) )
{
result.add( key );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
index d5c6181..57581ad 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
@@ -75,7 +75,7 @@ class BooterSerializer
ClasspathConfiguration cp = providerConfiguration.getClasspathConfiguration();
properties.setClasspath( ClasspathConfiguration.CLASSPATH, cp.getTestClasspath() );
properties.setClasspath( ClasspathConfiguration.SUREFIRE_CLASSPATH, cp.getProviderClasspath() );
- properties.setProperty( ClasspathConfiguration.ENABLE_ASSERTIONS, String.valueOf( cp.isEnableAssertions()) );
+ properties.setProperty( ClasspathConfiguration.ENABLE_ASSERTIONS, String.valueOf( cp.isEnableAssertions() ) );
properties.setProperty( ClasspathConfiguration.CHILD_DELEGATION, String.valueOf( cp.isChildDelegation() ) );
TestArtifactInfo testNg = booterConfiguration.getTestArtifact();
@@ -94,7 +94,8 @@ class BooterSerializer
properties.setProperty( BooterConstants.SOURCE_DIRECTORY, testSuiteDefinition.getTestSourceDirectory() );
properties.addList( testSuiteDefinition.getSuiteXmlFiles(), BooterConstants.TEST_SUITE_XML_FILES );
properties.setNullableProperty( BooterConstants.REQUESTEDTEST, testSuiteDefinition.getRequestedTest() );
- properties.setNullableProperty( BooterConstants.REQUESTEDTESTMETHOD, testSuiteDefinition.getRequestedTestMethod() );
+ properties.setNullableProperty( BooterConstants.REQUESTEDTESTMETHOD,
+ testSuiteDefinition.getRequestedTestMethod() );
properties.setNullableProperty( BooterConstants.RERUN_FAILING_TESTS_COUNT,
String.valueOf( testSuiteDefinition.getRerunFailingTestsCount() ) );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 5f703b1..7f62768 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
@@ -11,7 +11,7 @@ package org.apache.maven.plugin.surefire.booterclient;
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required| by applicable law or agreed to in writing,
+ * 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
@@ -122,6 +122,7 @@ public class ChecksumCalculator
appendObject( aBoolean );
}
+ @SuppressWarnings( "checkstyle:magicnumber" )
private static String asHexString( byte[] bytes )
{
if ( bytes == null )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
index d468c37..5843428 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
@@ -79,9 +79,11 @@ public class ForkConfiguration
private final String debugLine;
- public ForkConfiguration( Classpath bootClasspathConfiguration, File tmpDir, String debugLine, String jvmExecutable,
- File workingDirectory, Properties modelProperties, String argLine, Map<String, String> environmentVariables,
- boolean debugEnabled, int forkCount, boolean reuseForks )
+ @SuppressWarnings( "checkstyle:parameternumber" )
+ public ForkConfiguration( Classpath bootClasspathConfiguration, File tmpDir, String debugLine,
+ String jvmExecutable, File workingDirectory, Properties modelProperties, String argLine,
+ Map<String, String> environmentVariables, boolean debugEnabled, int forkCount,
+ boolean reuseForks )
{
this.bootClasspathConfiguration = bootClasspathConfiguration;
this.tempDirectory = tmpDir;
@@ -111,8 +113,8 @@ public class ForkConfiguration
{
return FORK_NEVER;
}
- else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE ) ||
- forkMode.equals( FORK_ALWAYS ) || forkMode.equals( FORK_PERTHREAD ) )
+ else if ( forkMode.equals( FORK_NEVER ) || forkMode.equals( FORK_ONCE )
+ || forkMode.equals( FORK_ALWAYS ) || forkMode.equals( FORK_PERTHREAD ) )
{
return forkMode;
}
@@ -135,7 +137,8 @@ public class ForkConfiguration
throws SurefireBooterForkException
{
return createCommandLine( classPath,
- startupConfiguration.getClassLoaderConfiguration().isManifestOnlyJarRequestedAndUsable(),
+ startupConfiguration.getClassLoaderConfiguration()
+ .isManifestOnlyJarRequestedAndUsable(),
startupConfiguration.isShadefire(), startupConfiguration.isProviderMainClass()
? startupConfiguration.getActualClassName()
: ForkedBooter.class.getName(), threadNumber );
@@ -151,7 +154,9 @@ public class ForkConfiguration
if ( argLine != null )
{
- cli.createArg().setLine( replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ), threadNumber ) );
+ cli.createArg().setLine(
+ replaceThreadNumberPlaceholder( stripNewLines( replacePropertyExpressions( argLine ) ),
+ threadNumber ) );
}
if ( environmentVariables != null )
@@ -217,15 +222,18 @@ public class ForkConfiguration
*/
private String replacePropertyExpressions( String argLine )
{
- if ( argLine == null ) {
+ if ( argLine == null )
+ {
return null;
}
- for ( Enumeration<?> e = modelProperties.propertyNames(); e.hasMoreElements(); ) {
+ for ( Enumeration<?> e = modelProperties.propertyNames(); e.hasMoreElements(); )
+ {
String key = e.nextElement().toString();
String field = "@{" + key + "}";
- if ( argLine.contains(field) ) {
- argLine = argLine.replace(field, modelProperties.getProperty(key, ""));
+ if ( argLine.contains( field ) )
+ {
+ argLine = argLine.replace( field, modelProperties.getProperty( key, "" ) );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
index c107982..55d099d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
@@ -1,5 +1,24 @@
package org.apache.maven.plugin.surefire.booterclient;
+/*
+ * 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 java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
@@ -7,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* A bucket from which fork numbers can be drawn. Any drawn number needs to be returned to the bucket, in order to keep
* the range of provided values delivered as small as possible.
- *
+ *
* @author Andreas Gudian
*/
public class ForkNumberBucket
@@ -32,7 +51,7 @@ public class ForkNumberBucket
*/
public static int drawNumber()
{
- return getInstance()._drawNumber();
+ return getInstance().drawNumberInternal();
}
/**
@@ -40,7 +59,7 @@ public class ForkNumberBucket
*/
public static void returnNumber( int number )
{
- getInstance()._returnNumber( number );
+ getInstance().returnNumberInternal( number );
}
/**
@@ -55,7 +74,7 @@ public class ForkNumberBucket
* @return a fork number that is not currently in use. The value must be returned to the bucket using
* {@link #returnNumber(int)}.
*/
- protected int _drawNumber()
+ protected int drawNumberInternal()
{
Integer nextFree = qFree.poll();
@@ -80,7 +99,7 @@ public class ForkNumberBucket
/**
* @param number the number to return to the bucket so that it can be reused.
*/
- protected void _returnNumber( int number )
+ protected void returnNumberInternal( int number )
{
qFree.add( Integer.valueOf( number ) );
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 31833d5..919867a 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
@@ -179,7 +179,7 @@ public class ForkStarter
}
finally
{
- defaultReporterFactory.mergeFromOtherFactories(defaultReporterFactoryList);
+ defaultReporterFactory.mergeFromOtherFactories( defaultReporterFactoryList );
defaultReporterFactory.close();
}
return result;
@@ -197,6 +197,7 @@ public class ForkStarter
&& !testSuiteDefinition.getSuiteXmlFiles().isEmpty();
}
+ @SuppressWarnings( "checkstyle:magicnumber" )
private RunResult runSuitesForkOnceMultiple( final SurefireProperties effectiveSystemProperties, int forkCount )
throws SurefireBooterForkException
{
@@ -281,6 +282,7 @@ public class ForkStarter
}
+ @SuppressWarnings( "checkstyle:magicnumber" )
private RunResult runSuitesForkPerTestSet( final SurefireProperties effectiveSystemProperties, final int forkCount )
throws SurefireBooterForkException
{
@@ -305,8 +307,9 @@ public class ForkStarter
DefaultReporterFactory forkedReporterFactory =
new DefaultReporterFactory( startupReportConfiguration );
defaultReporterFactoryList.add( forkedReporterFactory );
- ForkClient forkClient = new ForkClient( forkedReporterFactory,
- startupReportConfiguration.getTestVmSystemProperties() );
+ ForkClient forkClient =
+ new ForkClient( forkedReporterFactory,
+ startupReportConfiguration.getTestVmSystemProperties() );
return fork( testSet, new PropertiesWrapper( providerConfiguration.getProviderProperties() ),
forkClient, effectiveSystemProperties, null );
}
@@ -348,6 +351,7 @@ public class ForkStarter
}
+ @SuppressWarnings( "checkstyle:magicnumber" )
private void closeExecutor( ExecutorService executorService )
throws SurefireBooterForkException
{
@@ -478,7 +482,8 @@ public class ForkStarter
}
catch ( CommandLineException e )
{
- runResult = RunResult.failure( forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult(), e );
+ runResult =
+ RunResult.failure( forkClient.getDefaultReporterFactory().getGlobalRunStatistics().getRunResult(), e );
throw new SurefireBooterForkException( "Error while executing forked tests.", e.getCause() );
}
finally
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 deefbd0..ea8e0f6 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
@@ -71,9 +71,6 @@ public class OutputStreamFlushableCommandline
return process;
}
- /* (non-Javadoc)
- * @see org.apache.maven.plugin.surefire.booterclient.lazytestprovider.FlushReceiverProvider#getFlushReceiver()
- */
public FlushReceiver getFlushReceiver()
{
return flushReceiver;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 7304435..cb48cf0 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
@@ -32,7 +32,7 @@ import java.util.concurrent.Semaphore;
* After providing each test class name, followed by a newline character, a flush is performed on the
* {@link FlushReceiver} provided by the {@link FlushReceiverProvider} that can be set using
* {@link #setFlushReceiverProvider(FlushReceiverProvider)}.
- *
+ *
* @author Andreas Gudian
*/
public class TestProvidingInputStream
@@ -52,7 +52,7 @@ public class TestProvidingInputStream
/**
* C'tor
- *
+ *
* @param testItemQueue source of the tests to be read from this stream
*/
public TestProvidingInputStream( Queue<String> testItemQueue )
@@ -68,6 +68,7 @@ public class TestProvidingInputStream
this.flushReceiverProvider = flushReceiverProvider;
}
+ @SuppressWarnings( "checkstyle:magicnumber" )
@Override
public synchronized int read()
throws IOException
@@ -117,6 +118,7 @@ public class TestProvidingInputStream
semaphore.release();
}
+ @Override
public void close()
{
closed = true;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 d4d6991..7574eec 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
@@ -31,10 +31,10 @@ import java.util.concurrent.LinkedBlockingQueue;
public class ThreadedStreamConsumer
implements StreamConsumer
{
-
private final java.util.concurrent.BlockingQueue<String> items = new LinkedBlockingQueue<String>();
- private static final String poison = "Pioson";
+ private static final String POISON = "Pioson";
+ private static final int ITEM_LIMIT_BEFORE_SLEEP = 10000;
private final Thread thread;
@@ -62,7 +62,7 @@ public class ThreadedStreamConsumer
{
String item = queue.take();
//noinspection StringEquality
- while ( item != poison )
+ while ( item != POISON )
{
target.consumeLine( item );
item = queue.take();
@@ -89,10 +89,11 @@ public class ThreadedStreamConsumer
thread.start();
}
+ @SuppressWarnings( "checkstyle:emptyblock" )
public void consumeLine( String s )
{
items.add( s );
- if ( items.size() > 10000 )
+ if ( items.size() > ITEM_LIMIT_BEFORE_SLEEP )
{
try
{
@@ -109,7 +110,7 @@ public class ThreadedStreamConsumer
{
try
{
- items.add( poison );
+ items.add( POISON );
thread.join();
}
catch ( InterruptedException e )
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 184d0bf..25afe73 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
@@ -24,7 +24,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.ReporterException;
/**
* Surefire output consumer proxy that writes test output to a {@link java.io.File} for each test suite.
@@ -58,10 +57,10 @@ public class ConsoleOutputFileReporter
}
public void testSetCompleted( ReportEntry report )
- throws ReporterException
{
}
+ @SuppressWarnings( "checkstyle:emptyblock" )
public void close()
{
if ( fileOutputStream != null )
@@ -73,7 +72,6 @@ public class ConsoleOutputFileReporter
}
catch ( IOException e )
{
- ;
}
fileOutputStream = null;
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
index 14e8c67..605fbfb 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java
@@ -25,7 +25,6 @@ import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.List;
import org.apache.maven.surefire.report.ReportEntry;
-import org.apache.maven.surefire.report.ReporterException;
/**
* Base class for console reporters.
@@ -53,7 +52,6 @@ public class ConsoleReporter
}
public void testSetStarting( ReportEntry report )
- throws ReporterException
{
writeMessage( getTestSetStartingMessage( report ) );
}
@@ -79,7 +77,6 @@ public class ConsoleReporter
}
public void testSetCompleted( WrappedReportEntry report, TestSetStats testSetStats, List<String> testResults )
- throws ReporterException
{
writeMessage( testSetStats.getTestSetSummary( report ) );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 704c498..62619a3 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
@@ -175,12 +175,12 @@ public class DefaultReporterFactory
boolean seenSuccess = false, seenFailure = false;
for ( ReportEntryType resultType : reportEntryList )
{
- if ( resultType == ReportEntryType.success )
+ if ( resultType == ReportEntryType.SUCCESS )
{
seenSuccess = true;
}
- else if ( resultType == ReportEntryType.failure
- || resultType == ReportEntryType.error )
+ else if ( resultType == ReportEntryType.FAILURE
+ || resultType == ReportEntryType.ERROR )
{
seenFailure = true;
}
@@ -198,11 +198,11 @@ public class DefaultReporterFactory
if ( !seenSuccess && seenFailure )
{
- if ( reportEntryList.get( 0 ) == ReportEntryType.failure )
+ if ( reportEntryList.get( 0 ) == ReportEntryType.FAILURE )
{
return TestResultType.failure;
}
- else if ( reportEntryList.get( 0 ) == ReportEntryType.error )
+ else if ( reportEntryList.get( 0 ) == ReportEntryType.ERROR )
{
return TestResultType.error;
}
@@ -219,8 +219,8 @@ public class DefaultReporterFactory
}
/**
- * Merge all the TestMethodStats in each TestRunListeners and put results into flakyTests, failedTests and errorTests,
- * indexed by test class and method name. Update globalStatistics based on the result of the merge.
+ * Merge all the TestMethodStats in each TestRunListeners and put results into flakyTests, failedTests and
+ * errorTests, indexed by test class and method name. Update globalStatistics based on the result of the merge.
*/
void mergeTestHistoryResult()
{
@@ -261,7 +261,7 @@ public class DefaultReporterFactory
completedCount++;
List<ReportEntryType> resultTypeList = new ArrayList<ReportEntryType>();
- for (TestMethodStats methodStats : testMethodStats)
+ for ( TestMethodStats methodStats : testMethodStats )
{
resultTypeList.add( methodStats.getResultType() );
}
@@ -273,8 +273,10 @@ public class DefaultReporterFactory
case success:
// If there are multiple successful runs of the same test, count all of them
int successCount = 0;
- for (ReportEntryType type : resultTypeList) {
- if (type == ReportEntryType.success) {
+ for ( ReportEntryType type : resultTypeList )
+ {
+ if ( type == ReportEntryType.SUCCESS )
+ {
successCount++;
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
index f2e8e28..fddb00f 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
@@ -24,6 +24,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
+
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.ReporterException;
@@ -31,7 +32,7 @@ import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIll
/**
* Base class for file reporters.
- *
+ *
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author Kristian Rosenvold
*/
@@ -51,7 +52,6 @@ public class FileReporter
}
private PrintWriter testSetStarting( ReportEntry report )
- throws ReporterException
{
File reportFile = getReportFile( reportsDirectory, report.getName(), reportNameSuffix, ".txt" );
@@ -103,7 +103,6 @@ public class FileReporter
}
public void testSetCompleted( WrappedReportEntry report, TestSetStats testSetStats, List<String> testResults )
- throws ReporterException
{
PrintWriter writer = testSetStarting( report );
writer.print( testSetStats.getTestSetSummary( report ) );
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
index 5009da9..f829121 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporterUtils.java
@@ -21,7 +21,7 @@ package org.apache.maven.plugin.surefire.report;
/**
* Utils class for file-based reporters
- *
+ *
* @author Andreas Gudian
*/
public class FileReporterUtils
@@ -31,7 +31,9 @@ public class FileReporterUtils
String result = original;
String illegalChars = getOSSpecificIllegalChars();
for ( int i = 0; i < illegalChars.length(); i++ )
+ {
result = result.replace( illegalChars.charAt( i ), '_' );
+ }
return result;
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
index b0fea62..551b54e 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/PrettyPrintXMLWriter.java
@@ -24,6 +24,10 @@ import java.util.LinkedList;
import org.apache.maven.shared.utils.xml.XMLWriter;
+/**
+ * A pretty printing XML writer
+ *
+ */
public class PrettyPrintXMLWriter
implements XMLWriter
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
index e998c8e..863672a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ReportEntryType.java
@@ -19,13 +19,17 @@ package org.apache.maven.plugin.surefire.report;
* under the License.
*/
+/**
+ * Type of an entry in the report
+ *
+ */
public enum ReportEntryType
{
- error( "error", "flakyError", "rerunError" ),
- failure( "failure", "flakyFailure", "rerunFailure" ),
- skipped( "skipped", "", "" ),
- success( "", "", "" );
+ ERROR( "error", "flakyError", "rerunError" ),
+ FAILURE( "failure", "flakyFailure", "rerunFailure" ),
+ SKIPPED( "skipped", "", "" ),
+ SUCCESS( "", "", "" );
private final String xmlTag;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/e4ff0329/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 d120c11..dedeb27 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
@@ -46,6 +46,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;
+// CHECKSTYLE_OFF: LineLength
/**
* XML format reporter writing to <code>TEST-<i>reportName</i>[-<i>suffix</i>].xml</code> file like written and read
* by Ant's <a href="http://ant.apache.org/manual/Tasks/junit.html"><code><junit></code></a> and
@@ -108,7 +109,6 @@ public class StatelessXmlReporter
}
public void testSetCompleted( WrappedReportEntry testSetReportEntry, TestSetStats testSetStats )
- throws ReporterException
{
String testClassName = testSetReportEntry.getName();
@@ -154,7 +154,7 @@ public class StatelessXmlReporter
case success:
for ( WrappedReportEntry methodEntry : methodEntryList )
{
- if ( methodEntry.getReportEntryType() == ReportEntryType.success )
+ if ( methodEntry.getReportEntryType() == ReportEntryType.SUCCESS )
{
startTestElement( ppw, methodEntry, reportNameSuffix,
methodEntryList.get( 0 ).elapsedTimeAsString() );
@@ -190,7 +190,7 @@ public class StatelessXmlReporter
// Get the run time of the first successful run
for ( WrappedReportEntry singleRunEntry : methodEntryList )
{
- if ( singleRunEntry.getReportEntryType() == ReportEntryType.success )
+ if ( singleRunEntry.getReportEntryType() == ReportEntryType.SUCCESS )
{
runtime = singleRunEntry.elapsedTimeAsString();
break;
@@ -199,7 +199,7 @@ public class StatelessXmlReporter
startTestElement( ppw, methodEntryList.get( 0 ), reportNameSuffix, runtime );
for ( WrappedReportEntry singleRunEntry : methodEntryList )
{
- if ( singleRunEntry.getReportEntryType() != ReportEntryType.success )
+ if ( singleRunEntry.getReportEntryType() != ReportEntryType.SUCCESS )
{
getTestProblems( fw, ppw, singleRunEntry, trimStackTrace, outputStream,
singleRunEntry.getReportEntryType().getFlakyXmlTag(), true );
@@ -226,7 +226,7 @@ public class StatelessXmlReporter
for ( WrappedReportEntry methodEntry : methodEntryList )
{
startTestElement( ppw, methodEntry, reportNameSuffix, methodEntry.elapsedTimeAsString() );
- if ( methodEntry.getReportEntryType() != ReportEntryType.success )
+ if ( methodEntry.getReportEntryType() != ReportEntryType.SUCCESS )
{
getTestProblems( fw, ppw, methodEntry, trimStackTrace, outputStream,
methodEntry.getReportEntryType().getXmlTag(), false );
@@ -247,7 +247,8 @@ public class StatelessXmlReporter
/**
* Clean testClassMethodRunHistoryMap
*/
- public void cleanTestHistoryMap() {
+ public void cleanTestHistoryMap()
+ {
testClassMethodRunHistoryMap.clear();
}
@@ -308,7 +309,7 @@ public class StatelessXmlReporter
// Get the first successful run's time for flaky runs
for ( WrappedReportEntry singleRunEntry : methodEntryList )
{
- if ( singleRunEntry.getReportEntryType() == ReportEntryType.success )
+ if ( singleRunEntry.getReportEntryType() == ReportEntryType.SUCCESS )
{
totalTimeForSuite = totalTimeForSuite + singleRunEntry.getElapsed();
break;