[SUREFIRE-1366] mvn javadoc:javadoc fails on Javadoc syntax with JDK 1.8
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b54e33e6 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b54e33e6 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b54e33e6 Branch: refs/heads/master Commit: b54e33e68e9c3e13f8fca4b66dbb5c89a0a30715 Parents: cba4adb Author: Tibor17 <tibo...@lycos.com> Authored: Sun Apr 23 10:20:35 2017 +0200 Committer: Tibor17 <tibo...@lycos.com> Committed: Mon May 1 14:21:46 2017 +0200 ---------------------------------------------------------------------- maven-failsafe-plugin/pom.xml | 23 ++ .../plugin/failsafe/IntegrationTestMojo.java | 203 ++++++++++-------- .../maven/plugin/failsafe/VerifyMojo.java | 2 +- .../failsafe/util/FailsafeSummaryXmlUtils.java | 94 ++++++++ .../apache/maven/plugin/failsafe/util/JAXB.java | 104 +++++++++ .../plugin/failsafe/xmlsummary/ErrorType.java | 1 - .../failsafe/xmlsummary/FailsafeSummary.java | 1 - .../xmlsummary/FailsafeSummaryXmlUtils.java | 104 --------- .../maven/plugin/failsafe/xmlsummary/JAXB.java | 1 - .../failsafe/xmlsummary/ObjectFactory.java | 1 - .../failsafe/MarshallerUnmarshallerTest.java | 62 ++---- .../maven/plugin/failsafe/RunResultTest.java | 2 +- maven-surefire-common/pom.xml | 1 - .../plugin/surefire/AbstractSurefireMojo.java | 214 ++++++++++--------- .../surefire/InPluginVMSurefireStarter.java | 2 +- .../surefire/StartupReportConfiguration.java | 6 +- .../surefire/SurefireExecutionParameters.java | 1 - .../surefire/SurefireReportParameters.java | 1 - .../surefire/booterclient/BooterSerializer.java | 4 +- .../booterclient/ForkConfiguration.java | 3 +- .../surefire/booterclient/ForkStarter.java | 4 +- .../surefire/booterclient/ProviderDetector.java | 1 - .../lazytestprovider/AbstractCommandStream.java | 4 + .../TestProvidingInputStream.java | 6 +- .../output/DeserializedStacktraceWriter.java | 2 +- .../booterclient/output/ForkClient.java | 6 +- .../output/ThreadedStreamConsumer.java | 8 +- .../report/ConsoleOutputFileReporter.java | 2 +- .../surefire/report/DefaultReporterFactory.java | 4 +- .../surefire/report/DirectConsoleOutput.java | 2 +- .../surefire/report/StatelessXmlReporter.java | 5 +- .../surefire/report/TestSetRunListener.java | 2 +- .../org/apache/maven/surefire/spi/IDefault.java | 4 +- .../maven/plugin/surefire/SurefirePlugin.java | 204 +++++++++--------- .../src/site/resources/xsd/bindings.xml | 1 - .../src/site/resources/xsd/failsafe-summary.xjb | 31 +++ maven-surefire-report-plugin/pom.xml | 1 - .../surefire/report/FailsafeReportMojo.java | 2 +- .../surefire/report/SurefireReportMojo.java | 2 +- .../resources/surefire-report_sv.properties | 2 + pom.xml | 53 ++++- .../maven/surefire/booter/CommandReader.java | 4 +- .../surefire/booter/DumpErrorSingleton.java | 2 +- .../maven/surefire/booter/FailFastAware.java | 2 +- .../surefire/booter/ForkingReporterFactory.java | 2 - .../surefire/booter/ForkingRunListener.java | 6 +- .../maven/surefire/booter/ShutdownAware.java | 2 +- .../surefire/booter/SurefireReflector.java | 2 +- .../maven/surefire/cli/CommandLineOption.java | 2 +- .../providerapi/ProviderParameters.java | 8 +- .../surefire/providerapi/SurefireProvider.java | 17 +- .../surefire/report/ConsoleOutputCapture.java | 2 +- .../report/LegacyPojoStackTraceWriter.java | 1 - .../maven/surefire/report/ReportEntry.java | 3 +- .../surefire/report/ReporterConfiguration.java | 2 +- .../maven/surefire/report/RunListener.java | 2 +- .../surefire/report/SimpleReportEntry.java | 45 ++-- .../apache/maven/surefire/suite/RunResult.java | 2 +- .../maven/surefire/testset/ResolvedTest.java | 29 ++- .../surefire/testset/TestListResolver.java | 8 +- .../maven/surefire/testset/TestRequest.java | 2 + .../testset/TestSetFailedException.java | 23 +- .../util/SurefireReflectionException.java | 5 +- .../util/internal/DaemonThreadFactory.java | 1 + .../surefire/util/internal/DumpFileUtils.java | 3 + .../surefire/util/internal/StringUtils.java | 66 ++---- .../surefire/testset/FundamentalFilterTest.java | 1 + .../surefire/booter/BooterDeserializer.java | 4 +- .../apache/maven/surefire/booter/Classpath.java | 3 + .../surefire/booter/ClasspathConfiguration.java | 2 +- .../maven/surefire/booter/ForkedBooter.java | 6 +- .../surefire/booter/IsolatedClassLoader.java | 2 +- .../surefire/booter/ProviderConfiguration.java | 2 +- .../maven/surefire/booter/ProviderFactory.java | 2 +- .../surefire/booter/StartupConfiguration.java | 4 +- .../maven/surefire/its/AbstractFailFastIT.java | 2 +- .../maven/surefire/its/FailFastJUnitIT.java | 2 +- .../maven/surefire/its/FailFastTestNgIT.java | 2 +- .../its/IncludesExcludesFromFileIT.java | 2 +- .../its/JUnit47ParallelNotThreadSafeIT.java | 2 +- .../maven/surefire/its/UnicodeTestNamesIT.java | 2 +- .../surefire/its/fixture/MavenLauncher.java | 2 +- .../SurefireJUnit4IntegrationTestCase.java | 2 +- .../surefire/its/fixture/SurefireLauncher.java | 2 +- .../Surefire1024VerifyFailsafeIfTestedIT.java | 2 +- .../jiras/Surefire1028UnableToRunSingleIT.java | 8 +- ...onFilterableJUnitRunnerWithCategoriesIT.java | 2 +- .../jiras/Surefire1053SystemPropertiesIT.java | 2 +- .../Surefire1080ParallelForkDoubleTestIT.java | 6 +- ...urefire1082ParallelJUnitParameterizedIT.java | 2 +- .../its/jiras/Surefire1095NpeInRunListener.java | 7 +- .../jiras/Surefire1098BalancedRunOrderIT.java | 14 +- .../Surefire1122ParallelAndFlakyTestsIT.java | 2 +- ...Surefire1146RerunFailedAndParameterized.java | 2 +- .../jiras/Surefire1158RemoveInfoLinesIT.java | 2 +- .../its/jiras/Surefire1202RerunAndSkipIT.java | 2 +- .../jiras/Surefire1209RerunAndForkCountIT.java | 76 ++++++- .../its/jiras/Surefire1211JUnitTestNgIT.java | 64 +++++- .../its/jiras/Surefire1260NewTestsPattern.java | 50 ++++- .../surefire/its/jiras/Surefire1265Java9IT.java | 3 +- ...urefire649EmptyStringSystemPropertiesIT.java | 2 +- .../its/jiras/Surefire817SystemExitIT.java | 2 +- ...refire855AllowFailsafeUseArtifactFileIT.java | 2 +- .../jiras/Surefire995CategoryInheritanceIT.java | 2 +- .../test/resources/SurefireToolchains/pom.xml | 2 +- .../test/resources/additional-classpath/pom.xml | 2 +- .../resources/aggregate-report/child1/pom.xml | 2 +- .../resources/aggregate-report/child2/pom.xml | 2 +- .../src/test/resources/aggregate-report/pom.xml | 2 +- .../src/test/resources/ant-ignore/pom.xml | 2 +- .../test/resources/argLine-parameter/pom.xml | 2 +- .../test/resources/argLine-properties/pom.xml | 2 +- .../resources/assumpationFailureReport/pom.xml | 2 +- .../test/resources/classpath-filtering/pom.xml | 2 +- .../src/test/resources/classpath-order/pom.xml | 2 +- .../resources/classpath-scope-filtering/pom.xml | 2 +- .../src/test/resources/consoleOutput/pom.xml | 2 +- .../resources/consoleOutputEncoding/pom.xml | 2 +- .../test/resources/consoleoutput-noisy/pom.xml | 2 +- .../src/test/resources/crash-detection/pom.xml | 2 +- .../test/resources/crash-during-test/pom.xml | 2 +- .../default-configuration-abstract/pom.xml | 2 +- .../pom.xml | 2 +- .../default-configuration-noTests/pom.xml | 2 +- .../resources/default-configuration/pom.xml | 2 +- .../resources/environment-variables/pom.xml | 2 +- .../src/test/resources/fail-fast-junit/pom.xml | 2 +- .../src/test/resources/fail-fast-testng/pom.xml | 2 +- .../src/test/resources/failingBuilds/pom.xml | 2 +- .../resources/failure-result-counting/pom.xml | 2 +- .../src/test/resources/failureOutput/pom.xml | 2 +- .../test/resources/fork-consoleOutput/pom.xml | 2 +- .../fork-consoleOutputWithErrors/pom.xml | 2 +- .../src/test/resources/fork-fail/pom.xml | 2 +- .../fork-mode-multimodule/module-a/pom.xml | 2 +- .../fork-mode-multimodule/module-b/pom.xml | 2 +- .../resources/fork-mode-multimodule/pom.xml | 2 +- .../fork-mode-resource-loading/pom.xml | 2 +- .../src/test/resources/fork-mode-testng/pom.xml | 2 +- .../src/test/resources/fork-mode/pom.xml | 2 +- .../src/test/resources/fork-timeout/pom.xml | 2 +- .../test/resources/isolated-classloader/pom.xml | 2 +- .../resources/junit-fork-mode-always/pom.xml | 2 +- .../src/test/resources/junit-ignore/pom.xml | 2 +- .../src/test/resources/junit-innerClass/pom.xml | 2 +- .../junit-notExtendingTestCase/pom.xml | 2 +- .../test/resources/junit-pathWithUmlaut/pom.xml | 2 +- .../resources/junit-twoTestCaseSuite/pom.xml | 2 +- .../test/resources/junit-twoTestCases/pom.xml | 2 +- .../junit4-forkAlways-staticInit/pom.xml | 2 +- .../junit4-rerun-failing-tests/pom.xml | 2 +- .../test/resources/junit4-runlistener/pom.xml | 2 +- .../resources/junit4-twoTestCaseSuite/pom.xml | 2 +- .../src/test/resources/junit4/pom.xml | 2 +- .../src/test/resources/junit44-dep/pom.xml | 2 +- .../test/resources/junit44-environment/pom.xml | 2 +- .../src/test/resources/junit44-hamcrest/pom.xml | 2 +- .../resources/junit44-method-pattern/pom.xml | 2 +- .../resources/junit44-multiple-methods/pom.xml | 2 +- .../resources/junit44-single-method/pom.xml | 2 +- .../test/resources/junit47-concurrency/pom.xml | 2 +- .../test/resources/junit47-parallel-nts/pom.xml | 2 +- .../junit47-parallel-with-suite/pom.xml | 2 +- .../src/test/resources/junit47-parallel/pom.xml | 2 +- .../resources/junit47-redirect-output/pom.xml | 2 +- .../junit47-static-inner-class-tests/pom.xml | 2 +- .../test/resources/junit48-categories/pom.xml | 2 +- .../resources/junit48-method-pattern/pom.xml | 2 +- .../junit48-multiple-method-patterns/pom.xml | 2 +- .../resources/junit48-multiple-methods/pom.xml | 2 +- .../resources/junit48-single-method/pom.xml | 2 +- .../resources/junit48-smartStackTrace/pom.xml | 2 +- .../test/resources/large-test-results/pom.xml | 2 +- .../src/test/resources/norunnableTests/pom.xml | 2 +- .../src/test/resources/parallel-runtime/pom.xml | 2 +- .../resources/plain-old-java-classpath/pom.xml | 2 +- .../src/test/resources/plexus-conflict/pom.xml | 2 +- .../src/test/resources/pojo-simple/pom.xml | 2 +- .../src/test/resources/reporters/pom.xml | 2 +- .../src/test/resources/result-counting/pom.xml | 2 +- .../src/test/resources/runOrder/pom.xml | 2 +- .../test/resources/runorder-parallel/pom.xml | 2 +- .../sibling-aggregator/aggregator/pom.xml | 2 +- .../resources/sibling-aggregator/child1/pom.xml | 2 +- .../resources/sibling-aggregator/child2/pom.xml | 2 +- .../resources/small-result-counting/pom.xml | 2 +- .../jiras-surefire-1024-it/pom.xml | 2 +- .../jiras-surefire-1024-testjar/pom.xml | 2 +- .../src/test/resources/surefire-1024/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-1053-system-properties/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-1095-npe-in-runlistener/pom.xml | 2 +- .../surefire-1098-balanced-runorder/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../resources/surefire-1144-xml-runtime/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-1158-remove-info-lines/pom.xml | 2 +- .../src/test/resources/surefire-1185/pom.xml | 2 +- .../src/test/resources/surefire-1211/pom.xml | 2 +- .../surefire-1260-new-tests-pattern/pom.xml | 61 +++++- .../src/test/resources/surefire-1265/pom.xml | 2 +- .../surefire-1278-group-name-ending/pom.xml | 2 +- .../surefire-141-pluggableproviders/pom.xml | 2 +- .../surefire-146-forkPerTestNoSetup/pom.xml | 2 +- .../surefire-224-wellFormedXmlFailures/pom.xml | 2 +- .../surefire-257-rerunningTests/module1/pom.xml | 2 +- .../surefire-257-rerunningTests/module2/pom.xml | 2 +- .../surefire-257-rerunningTests/pom.xml | 2 +- .../surefire-260-testWithIdenticalNames/pom.xml | 2 +- .../surefire-34-securityManager-success/pom.xml | 2 +- .../surefire-34-securityManager/pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-500-puzzling-error/pom.xml | 2 +- .../surefire-510-testClassPath/pom.xml | 2 +- .../module1/pom.xml | 2 +- .../pom.xml | 2 +- .../testjar/pom.xml | 2 +- .../module1/pom.xml | 2 +- .../module2/pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-613-testCount-in-parallel/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-649-systemProperties/pom.xml | 2 +- .../pom.xml | 2 +- .../test/resources/surefire-673-mockito/pom.xml | 2 +- .../surefire-674-buildFailingWhenErrors/pom.xml | 2 +- .../surefire-685-commaseparatedIncludes/pom.xml | 2 +- .../resources/surefire-697-niceSummary/pom.xml | 2 +- .../surefire-733-allOverridesCaptured/pom.xml | 2 +- .../surefire-740-comma-truncated/pom.xml | 2 +- .../resources/surefire-772-both-reports/pom.xml | 2 +- .../surefire-772-no-failsafe-reports/pom.xml | 2 +- .../resources/surefire-772-no-reports/pom.xml | 2 +- .../surefire-772-no-surefire-reports/pom.xml | 2 +- .../surefire-772-specified-reports/pom.xml | 2 +- .../surefire-806-specifiedTests-multi/pom.xml | 2 +- .../surefire-806-specifiedTests-single/pom.xml | 2 +- .../surefire-809-groupExpr-junit48/pom.xml | 2 +- .../surefire-809-groupExpr-testng/pom.xml | 2 +- .../surefire-812-log4j-classloader/pom.xml | 2 +- .../resources/surefire-817-system-exit/pom.xml | 2 +- .../surefire-828-emptyGroupExpr-junit48/pom.xml | 2 +- .../surefire-828-emptyGroupExpr-testng/pom.xml | 2 +- .../surefire-832-provider-selection/pom.xml | 2 +- .../surefire-855-failsafe-use-bundle/pom.xml | 2 +- .../surefire-855-failsafe-use-jar/pom.xml | 2 +- .../surefire-855-failsafe-use-war/pom.xml | 2 +- .../surefire-930-failsafe-runtests/pom.xml | 2 +- .../pom.xml | 2 +- .../boom/pom.xml | 2 +- .../class-rule/pom.xml | 2 +- .../surefire-972-bizarre-noclassdef/pom.xml | 2 +- .../surefire-975-wrong-encoding/pom.xml | 2 +- .../pom.xml | 2 +- .../surefire-995-categoryInheritance/pom.xml | 2 +- .../test/resources/system-properties/pom.xml | 2 +- .../resources/testng-afterSuiteFailure/pom.xml | 2 +- .../test/resources/testng-beforeMethod/pom.xml | 2 +- .../testng-beforeMethodFailure/pom.xml | 2 +- .../test/resources/testng-execute-error/pom.xml | 2 +- .../testng-group-thread-parallel/pom.xml | 2 +- .../src/test/resources/testng-groups/pom.xml | 2 +- .../src/test/resources/testng-jdk14/pom.xml | 2 +- .../resources/testng-junit-together/pom.xml | 2 +- .../resources/testng-junit4-together/pom.xml | 2 +- .../resources/testng-listener-reporter/pom.xml | 2 +- .../testng-method-pattern-after/pom.xml | 2 +- .../testng-method-pattern-before/pom.xml | 2 +- .../resources/testng-method-pattern/pom.xml | 2 +- .../testng-multiple-method-patterns/pom.xml | 2 +- .../resources/testng-parallel-suites/pom.xml | 2 +- .../testng-parallel-with-annotations/pom.xml | 2 +- .../resources/testng-path with spaces/pom.xml | 2 +- .../src/test/resources/testng-simple/pom.xml | 2 +- .../testng-single-method-5-14-9/pom.xml | 2 +- .../test/resources/testng-single-method/pom.xml | 2 +- .../resources/testng-succes-percentage/pom.xml | 2 +- .../src/test/resources/testng-suite-xml/pom.xml | 2 +- .../resources/testng-twoTestCaseSuite/pom.xml | 2 +- .../src/test/resources/timeout-forked/pom.xml | 2 +- .../test/resources/unicode-testnames/pom.xml | 2 +- .../src/test/resources/webapp/pom.xml | 2 +- .../pom.xml | 2 +- .../resources/working-directory-missing/pom.xml | 2 +- .../resources/working-directory/child/pom.xml | 2 +- .../test/resources/working-directory/pom.xml | 2 +- .../plugin/surefire/log/api/ConsoleLogger.java | 7 +- .../common/junit4/JUnit4RunListener.java | 5 +- .../surefire/common/junit48/FilterFactory.java | 2 +- .../common/junit48/JUnit46StackTraceWriter.java | 2 +- .../junitcore/ConcurrentRunListener.java | 2 +- .../maven/surefire/junitcore/JUnitCore.java | 2 +- .../surefire/junitcore/JUnitCoreParameters.java | 5 +- .../junitcore/JUnitCoreRunListener.java | 2 +- .../maven/surefire/junitcore/TestMethod.java | 2 +- .../maven/surefire/junitcore/ThreadSafe.java | 2 +- .../maven/surefire/junitcore/pc/Balancer.java | 4 +- .../surefire/junitcore/pc/BalancerFactory.java | 3 + .../surefire/junitcore/pc/ExecutionStatus.java | 2 +- .../junitcore/pc/ParallelComputerBuilder.java | 5 +- .../junitcore/pc/ParallelComputerUtil.java | 3 +- .../maven/surefire/junitcore/pc/Scheduler.java | 54 +++-- .../junitcore/pc/SchedulingStrategies.java | 2 +- .../junitcore/pc/SchedulingStrategy.java | 32 +-- .../junitcore/pc/SingleThreadScheduler.java | 4 +- .../junitcore/pc/ThreadResourcesBalancer.java | 4 +- .../surefire/junitcore/pc/WrappedRunners.java | 2 +- .../MavenSurefireJUnit47RunnerTest.java | 16 +- .../MavenSurefireJUnit48RunnerTest.java | 16 +- .../surefire/junitcore/Surefire746Test.java | 2 +- .../junitcore/pc/SchedulingStrategiesTest.java | 6 +- .../surefire/testng/utils/MethodSelector.java | 1 - .../maven/surefire/testng/utils/Stoppable.java | 2 +- .../ConfigurationAwareTestNGReporter.java | 1 - .../maven/surefire/testng/TestNGProvider.java | 1 - .../maven/surefire/testng/TestNGReporter.java | 5 +- .../testng/conf/TestNG4751Configurator.java | 4 +- .../testng/conf/TestNG513Configurator.java | 2 +- .../testng/conf/TestNG5143Configurator.java | 2 +- .../testng/conf/TestNG52Configurator.java | 4 +- .../testng/conf/TestNGMapConfigurator.java | 14 +- 329 files changed, 1418 insertions(+), 956 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/pom.xml ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/pom.xml b/maven-failsafe-plugin/pom.xml index ed1d751..506b3c4 100644 --- a/maven-failsafe-plugin/pom.xml +++ b/maven-failsafe-plugin/pom.xml @@ -83,6 +83,29 @@ <build> <plugins> <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-xjc-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>generate-failsafe-summary</id> + <goals> + <goal>xsdtojava</goal> + </goals> + <configuration> + <sourceRoot>${project.build.directory}/generated-sources/jaxb</sourceRoot> + <xsdOptions> + <xsdOption> + <xsd>../maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xsd</xsd> + <bindingFile>../maven-surefire-plugin/src/site/resources/xsd/failsafe-summary.xjb</bindingFile> + <packagename>org.apache.maven.plugin.failsafe.xmlsummary</packagename> + </xsdOption> + </xsdOptions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> <configuration> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/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 1ad317f..a336e28 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 @@ -39,7 +39,7 @@ import java.util.Collections; import java.util.List; import java.util.Locale; -import static org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils.writeSummary; +import static org.apache.maven.plugin.failsafe.util.FailsafeSummaryXmlUtils.writeSummary; import static org.apache.maven.shared.utils.ReaderFactory.FILE_ENCODING; /** @@ -47,7 +47,6 @@ import static org.apache.maven.shared.utils.ReaderFactory.FILE_ENCODING; * * @author Jason van Zyl * @author Stephen Connolly - * @noinspection JavaDoc, */ @Mojo( name = "integration-test", requiresProject = true, requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST, threadSafe = true ) @@ -60,7 +59,7 @@ public class IntegrationTestMojo /** * The path representing project <em>JAR</em> file, if exists; Otherwise the directory containing generated * classes of the project being tested. This will be included after the test classes in the test classpath. - * Defaults to built artifact <em>JAR</em> file or ${project.build.outputDirectory}. + * Defaults to built artifact <em>JAR</em> file or <code>${project.build.outputDirectory}</code>. */ @Parameter private File classesDirectory; @@ -83,25 +82,28 @@ public class IntegrationTestMojo @Parameter( defaultValue = "${project.build.directory}/failsafe-reports" ) private File reportsDirectory; + @SuppressWarnings( "checkstyle:linelength" ) /** - * Specify this parameter to run individual tests by file name, overriding the <code>includes/excludes</code> - * parameters. Each pattern you specify here will be used to create an include pattern formatted like - * <code>**/${it.test}.java</code>, so you can just type "-Dit.test=MyIT" to run a single test called - * "foo/MyIT.java".<br/> - * This parameter overrides the <code>includes/excludes</code> parameters, and the TestNG <code>suiteXmlFiles</code> - * parameter. - * <p/> - * Since 2.7.3 You can execute a limited number of methods in the test with adding #myMethod or #my*ethod. E.g. type - * "-Dit.test=MyIT#myMethod" <b>supported for junit 4.x and testNg</b> - * <br/> - * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):<br/> - * "-Dit.test=???IT, !Unstable*, pkg/**/Ci*leIT.java, *IT#test*One+testTwo?????, #fast*+slowTest"<br/> - * "-Dit.test=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyIT.class#one.*|two.*], %regex[#fast.*|slow.*]"<br/> - * <br/> - * The Parameterized JUnit runner <em>describes</em> test methods using an index in brackets, so the non-regex - * method pattern would become: <em>#testMethod[*]</em>. If using <em>@Parameters(name="{index}: fib({0})={1}")</em> - * and selecting the index e.g. 5 in pattern, the non-regex method pattern would become <em>#testMethod[5:*]</em>. - * <br/> + * Specify this parameter to run individual tests by file name, overriding parameter {@code includes} and + * {@code excludes}. Each pattern you specify here will be used to create an include pattern formatted like + * <code>**{@literal /}${it.test}.java</code>, so you can just type {@code -Dit.test=MyIT} to run + * a single test file called "foo/MyIT.java". The test patterns prefixed with a <em>!</em> will be excluded. + * <br> + * This parameter overrides the parameter {@code includes} and {@code excludes}, and the TestNG parameter + * {@code suiteXmlFiles}. + * <br> + * Since 2.7.3 You can execute a limited number of methods in the test with adding <i>#myMethod</i> or + * <i>#my*ethod</i>. E.g. type {@code -Dit.test=MyIT#myMethod} <b>supported for junit 4.x and TestNg.</b> + * <br> + * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): + * <pre><code>"-Dit.test=???IT, !Unstable*, pkg{@literal /}**{@literal /}Ci*leIT.java, *IT#test*One+testTwo?????, #fast*+slowTest"</code></pre> + * or e.g. + * <br> + * <pre><code>"-Dit.test=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyIT.class#one.*|two.*], %regex[#fast.*|slow.*]"</code></pre> + * <br> + * The Parameterized JUnit runner {@code describes} test methods using an index in brackets, so the non-regex + * method pattern would become: {@code #testMethod[*]}. If using <code>@Parameters(name="{index}: fib({0})={1}")</code> + * and selecting the index e.g. 5 in pattern, the non-regex method pattern would become {@code #testMethod[5:*]}. */ @Parameter( property = "it.test" ) private String test; @@ -143,7 +145,7 @@ public class IntegrationTestMojo /** * Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach * on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure - * arbitrary debuggability options (without overwriting the other options specified through the <code>argLine</code> + * arbitrary debugging ability options (without overwriting the other options specified through the {@code argLine} * parameter). * * @since 2.4 @@ -163,7 +165,7 @@ public class IntegrationTestMojo /** * Forked process is normally terminated without any significant delay after given tests have completed. * If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated - * by <em>System.exit()</em>. Use this parameter in order to determine the timeout of terminating the process. + * by {@code System.exit()}. Use this parameter in order to determine the timeout of terminating the process. * <a href="http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html">see the documentation: * http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html</a> * @@ -174,11 +176,11 @@ public class IntegrationTestMojo /** * Stop executing queued parallel JUnit tests after a certain number of seconds. - * <br/> - * Example values: "3.5", "4"<br/> - * <br/> + * <br> + * Example values: "3.5", "4"<br> + * <br> * If set to 0, wait forever, never timing out. - * Makes sense with specified <code>parallel</code> different from "none". + * Makes sense with specified {@code parallel} different from "none". * * @since 2.16 */ @@ -187,40 +189,45 @@ public class IntegrationTestMojo /** * Stop executing queued parallel JUnit tests - * and <em>interrupt</em> currently running tests after a certain number of seconds. - * <br/> - * Example values: "3.5", "4"<br/> - * <br/> + * and <i>interrupt</i> currently running tests after a certain number of seconds. + * <br> + * Example values: "3.5", "4"<br> + * <br> * If set to 0, wait forever, never timing out. - * Makes sense with specified <code>parallel</code> different from "none". + * Makes sense with specified {@code parallel} different from "none". * * @since 2.16 */ @Parameter( property = "failsafe.parallel.forcedTimeout" ) private double parallelTestsTimeoutForcedInSeconds; + @SuppressWarnings( "checkstyle:linelength" ) /** - * 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/> - * <includes><br/> - * <include>**/IT*.java</include><br/> - * <include>**/*IT.java</include><br/> - * <include>**/*ITCase.java</include><br/> - * </includes><br/> - * </code> - * <p/> + * A list of {@literal <include>} elements specifying the test filter (by pattern) of tests which should be + * included in testing. If it is not specified and the {@code test} parameter is unspecified as well, the default + * includes is + * <pre><code> + * {@literal <includes>} + * {@literal <include>}**{@literal /}IT*.java{@literal </include>} + * {@literal <include>}**{@literal /}*IT.java{@literal </include>} + * {@literal <include>}**{@literal /}*ITCase.java{@literal </include>} + * {@literal </includes>} + * </code></pre> + * <br> * Each include item may also contain a comma-separated sublist of items, which will be treated as multiple - * <include> entries.<br/> - * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):<br/> - * <include>%regex[.*[Cat|Dog].*], Basic????, !Unstable*</include><br/> - * <include>%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg/**/*Fast*.java</include><br/> - * <p/> - * This parameter is ignored if the TestNG <code>suiteXmlFiles</code> parameter is specified.<br/> - * <br/> - * <em>Notice that</em> these values are relative to the directory containing generated test classes of the project - * being tested. This directory is declared by the parameter <code>testClassesDirectory</code> which defaults - * to the POM property <code>${project.build.testOutputDirectory}</code>, typically <em>src/test/java</em> - * unless overridden. + * {@literal <include>} entries.<br> + * Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): + * <pre><code> + * {@literal <include>}%regex[.*[Cat|Dog].*], Basic????, !Unstable*{@literal </include>} + * {@literal <include>}%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg{@literal /}**{@literal /}*Fast*.java{@literal </include>} + * </code></pre> + * <br> + * This parameter is ignored if the TestNG {@code suiteXmlFiles} parameter is specified.<br> + * <br> + * <b>Notice that</b> these values are relative to the directory containing generated test classes of the project + * being tested. This directory is declared by the parameter {@code testClassesDirectory} which defaults + * to the POM property <code>${project.build.testOutputDirectory}</code>, typically + * <code>{@literal src/test/java}</code> unless overridden. */ @Parameter private List<String> includes; @@ -241,7 +248,7 @@ public class IntegrationTestMojo * <a href="http://maven.apache.org/plugins/maven-failsafe-plugin/examples/class-loading.html"> * http://maven.apache.org/plugins/maven-failsafe-plugin/examples/class-loading.html</a> * for a more detailed explanation of manifest-only JARs and their benefits.) - * <br/> + * <br> * Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long. * * @since 2.4.3 @@ -265,10 +272,10 @@ public class IntegrationTestMojo private int rerunFailingTestsCount; /** - * (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that - * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like - * <code>includes/excludes</code>.<br/> - * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test + * (TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that + * {@code suiteXmlFiles} is incompatible with several other parameters of this plugin, like + * {@code includes} and {@code excludes}.<br> + * This parameter is ignored if the {@code test} parameter is specified (allowing you to run a single test * instead of an entire suite). * * @since 2.2 @@ -277,26 +284,26 @@ public class IntegrationTestMojo private File[] suiteXmlFiles; /** - * 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". - * <br/> - * <br/> + * Defines the order the tests will be run in. Supported values are {@code alphabetical}, + * {@code reversealphabetical}, {@code random}, {@code hourly} (alphabetical on even hours, reverse alphabetical + * on odd hours), {@code failedfirst}, {@code balanced} and {@code filesystem}. + * <br> + * <br> * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a * multi-module build. - * <br/> - * <br/> + * <br> + * <br> * Failed first will run tests that failed on previous run first, as well as new tests for this run. - * <br/> - * <br/> + * <br> + * <br> * 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. - * <br/> - * <br/> - * 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. + * <br> + * <br> + * Note that the statistics are stored in a file named <b>.surefire-XXXXXXXXX</b> beside <i>pom.xml</i> 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 + * configuration settings you will re-run once before new statistics data can be established. * * @since 2.7 */ @@ -304,31 +311,37 @@ public class IntegrationTestMojo private String runOrder; /** - * A file containing include patterns. Blank lines, or lines starting with # are ignored. If {@code includes} are - * also specified, these patterns are appended. Example with path, simple and regex includes:<br/> - * */it/*<br/> - * **/NotIncludedByDefault.java<br/> - * %regex[.*IT.*|.*Not.*]<br/> + * A file containing include patterns, each in a next line. Blank lines, or lines starting with # are ignored. + * If {@code includes} are also specified, these patterns are appended. Example with path, simple and regex + * includes: + * <pre><code> + * *{@literal /}it{@literal /}* + * **{@literal /}NotIncludedByDefault.java + * %regex[.*IT.*|.*Not.*] + * </code></pre> */ @Parameter( property = "failsafe.includesFile" ) private File includesFile; /** - * A file containing exclude patterns. Blank lines, or lines starting with # are ignored. If {@code excludes} are - * also specified, these patterns are appended. Example with path, simple and regex excludes:<br/> - * */it/*<br/> - * **/DontRunIT.*<br/> - * %regex[.*IT.*|.*Not.*]<br/> + * A file containing exclude patterns, each in a next line. Blank lines, or lines starting with # are ignored. + * If {@code excludes} are also specified, these patterns are appended. + * Example with path, simple and regex excludes: + * <pre><code> + * *{@literal /}it{@literal /}* + * **{@literal /}DontRunIT.* + * %regex[.*IT.*|.*Not.*] + * </code></pre> */ @Parameter( property = "failsafe.excludesFile" ) private File excludesFile; /** * Set to error/failure count in order to skip remaining tests. - * Due to race conditions in parallel/forked execution this may not be fully guaranteed.<br/> - * Enable with system property -Dfailsafe.skipAfterFailureCount=1 or any number greater than zero. - * Defaults to "0".<br/> - * See the prerequisites and limitations in documentation:<br/> + * Due to race conditions in parallel/forked execution this may not be fully guaranteed.<br> + * Enable with system property {@code -Dfailsafe.skipAfterFailureCount=1} or any number greater than zero. + * Defaults to "0".<br> + * See the prerequisites and limitations in documentation:<br> * <a href="http://maven.apache.org/plugins/maven-failsafe-plugin/examples/skip-after-failure.html"> * http://maven.apache.org/plugins/maven-failsafe-plugin/examples/skip-after-failure.html</a> * @@ -338,12 +351,18 @@ public class IntegrationTestMojo private int skipAfterFailureCount; /** - * After the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is received by every - * forked JVM. By default (shutdown=testset) forked JVM would not continue with new test which means that - * the current test may still continue to run.<br/> - * The parameter can be configured with other two values "exit" and "kill".<br/> - * Using "exit" forked JVM executes System.exit(1) after the plugin process has received SIGTERM signal.<br/> - * Using "kill" the JVM executes Runtime.halt(1) and kills itself. + * After the plugin process is shutdown by sending <i>SIGTERM signal (CTRL+C)</i>, <i>SHUTDOWN command</i> is + * received by every forked JVM. + * <br> + * By default ({@code shutdown=testset}) forked JVM would not continue with new test which means that + * the current test may still continue to run. + * <br> + * The parameter can be configured with other two values {@code exit} and {@code kill}. + * <br> + * Using {@code exit} forked JVM executes {@code System.exit(1)} after the plugin process has received + * <i>SIGTERM signal</i>. + * <br> + * Using {@code kill} the JVM executes {@code Runtime.halt(1)} and kills itself. * * @since 2.19 */ http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/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 0ad7f80..04cc72c 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 @@ -23,7 +23,7 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils; +import org.apache.maven.plugin.failsafe.util.FailsafeSummaryXmlUtils; import org.apache.maven.plugin.surefire.SurefireHelper; import org.apache.maven.plugin.surefire.SurefireReportParameters; import org.apache.maven.plugin.surefire.log.PluginConsoleLogger; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java new file mode 100644 index 0000000..1f3f64d --- /dev/null +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/FailsafeSummaryXmlUtils.java @@ -0,0 +1,94 @@ +package org.apache.maven.plugin.failsafe.util; + +/* + * 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.ErrorType; +import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummary; +import org.apache.maven.surefire.suite.RunResult; + +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; + +/** + * @author <a href="mailto:tibordig...@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 fromRunResultToFile( 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() ); + Integer errorCode = fromRunResult.getFailsafeCode(); + summary.setResult( errorCode == null ? null : ErrorType.fromValue( String.valueOf( errorCode ) ) ); + + JAXB.marshal( summary, encoding, toFailsafeSummaryXml ); + } + + 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 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/JAXB.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/JAXB.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/JAXB.java new file mode 100644 index 0000000..ac51292 --- /dev/null +++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/util/JAXB.java @@ -0,0 +1,104 @@ +package org.apache.maven.plugin.failsafe.util; + +/* + * 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 javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.PropertyException; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.helpers.DefaultValidationEventHandler; +import javax.xml.namespace.QName; +import javax.xml.transform.stream.StreamSource; +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.Collections; +import java.util.Map; +import java.util.Map.Entry; + +import static javax.xml.bind.JAXBContext.newInstance; +import static javax.xml.bind.Marshaller.JAXB_ENCODING; +import static javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT; +import static javax.xml.bind.Marshaller.JAXB_FRAGMENT; + +/** + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @since 2.20 + */ +public final class JAXB +{ + private JAXB() + { + throw new IllegalStateException( "Not instantiated constructor." ); + } + + public static <T> T unmarshal( File source, Class<T> rootXmlNode ) throws JAXBException + { + return unmarshal( source, rootXmlNode, Collections.<String, Object>emptyMap() ); + } + + public static <T> T unmarshal( File source, Class<T> rootXmlNode, Map<String, ?> props ) + throws JAXBException + { + Class<?>[] classesToBeBound = { rootXmlNode }; + JAXBContext ctx = newInstance( classesToBeBound ); + Unmarshaller unmarshaller = ctx.createUnmarshaller(); + properties( props, unmarshaller ); + unmarshaller.setEventHandler( new DefaultValidationEventHandler() ); + JAXBElement<T> element = unmarshaller.unmarshal( new StreamSource( source ), rootXmlNode ); + return element.getValue(); + } + + @SuppressWarnings( "unchecked" ) + public static <T> void marshal( T bean, Charset encoding, File destination ) throws JAXBException, IOException + { + Class<T> type = (Class<T>) bean.getClass(); + JAXBElement<T> rootElement = buildJaxbElement( bean, type ); + Class<?>[] classesToBeBound = { type }; + JAXBContext context = newInstance( classesToBeBound ); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty( JAXB_ENCODING, encoding.name() ); + marshaller.setProperty( JAXB_FORMATTED_OUTPUT, true ); + marshaller.setProperty( JAXB_FRAGMENT, true ); + marshaller.marshal( rootElement, destination ); + } + + private static <T> JAXBElement<T> buildJaxbElement( T bean, Class<T> type ) + { + XmlRootElement xmlRootElement = type.getAnnotation( XmlRootElement.class ); + if ( xmlRootElement == null ) + { + return null; + } + QName root = new QName( "", xmlRootElement.name() ); + return new JAXBElement<T>( root, type, bean ); + } + + private static void properties( Map<String, ?> props, Unmarshaller unmarshaller ) throws PropertyException + { + for ( Entry<String, ?> e : props.entrySet() ) + { + unmarshaller.setProperty( e.getKey(), e.getValue() ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ErrorType.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ErrorType.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ErrorType.java deleted file mode 100644 index f301527..0000000 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ErrorType.java +++ /dev/null @@ -1 +0,0 @@ -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 javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for errorType. * <p/> * <p>The following schema fragment specifies the expected content contained within this class. * <p/> * <pre> * <simpleType name="errorType"> * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> * <enumeration value="255"/> * <enumeration value="254"/> * </restriction> * </simpleType> * </pre> */ @XmlType( name = "errorType" ) @XmlEnum( Integer.class ) public enum ErrorType { @XmlEnumValue( "255" ) FAILURE( 255 ), @XmlEnumValue( "254" ) NO_TESTS( 254 ); private final int value; ErrorType( int v ) { value = v; } public static ErrorType fromValue( Integer v ) { if ( v == null ) { return null; } for ( ErrorType c : ErrorType.values() ) { if ( c.value == v ) { return c; } } throw new IllegalArgumentException( "" + v ); } public int value() { return value; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummary.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummary.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummary.java deleted file mode 100644 index d20fd4f..0000000 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummary.java +++ /dev/null @@ -1 +0,0 @@ -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 javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.X mlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import java.io.IOException; import java.io.LineNumberReader; import java.io.StringReader; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import static java.util.Collections.emptyList; import static org.apache.maven.plugin.failsafe.xmlsummary.ErrorType.FAILURE; import static org.apache.maven.plugin.failsafe.xmlsummary.ErrorType.NO_TESTS; /** * <p>Java class for anonymous complex type. * <p/> * <p>The following schema fragment specifies the expected content contained within this class. * <p/> * <pre> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}int"/> * <element name="errors" type="{http://www.w3.org/2001/XMLSc hema}int"/> * <element name="failures" type="{http://www.w3.org/2001/XMLSchema}int"/> * <element name="skipped" type="{http://www.w3.org/2001/XMLSchema}int"/> * <element name="failureMessage" type="{http://www.w3.org/2001/XMLSchema}string"/> * </sequence> * <attribute name="result" type="{}errorType" /> * <attribute name="timeout" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /> * </restriction> * </complexContent> * </complexType> * </pre> */ @XmlAccessorType( XmlAccessType.FIELD ) @XmlType( name = "", propOrder = { "completed", "errors", "failures", "skipped", "failureMessage" } ) @XmlRootElement( name = "failsafe-summary" ) public class FailsafeSummary { private static fin al String ERROR_MSG_PREFIX = "org.apache.maven.surefire.booter.SurefireBooterForkException: "; private static final Pattern STACK_TRACE_ELEMENT1 = Pattern.compile( "^\\tat.*\\(.*\\.java\\:[\\d]+\\)$" ); private static final Pattern STACK_TRACE_ELEMENT2 = Pattern.compile( "^\\tat.*\\(Native Method\\)$" ); private static final Pattern STACK_TRACE_ELEMENT3 = Pattern.compile( "^Caused by\\: .*" ); private int completed; private int errors; private int failures; private int skipped; @XmlElement( required = true, nillable = true ) private String failureMessage; @XmlAttribute( name = "result" ) private ErrorType result; @XmlAttribute( name = "timeout", required = true ) private boolean timeout; /** * Gets the value of the completed property. */ public int getCompleted() { return completed; } /** * Sets the value of the completed property. */ public void setCompleted( int value ) { this.completed = value; } /** * Gets the value of the errors property. */ public int getErrors() { return errors; } /** * Sets the value of the errors property. */ public void setErrors( int value ) { this.errors = value; } /** * Gets the value of the failures property. */ public int getFailures() { return failures; } /** * Sets the value of the failures property. */ public void setFailures( int value ) { this.failures = value; } /** * Gets the value of the skipped property. */ public int getSkipped() { return skipped; } /** * Sets the value of the skipped property. */ public void setSkipped( int value ) { this.skipped = value; } /** * Gets the value of the failureMessage property. * * @return possible object is * {@link String } */ public String getFailureMessage() { return failureMessage; } /** * Sets the value of the failureMessage property. * * @param value allowed object is * {@link String } */ public void setFailureMessage( String value ) { this.failureMessage = value; } /** * Gets the value of the result property. * * @return possible object is * {@link ErrorType } */ public ErrorType getResult() { return result; } /** * Sets the value of the result property. * * @param value allowed object is * {@link ErrorType } */ public void setResult( ErrorType value ) { this.result = value; } /** * Gets the value of the timeout property. */ public boolean isTimeout() { return timeout; } /** * Sets the value of the timeout property. */ public void setTimeout( boolea n value ) { this.timeout = value; } public boolean hasNoTests() { return getResult() == NO_TESTS; } public boolean isFailure() { return getResult() == FAILURE; } public List<String> extractExceptionMessageLines() throws IOException { if ( getFailureMessage() == null ) { return emptyList(); } List<String> msg = new ArrayList<String>(); LineNumberReader reader = new LineNumberReader( new StringReader( getFailureMessage() ) ); for ( @SuppressWarnings( "checkstyle:innerassignment" ) String line; ( line = reader.readLine() ) != null; ) { if ( !STACK_TRACE_ELEMENT1.matcher( line ).matches() && !STACK_TRACE_ELEMENT2.matcher( line ).matches() && !STACK_TRACE_ELEMENT3.matcher( line ).matches() ) { line = line.trim(); msg.add( line.startsWith( ERROR_MSG_P REFIX ) ? line.substring( ERROR_MSG_PREFIX.length() ) : line ); } else { break; } } return msg; } @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null || getClass() != o.getClass() ) { return false; } FailsafeSummary summary = (FailsafeSummary) o; return getCompleted() == summary.getCompleted() && getErrors() == summary.getErrors() && getFailures() == summary.getFailures() && getSkipped() == summary.getSkipped() && isTimeout() == summary.isTimeout() && equal( getFailureMessage(), summary.getFailureMessage() ) && getResult() == summary.getResult(); } @Override public int hashCode() { int result1 = getCompleted(); result1 = 31 * result1 + getErrors(); result1 = 31 * result1 + getFailures(); result1 = 31 * result1 + getSkipped(); result1 = 31 * result1 + ( getFailureMessage() != null ? getFailureMessage().hashCode() : 0 ); result1 = 31 * result1 + ( getResult() != null ? getResult().hashCode() : 0 ); result1 = 31 * result1 + ( isTimeout() ? 1 : 0 ); return result1; } private boolean equal( String s1, String s2 ) { return s1 == null ? s2 == null : s1.equals( s2 ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/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 deleted file mode 100644 index c5623c1..0000000 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/FailsafeSummaryXmlUtils.java +++ /dev/null @@ -1,104 +0,0 @@ -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.FileOutputStream; -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:tibordig...@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 fromRunResultToFile( 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 FileOutputStream( 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 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/JAXB.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/JAXB.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/JAXB.java deleted file mode 100644 index 723200c..0000000 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/JAXB.java +++ /dev/null @@ -1 +0,0 @@ -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 javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Mar shaller; import javax.xml.bind.PropertyException; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.helpers.DefaultValidationEventHandler; import javax.xml.namespace.QName; import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.nio.charset.Charset; import java.util.Collections; import java.util.Map; import java.util.Map.Entry; import static javax.xml.bind.JAXBContext.newInstance; import static javax.xml.bind.Marshaller.JAXB_ENCODING; import static javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT; import static javax.xml.bind.Marshaller.JAXB_FRAGMENT; /** * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> * @since 2.20 */ public final class JAXB { private JAXB() { throw new IllegalStateException( "Not instantiated constructor." ); } public static <T> T unmarshal( File s ource, Class<T> rootXmlNode ) throws JAXBException { return unmarshal( source, rootXmlNode, Collections.<String, Object>emptyMap() ); } public static <T> T unmarshal( File source, Class<T> rootXmlNode, Map<String, ?> props ) throws JAXBException { Class<?>[] classesToBeBound = { rootXmlNode }; JAXBContext ctx = newInstance( classesToBeBound ); Unmarshaller unmarshaller = ctx.createUnmarshaller(); properties( props, unmarshaller ); unmarshaller.setEventHandler( new DefaultValidationEventHandler() ); JAXBElement<T> element = unmarshaller.unmarshal( new StreamSource( source ), rootXmlNode ); return element.getValue(); } public static <T> String marshal( T bean, Charset encoding ) throws JAXBException, IOException { return marshal( bean, Collections.<String, Object>emptyMap(), encoding ).toString(); } @SuppressWarnings( "unchecked" ) public static <T> StringWrit er marshal( T bean, Map<String, Object> props, Charset encoding ) throws JAXBException, IOException { return marshal( bean, (Class<T>) bean.getClass(), props, encoding ); } public static <T> StringWriter marshal( T bean, Class<T> type, Map<String, Object> props, Charset encoding ) throws JAXBException, IOException { JAXBElement<T> rootElement = buildJaxbElement( bean, type ); return marshal( rootElement, type, props, encoding ); } public static <T> StringWriter marshal( JAXBElement<T> rootElement, Class<T> type, Map<String, Object> props, Charset encoding ) throws JAXBException, IOException { StringWriter destination = new StringWriter( 256 ); marshal( rootElement, type, props, destination, encoding ); destination.flush(); return destination; } public static <T> void marshal( JAXBElement<T> rootElement, Class<T > type, Map<String, Object> props, Writer destination, Charset encoding ) throws JAXBException { Class<?>[] classesToBeBound = { type }; JAXBContext context = newInstance( classesToBeBound ); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty( JAXB_ENCODING, encoding.name() ); marshaller.setProperty( JAXB_FORMATTED_OUTPUT, true ); marshaller.setProperty( JAXB_FRAGMENT, true ); properties( props, marshaller ); marshaller.marshal( rootElement, destination ); } private static <T> JAXBElement<T> buildJaxbElement( T bean, Class<T> type ) { XmlRootElement xmlRootElement = type.getAnnotation( XmlRootElement.class ); if ( xmlRootElement == null ) { return null; } QName root = new QName( "", xmlRootElement.name() ); return new JAXBElement<T>( root, type, bean ); } private static void p roperties( Map<String, ?> props, Unmarshaller unmarshaller ) throws PropertyException { for ( Entry<String, ?> e : props.entrySet() ) { unmarshaller.setProperty( e.getKey(), e.getValue() ); } } private static void properties( Map<String, ?> props, Marshaller marshaller ) throws PropertyException { for ( Entry<String, ?> e : props.entrySet() ) { marshaller.setProperty( e.getKey(), e.getValue() ); } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ObjectFactory.java ---------------------------------------------------------------------- diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ObjectFactory.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ObjectFactory.java deleted file mode 100644 index 7e1c252..0000000 --- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/xmlsummary/ObjectFactory.java +++ /dev/null @@ -1 +0,0 @@ -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 javax.xml.bind.annotation.XmlRegistry; /** * This object contains factory methods for each * Java content interface and J ava element interface * generated in the org.apache.maven.surefire.suite package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. */ @XmlRegistry public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: * org.apache.maven.surefire.suite */ public ObjectFactory() { } /** * Create an instance of {@link FailsafeSummary } */ public FailsafeSummary createFailsafeSummary() { return new FailsafeSummary(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/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 a448725..8d5d32f 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 @@ -19,13 +19,11 @@ package org.apache.maven.plugin.failsafe; * under the License. */ +import org.apache.maven.plugin.failsafe.util.JAXB; import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummary; -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.apache.maven.surefire.util.internal.StringUtils.UTF_8; @@ -62,32 +60,6 @@ public class MarshallerUnmarshallerTest + "\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 @@ -107,25 +79,29 @@ public class MarshallerUnmarshallerTest ); 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(); + JAXB.marshal( expected, UTF_8, xml ); FailsafeSummary actual = JAXB.unmarshal( xml, FailsafeSummary.class ); - assertThat( actual ) - .isEqualTo( expected ); + assertThat( actual.getFailures() ) + .isEqualTo( expected.getFailures() ); - List<String> exceptionMessages = actual.extractExceptionMessageLines(); + assertThat( actual.isTimeout() ) + .isEqualTo( expected.isTimeout() ); - assertThat( exceptionMessages ) - .hasSize( 1 ); + assertThat( actual.getCompleted() ) + .isEqualTo( expected.getCompleted() ); - assertThat( exceptionMessages.get( 0 ) ) - .isEqualTo( "There was an error in the forked processtest " - + "subsystem#no method RuntimeException Hi There!" - ); + assertThat( actual.getErrors() ) + .isEqualTo( expected.getErrors() ); + + assertThat( actual.getFailures() ) + .isEqualTo( expected.getFailures() ); + + assertThat( actual.getSkipped() ) + .isEqualTo( expected.getSkipped() ); + + assertThat( actual.getFailureMessage() ) + .isEqualTo( expected.getFailureMessage() ); } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/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 811c538..f7b62b6 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 @@ -19,7 +19,7 @@ package org.apache.maven.plugin.failsafe; * under the License. */ -import org.apache.maven.plugin.failsafe.xmlsummary.FailsafeSummaryXmlUtils; +import org.apache.maven.plugin.failsafe.util.FailsafeSummaryXmlUtils; import org.apache.maven.surefire.suite.RunResult; import org.junit.Test; http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b54e33e6/maven-surefire-common/pom.xml ---------------------------------------------------------------------- diff --git a/maven-surefire-common/pom.xml b/maven-surefire-common/pom.xml index f4bab59..4064bc2 100644 --- a/maven-surefire-common/pom.xml +++ b/maven-surefire-common/pom.xml @@ -123,7 +123,6 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> - <version>1.12</version> <executions> <execution> <id>add-source</id>