http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java deleted file mode 100644 index 5aee1a8..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelIT.java +++ /dev/null @@ -1,540 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Testing JUnitCoreWrapper with ParallelComputerBuilder. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.16 - */ -public class JUnit47ParallelIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Test - public void unknownThreadCountSuites() - { - unpack().parallelSuites().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "Use threadCount or threadCountSuites > 0 or useUnlimitedThreads=true for parallel='suites'" ); - } - - @Test - public void unknownThreadCountClasses() - { - unpack().parallelClasses().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "Use threadCount or threadCountClasses > 0 or useUnlimitedThreads=true for parallel='classes'" ); - } - - @Test - public void unknownThreadCountMethods() - { - unpack().parallelMethods().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "Use threadCount or threadCountMethods > 0 or useUnlimitedThreads=true for parallel='methods'" ); - - } - - @Test - public void unknownThreadCountBoth() - { - unpack().parallelBoth().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "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'" ); - } - - @Test - public void unknownThreadCountAll() - { - unpack().parallelAll().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "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'" ); - } - - @Test - public void unknownThreadCountSuitesAndClasses() - { - unpack().parallelSuitesAndClasses().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "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'" ); - } - - @Test - public void unknownThreadCountSuitesAndMethods() - { - unpack().parallelSuitesAndMethods().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "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'" ); - } - - @Test - public void unknownThreadCountClassesAndMethods() - { - unpack().parallelClassesAndMethods().setTestToRun( "TestClass" ).failNever().executeTest().verifyTextInLog( - "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'" ); - } - - @Test - public void serial() - { - // takes 7.2 sec - unpack().setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsSuites1() - { - // takes 3.6 sec - unpack().parallelSuites().useUnlimitedThreads().setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void unlimitedThreadsSuites2() - { - // takes 3.6 sec - unpack().parallelSuites().useUnlimitedThreads().threadCountSuites( 5 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsClasses1() - { - // takes 1.8 sec - unpack().parallelClasses().useUnlimitedThreads().setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void unlimitedThreadsClasses2() - { - // takes 1.8 sec - unpack().parallelClasses().useUnlimitedThreads().threadCountClasses( 5 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsMethods1() - { - // takes 2.4 sec - unpack().parallelMethods().useUnlimitedThreads().setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void unlimitedThreadsMethods2() - { - // takes 2.4 sec - unpack().parallelMethods().useUnlimitedThreads().threadCountMethods( 5 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsSuitesAndClasses1() - { - // takes 0.9 sec - unpack().parallelSuitesAndClasses().useUnlimitedThreads().setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsSuitesAndClasses2() - { - // takes 0.9 sec - // 1.8 sec with 4 parallel classes - unpack().parallelSuitesAndClasses().useUnlimitedThreads().threadCountSuites( 5 ).threadCountClasses( - 15 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsSuitesAndMethods1() - { - // takes 1.2 sec - unpack().parallelSuitesAndMethods().useUnlimitedThreads().setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsSuitesAndMethods2() - { - // takes 1.2 sec - unpack().parallelSuitesAndMethods().useUnlimitedThreads().threadCountSuites( 5 ).threadCountMethods( - 15 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsClassesAndMethods1() - { - // takes 0.6 sec - unpack().parallelClassesAndMethods().useUnlimitedThreads().setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsClassesAndMethods2() - { - // takes 0.6 sec - unpack().parallelClassesAndMethods().useUnlimitedThreads().threadCountClasses( 5 ).threadCountMethods( - 15 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsAll1() - { - // takes 0.3 sec - unpack().parallelAll().useUnlimitedThreads().setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void unlimitedThreadsAll2() - { - // takes 0.3 sec - unpack().parallelAll().useUnlimitedThreads().threadCountSuites( 5 ).threadCountClasses( 15 ).threadCountMethods( - 30 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountSuites() - { - // takes 3.6 sec - unpack().parallelSuites().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountClasses() - { - // takes 3.6 sec for single core - // takes 1.8 sec for double core - unpack().parallelClasses().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountMethods() - { - // takes 2.4 sec - unpack().parallelMethods().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountClassesAndMethodsOneCore() - { - // takes 4.8 sec - unpack().disablePerCoreThreadCount().disableParallelOptimization().parallelClassesAndMethods().threadCount( - 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountClassesAndMethodsOneCoreOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().disablePerCoreThreadCount().parallelClassesAndMethods().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountClassesAndMethods() - { - // takes 2.4 sec for double core CPU - unpack().disableParallelOptimization().parallelClassesAndMethods().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountClassesAndMethodsOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelClassesAndMethods().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountSuitesAndMethods() - { - // usually 24 times 0.3 sec = 7.2 sec with one core CPU - // takes 1.8 sec for double core CPU - unpack().disableParallelOptimization().parallelSuitesAndMethods().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountSuitesAndMethodsOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelSuitesAndMethods().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void threadCountSuitesAndClasses() - { - unpack().disableParallelOptimization().parallelSuitesAndClasses().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountSuitesAndClassesOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelSuitesAndClasses().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void threadCountAll() - { - unpack().disableParallelOptimization().parallelAll().threadCount( 3 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void threadCountAllOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelAll().threadCount( 3 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void everyThreadCountSuitesAndClasses() - { - // takes 1.8 sec for double core CPU - unpack().parallelSuitesAndClasses().threadCount( 3 ).threadCountSuites( 34 ).threadCountClasses( - 66 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void everyThreadCountSuitesAndMethods() - { - // takes 1.8 sec for double core CPU - unpack().parallelSuitesAndMethods().threadCount( 3 ).threadCountSuites( 34 ).threadCountMethods( - 66 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void everyThreadCountClassesAndMethods() - { - // takes 1.8 sec for double core CPU - unpack().parallelClassesAndMethods().threadCount( 3 ).threadCountClasses( 34 ).threadCountMethods( - 66 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void everyThreadCountAll() - { - // takes 2.4 sec for double core CPU - unpack().parallelAll().threadCount( 3 ).threadCountSuites( 17 ).threadCountClasses( 34 ).threadCountMethods( - 49 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountSuitesAndClasses() - { - // 4 * cpu to 5 * cpu threads to run test classes - // takes cca 1.8 sec - unpack().disableParallelOptimization().parallelSuitesAndClasses().disablePerCoreThreadCount().threadCount( - 6 ).threadCountSuites( 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountSuitesAndClassesOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelSuitesAndClasses().disablePerCoreThreadCount().threadCount( 6 ).threadCountSuites( - 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountSuitesAndMethods() - { - // 4 * cpu to 5 * cpu threads to run test methods - // takes cca 1.8 sec - unpack().disableParallelOptimization().parallelSuitesAndMethods().disablePerCoreThreadCount().threadCount( - 6 ).threadCountSuites( 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountSuitesAndMethodsOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelSuitesAndMethods().disablePerCoreThreadCount().threadCount( 6 ).threadCountSuites( - 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountClassesAndMethods() - { - // 4 * cpu to 5 * cpu threads to run test methods - // takes cca 1.8 sec - unpack().disableParallelOptimization().parallelClassesAndMethods().disablePerCoreThreadCount().threadCount( - 6 ).threadCountClasses( 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountClassesAndMethodsOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelClassesAndMethods().disablePerCoreThreadCount().threadCount( 6 ).threadCountClasses( - 2 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountAll() - { - // 8 * cpu to 13 * cpu threads to run test methods - // takes 0.9 sec - unpack().disableParallelOptimization().parallelAll().disablePerCoreThreadCount().threadCount( - 14 ).threadCountSuites( 2 ).threadCountClasses( 4 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void reusableThreadCountAllOptimized() - { - // the number of reused threads in leafs depends on the number of runners and CPU - unpack().parallelAll().disablePerCoreThreadCount().threadCount( 14 ).threadCountSuites( 2 ).threadCountClasses( - 4 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void suites() - { - // takes 3.6 sec - unpack().parallelSuites().threadCountSuites( 5 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void classes() - { - // takes 1.8 sec on any CPU because the suites are running in a sequence - unpack().parallelClasses().threadCountClasses( 5 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void methods() - { - // takes 2.4 sec on any CPU because every class has only three methods - // and the suites and classes are running in a sequence - unpack().parallelMethods().threadCountMethods( 5 ).setTestToRun( "Suite*Test" ).executeTest().verifyErrorFree( - 24 ); - } - - @Test - public void suitesAndClasses() - { - // takes 0.9 sec - unpack().parallelSuitesAndClasses().threadCountSuites( 5 ).threadCountClasses( 15 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void suitesAndMethods() - { - // takes 1.2 sec on any CPU - unpack().parallelSuitesAndMethods().threadCountSuites( 5 ).threadCountMethods( 15 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void classesAndMethods() - { - // takes 0.6 sec on any CPU - unpack().parallelClassesAndMethods().threadCountClasses( 5 ).threadCountMethods( 15 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void all() - { - // takes 0.3 sec on any CPU - unpack().parallelAll().threadCountSuites( 5 ).threadCountClasses( 15 ).threadCountMethods( 30 ).setTestToRun( - "Suite*Test" ).executeTest().verifyErrorFree( 24 ); - } - - @Test - public void shutdown() - { - // executes for 2.5 sec until timeout has elapsed - unpack().parallelMethods().threadCountMethods( 2 ).parallelTestsTimeoutInSeconds( 2.5d ).setTestToRun( - "TestClass" ).failNever().executeTest().verifyTextInLog( - "The test run has finished abruptly after timeout of 2.5 seconds." ); - } - - @Test - public void forcedShutdown() - { - // executes for 2.5 sec until timeout has elapsed - unpack().parallelMethods().threadCountMethods( 2 ).parallelTestsTimeoutForcedInSeconds( 2.5d ).setTestToRun( - "TestClass" ).failNever().executeTest().verifyTextInLog( - "The test run has finished abruptly after timeout of 2.5 seconds." ); - } - - @Test - public void timeoutAndForcedShutdown() - { - // executes for one sec until timeout has elapsed - unpack().parallelMethods().threadCountMethods( 2 ).parallelTestsTimeoutInSeconds( - 1 ).parallelTestsTimeoutForcedInSeconds( 2.5d ).setTestToRun( - "TestClass" ).failNever().executeTest().verifyTextInLog( - "The test run has finished abruptly after timeout of 1.0 seconds." ); - } - - @Test - public void forcedShutdownVerifyingLogs() - { - // executes for 2.5 sec until timeout has elapsed - unpack().parallelMethods().threadCountMethods( 3 ).disablePerCoreThreadCount() - .parallelTestsTimeoutForcedInSeconds( 1.05d ).setTestToRun( "Waiting*Test" ).failNever().executeTest() - .verifyTextInLog( "The test run has finished abruptly after timeout of 1.05 seconds." ) - .verifyTextInLog( "These tests were executed in prior to the shutdown operation:" ) - .verifyTextInLog( "These tests are incomplete:" ); - } - - private SurefireLauncher unpack() - { - return unpack( "junit47-parallel" ) - .showErrorStackTraces(); - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelNotThreadSafeIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelNotThreadSafeIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelNotThreadSafeIT.java deleted file mode 100644 index bf393ca..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ParallelNotThreadSafeIT.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Testing {@code @net.jcip.annotations.NotThreadSafe} with ParallelComputerBuilder. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.19 - */ -public class JUnit47ParallelNotThreadSafeIT - extends SurefireJUnit4IntegrationTestCase -{ - - private SurefireLauncher unpack() - { - return unpack( "junit47-parallel-nts" ); - } - - @Test - public void test() - { - unpack() - .parallelAll() - .useUnlimitedThreads() - .executeTest() - .verifyErrorFree( 2 ) - .verifyTextInLog( "xxx-maven-surefire-plugin@NotThreadSafe" ) - .verifyTextInLog( "expected-thread" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java deleted file mode 100644 index aa38dac..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RedirectOutputIT.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.commons.lang.StringUtils; -import org.apache.maven.surefire.its.fixture.OutputValidator; -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -import java.io.IOException; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; - -public class JUnit47RedirectOutputIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testPrintSummaryTrueWithRedirect() - throws Exception - { - final OutputValidator clean = unpack().redirectToFile( true ).addGoal( "clean" ).executeTest(); - checkReports( clean ); - } - - @Test - public void testClassesParallel() - throws Exception - { - final OutputValidator clean = - unpack().redirectToFile( true ).parallelClasses().addGoal( "clean" ).executeTest(); - checkReports( clean ); - } - - private void checkReports( OutputValidator validator ) - throws IOException - { - String report = StringUtils.trimToNull( - validator.getSurefireReportsFile( "junit47ConsoleOutput.Test1-output.txt" ).readFileToString() ); - assertNotNull( report ); - String report2 = StringUtils.trimToNull( - validator.getSurefireReportsFile( "junit47ConsoleOutput.Test2-output.txt" ).readFileToString() ); - assertNotNull( report2 ); - assertFalse( validator.getSurefireReportsFile( "junit47ConsoleOutput.Test3-output.txt" ).exists() ); - } - - - private SurefireLauncher unpack() - { - return unpack( "/junit47-redirect-output" ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java deleted file mode 100644 index 9fe1775..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47RerunFailingTestWithCucumberIT.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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 static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion; - -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests using the JUnit 47 provider to rerun failing tests with the cucumber runner. The main - * problem that the junit4 provider has with the cucumber runner is that the junit Description - * instance created by the runner has a null test class attribute. This requires that tests are - * rerun based on their description. - * - * @author mpkorstanje - */ -public class JUnit47RerunFailingTestWithCucumberIT - extends SurefireJUnit4IntegrationTestCase { - - @Before - public void assumeJdk17() { - assumeJavaVersion(1.7d); - } - - - private SurefireLauncher unpack() { - return unpack("junit47-rerun-failing-tests-with-cucumber") - .setJUnitVersion("4.12"); - } - - @Test - public void testRerunFailingErrorTestsFalse() { - unpack() - .maven() - .addGoal("-Dsurefire.rerunFailingTestsCount=" + 0) - .withFailure() - .executeTest() - .assertTestSuiteResults(1, 0, 1, 0, 0); - } - - @Test - public void testRerunFailingErrorTestsWithOneRetry() { - unpack() - .maven() - .addGoal("-Dsurefire.rerunFailingTestsCount=" + 1) - .withFailure() - .executeTest() - .assertTestSuiteResults(1, 0, 1, 0, 0); - } - - @Test - public void testRerunFailingErrorTestsTwoRetry() { - unpack() - .maven() - .addGoal("-Dsurefire.rerunFailingTestsCount=" + 2) - .executeTest() - .assertTestSuiteResults(1, 0, 0, 0, 2); - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java deleted file mode 100644 index e50e6d7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47StaticInnerClassTestsIT.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.junit.Test; - -public class JUnit47StaticInnerClassTestsIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Test - public void testStaticInnerClassTests() - { - executeErrorFreeTest( "junit47-static-inner-class-tests", 3 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java deleted file mode 100644 index 38c2eae..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47WithCucumberIT.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.junit.Before; -import org.junit.Test; - -import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion; - -/** - * Tests the JUnit 47 provider with the cucumber runner. At the moment, they don't play along that perfectly (minor - * glitches in the reports with parallel=classes), but at least all tests are executed, the execution times are counted - * correctly and failing tests are reported. The main problem that the junit47 provider has with the cucumber runner is - * that the junit Description instance created by the runner has a null test class attribute. - * - * @author agudian - */ -public class JUnit47WithCucumberIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Before - public void assumeJdk16() - { - assumeJavaVersion( 1.6d ); - } - - @Test - public void testWithoutParallel() - { - // 8 tests in total is what's probably correct - doTest( "none", 8 ); - } - - @Test - public void testWithParallelClasses() - { - // with parallel=classes, we get 9 tests in total, - // as the dummy "scenario" test entry is reported twice: once as success, and once with the failure from the - // failing test step - doTest( "classes", 9 ); - } - - private void doTest( String parallel, int total ) - { - unpack( "junit47-cucumber" ) - .sysProp( "parallel", parallel ) - .sysProp( "threadCount", "2" ) - .executeTest() - .assertTestSuiteResults( total, 0, 2, 0 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestCategoriesIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestCategoriesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestCategoriesIT.java deleted file mode 100644 index fdb56f7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit48TestCategoriesIT.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Test project using "groups" support - * - * @author <a href="mailto:t...@apache.org">Todd Lipcon</a> - * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> - */ -public class JUnit48TestCategoriesIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testCategoriesAB() - { - runAB( unpacked() ); - } - - @Test - public void testCategoriesABForkAlways() - { - runAB( unpacked().forkAlways() ); - } - - @Test - public void testCategoriesACFullyQualifiedClassName() - { - runACFullyQualifiedClassName( unpacked() ); - } - - @Test - public void testCategoriesACFullyQualifiedClassNameForkAlways() - { - runACFullyQualifiedClassName( unpacked().forkAlways() ); - } - - @Test - public void testCategoriesACClassNameSuffix() - { - runACClassNameSuffix( unpacked() ); - } - - @Test - public void testCategoriesACClassNameSuffixForkAlways() - { - runACClassNameSuffix( unpacked().forkAlways() ); - } - - @Test - public void testCategoriesBadCategory() - { - runBadCategory( unpacked() ); - } - - @Test - public void testBadCategoryForkAlways() - { - runBadCategory( unpacked().forkAlways() ); - } - - private static void runAB( SurefireLauncher unpacked ) - { - unpacked.executeTest() - .verifyErrorFreeLog() - .assertTestSuiteResults( 3, 0, 0, 0 ) - .verifyTextInLog( "catA: 1" ) - .verifyTextInLog( "catB: 1" ) - .verifyTextInLog( "catC: 0" ) - .verifyTextInLog( "catNone: 0" ); - } - - private static void runACClassNameSuffix( SurefireLauncher unpacked ) - { - unpacked.groups( "CategoryA,CategoryC" ) - .executeTest() - .verifyErrorFreeLog() - .assertTestSuiteResults( 6, 0, 0, 0 ) - .verifyTextInLog( "catA: 1" ) - .verifyTextInLog( "catB: 0" ) - .verifyTextInLog( "catC: 1" ) - .verifyTextInLog( "catNone: 0" ) - .verifyTextInLog( "mA: 1" ) - - // This seems questionable !? The class is annotated with category C and method with B - .verifyTextInLog( "mB: 1" ) - - .verifyTextInLog( "mC: 1" ) - .verifyTextInLog( "CatNone: 1" ); - } - - private static void runACFullyQualifiedClassName( SurefireLauncher unpacked ) - { - unpacked.groups( "junit4.CategoryA,junit4.CategoryC" ) - .executeTest() - .verifyErrorFreeLog() - .assertTestSuiteResults( 6, 0, 0, 0 ) - .verifyTextInLog( "catA: 1" ) - .verifyTextInLog( "catB: 0" ) - .verifyTextInLog( "catC: 1" ) - .verifyTextInLog( "catNone: 0" ) - .verifyTextInLog( "mA: 1" ) - - // This seems questionable !? The class is annotated with category C and method with B - .verifyTextInLog( "mB: 1" ) - - .verifyTextInLog( "mC: 1" ) - .verifyTextInLog( "CatNone: 1" ); - } - - private static void runBadCategory( SurefireLauncher unpacked ) - { - unpacked.failIfNoTests( false ) - .groups( "BadCategory" ) - .executeTest() - .verifyErrorFreeLog(); - } - - private SurefireLauncher unpacked() - { - return unpack( "/junit48-categories" ); - // .debugSurefireFork(); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java deleted file mode 100644 index 19b937d..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.junit.Test; - -/** - * Test JUnit 4 tests marked with "Ignore" attribute - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class JUnit4ForkAlwaysStaticInitPollutionIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testJunit4Ignore() - { - executeErrorFreeTest( "junit4-forkAlways-staticInit", 2 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java deleted file mode 100644 index 71ec3d8..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4IgnoreIT.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Test JUnit 4 tests marked with "Ignore" attribute - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class JUnit4IgnoreIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testJunit4Ignore() - { - // Todo: Support assumption failure == ignore for junit4 - unpack().executeTest().verifyErrorFreeLog().assertTestSuiteResults( 7, 0, 0, 6 ); - } - - @Test - public void testJunit47ParallelIgnore() - { - unpack().setJUnitVersion( "4.8.1" ).parallelClasses().executeTest().verifyErrorFreeLog().assertTestSuiteResults( - 7, 0, 0, 7 ); - } - - private SurefireLauncher unpack() - { - return unpack( "/junit-ignore" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java deleted file mode 100644 index 7d6f560..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.OutputValidator; -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * JUnit4 RunListener Integration Test. - * - * @author <a href="mailto:qingzhou...@google.com">Qingzhou Luo</a> - */ -public class JUnit4RerunFailingTestsIT - extends SurefireJUnit4IntegrationTestCase -{ - private SurefireLauncher unpack() - { - return unpack( "/junit4-rerun-failing-tests" ); - } - - @Test - public void testRerunFailingErrorTestsWithOneRetry() - throws Exception - { - OutputValidator outputValidator = - unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, - 0 ); - verifyFailuresOneRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( - "-DforkCount=2" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - verifyFailuresOneRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal( - "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - verifyFailuresOneRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal( - "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - verifyFailuresOneRetryAllClasses( outputValidator ); - } - - @Test - public void testRerunFailingErrorTestsTwoRetry() - throws Exception - { - // Four flakes, both tests have been re-run twice - OutputValidator outputValidator = - unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=2" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 ); - - verifyFailuresTwoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-DforkCount=3" ).executeTest() - .assertTestSuiteResults( 5, 0, 0, 0, 4 ); - - verifyFailuresTwoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=methods" ).addGoal( - "-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 ); - - verifyFailuresTwoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=classes" ).addGoal( - "-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 ); - - verifyFailuresTwoRetryAllClasses( outputValidator ); - } - - @Test - public void testRerunFailingErrorTestsFalse() - throws Exception - { - OutputValidator outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( - "4.12" ).maven().withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - - verifyFailuresNoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-DforkCount=3" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - - verifyFailuresNoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dparallel=methods" ).addGoal( - "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - - verifyFailuresNoRetryAllClasses( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dparallel=classes" ).addGoal( - "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 ); - - verifyFailuresNoRetryAllClasses( outputValidator ); - } - - @Test - public void testRerunOneTestClass() - throws Exception - { - OutputValidator outputValidator = - unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( - "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 ); - - verifyFailuresOneRetryOneClass( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal( - "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 ); - - verifyFailuresOneRetryOneClass( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal( - "-DuseUnlimitedThreads=true" ).addGoal( - "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 ); - - verifyFailuresOneRetryOneClass( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal( - "-DuseUnlimitedThreads=true" ).addGoal( - "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 ); - - verifyFailuresOneRetryOneClass( outputValidator ); - } - - @Test - public void testRerunOneTestMethod() - throws Exception - { - OutputValidator outputValidator = - unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( - "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, - 0, 0 ); - - verifyFailuresOneRetryOneMethod( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal( - "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0, - 0 ); - - verifyFailuresOneRetryOneMethod( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal( - "-DuseUnlimitedThreads=true" ).addGoal( - "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0, - 0 ); - - verifyFailuresOneRetryOneMethod( outputValidator ); - - outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal( - "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal( - "-DuseUnlimitedThreads=true" ).addGoal( - "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0, - 0 ); - - verifyFailuresOneRetryOneMethod( outputValidator ); - } - - private void verifyFailuresOneRetryAllClasses( OutputValidator outputValidator ) - { - verifyFailuresOneRetry( outputValidator, 5, 1, 1, 0 ); - } - - private void verifyFailuresTwoRetryAllClasses( OutputValidator outputValidator ) - { - verifyFailuresTwoRetry( outputValidator, 5, 0, 0, 2 ); - } - - private void verifyFailuresNoRetryAllClasses( OutputValidator outputValidator ) - { - verifyFailuresNoRetry( outputValidator, 5, 1, 1, 0 ); - } - - private void verifyFailuresOneRetryOneClass( OutputValidator outputValidator ) - { - verifyFailuresOneRetry( outputValidator, 3, 1, 1, 0 ); - } - - private void verifyFailuresOneRetryOneMethod( OutputValidator outputValidator ) - { - verifyOnlyFailuresOneRetry( outputValidator, 1, 1, 0, 0 ); - } - - private void verifyFailuresOneRetry( OutputValidator outputValidator, int run, int failures, int errors, - int flakes ) - { - outputValidator.verifyTextInLog( "Failures:" ); - outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" ); - outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" ); - - outputValidator.verifyTextInLog( "Errors:" ); - outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testErrorTestOne" ); - outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testErrorTestOne" ); - - verifyStatistics( outputValidator, run, failures, errors, flakes ); - } - - private void verifyOnlyFailuresOneRetry( OutputValidator outputValidator, int run, int failures, int errors, - int flakes ) - { - outputValidator.verifyTextInLog( "Failures:" ); - outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" ); - outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" ); - - verifyStatistics( outputValidator, run, failures, errors, flakes ); - } - - private void verifyFailuresTwoRetry( OutputValidator outputValidator, int run, int failures, int errors, - int flakes ) - { - outputValidator.verifyTextInLog( "Flakes:" ); - outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" ); - outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" ); - outputValidator.verifyTextInLog( "Run 3: PASS" ); - - outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testErrorTestOne" ); - outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testErrorTestOne" ); - - verifyStatistics( outputValidator, run, failures, errors, flakes ); - } - - private void verifyFailuresNoRetry( OutputValidator outputValidator, int run, int failures, int errors, int flakes ) - { - outputValidator.verifyTextInLog( "Failures:" ); - outputValidator.verifyTextInLog( "testFailingTestOne(junit4.FlakyFirstTimeTest)" ); - outputValidator.verifyTextInLog( "ERROR" ); - outputValidator.verifyTextInLog( "testErrorTestOne(junit4.FlakyFirstTimeTest)" ); - - verifyStatistics( outputValidator, run, failures, errors, flakes ); - } - - private void verifyStatistics( OutputValidator outputValidator, int run, int failures, int errors, int flakes ) - { - if ( flakes > 0 ) - { - outputValidator.verifyTextInLog( - "Tests run: " + run + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: 0, Flakes: " - + flakes ); - } - else - { - outputValidator.verifyTextInLog( - "Tests run: " + run + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: 0" ); - } - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java deleted file mode 100644 index 433863e..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.OutputValidator; -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * JUnit4 RunListener Integration Test. - * - * @author <a href="mailto:matthew.gilli...@gmail.com">Matthew Gilliard</a> - */ -public class JUnit4RunListenerIT - extends SurefireJUnit4IntegrationTestCase -{ - private SurefireLauncher unpack() - { - return unpack( "/junit4-runlistener" ); - } - - @Test - public void testJUnit4RunListener() - throws Exception - { - final OutputValidator outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( - "4.4" ).executeTest().verifyErrorFreeLog(); - assertResults( outputValidator ); - outputValidator.verifyTextInLog( "testRunStarted null" ); - outputValidator.verifyTextInLog( "testFinished simpleTest" ); - outputValidator.verifyTextInLog( "testRunFinished org.junit.runner.Result" ); - } - - @Test - public void testRunlistenerJunitCoreProvider() - throws Exception - { - final OutputValidator outputValidator = - unpack().addGoal( "-Dprovider=surefire-junit47" ).setJUnitVersion( "4.8.1" ).addGoal( - "-DjunitVersion=4.8.1" ).executeTest().verifyErrorFreeLog(); // Todo: Fix junitVesion - assertResults( outputValidator ); - outputValidator.verifyTextInLog( "testRunStarted null" ); - outputValidator.verifyTextInLog( "testFinished simpleTest" ); - outputValidator.verifyTextInLog( "testRunFinished org.junit.runner.Result" ); - } - - private void assertResults( OutputValidator outputValidator ) - { - outputValidator.assertTestSuiteResults( 1, 0, 0, 0 ); - outputValidator.getTargetFile( "runlistener-output-1.txt" ).assertFileExists(); - outputValidator.getTargetFile( "runlistener-output-2.txt" ).assertFileExists(); - } - - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java deleted file mode 100644 index 8dd8f0c..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.Arrays; -import java.util.Collection; - -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameter; - -import static org.junit.runners.Parameterized.*; - -/** - * Basic suite test using all known versions of JUnit 4.x - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -@RunWith( Parameterized.class ) -public class JUnit4VersionsIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Parameters( name = "{index}: JUnit {0}" ) - public static Collection<Object[]> junitVersions() - { - return Arrays.asList( new Object[][] { - { "4.0" }, - { "4.1" }, - { "4.2" }, - { "4.3" }, - { "4.3.1" }, - { "4.4" }, - { "4.5" }, - { "4.6" }, - { "4.7" }, - { "4.8" }, - { "4.8.1" }, - { "4.8.2" }, - { "4.9" }, - { "4.10" }, - { "4.11" }, - { "4.12" } - } ); - } - - @Parameter - public String version; - - private SurefireLauncher unpack() - { - return unpack( "/junit4", version ); - } - - @Test - public void testJunit() - throws Exception - { - runJUnitTest( version ); - } - - public void runJUnitTest( String version ) - throws Exception - { - unpack().setJUnitVersion( version ).executeTest().verifyErrorFree( 1 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java deleted file mode 100644 index 0757a17..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Test project using JUnit4.4 -dep. junit-dep includes only junit.* classes, and depends explicitly on hamcrest-core - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class JUnitDepIT - extends SurefireJUnit4IntegrationTestCase -{ - public SurefireLauncher unpack() - { - return unpack( "/junit44-dep" ); - } - - @Test - public void testJUnit44Dep() - throws Exception - { - unpack().debugLogging().sysProp( "junit-dep.version", "4.4" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog( - "surefire-junit4" ); // Ahem. Will match on the 4.7 provider too - } - - @Test - public void testJUnit44DepWithSneaky381() - throws Exception - { - unpack().debugLogging().sysProp( "junit-dep.version", "4.4" ).activateProfile( - "provided381" ).executeTest().verifyErrorFree( 1 ); - } - - @Test - public void testJUnit47Dep() - throws Exception - { - unpack().debugLogging().sysProp( "junit-dep.version", "4.7" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog( - "surefire-junit47" ); - } - - @Test - public void testJUnit48Dep() - throws Exception - { - unpack().debugLogging().sysProp( "junit-dep.version", "4.8" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog( - "surefire-junit47" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java deleted file mode 100644 index 165d745..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.OutputValidator; -import org.junit.Test; - -import java.io.File; - -import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME; -import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME_KEY; -import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.is; - -/** - * Running Surefire on the top of JDK 9 and should be able to load - * classes of multiple different Jigsaw modules without error. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.20.1 - */ -public class Java9FullApiIT - extends AbstractJigsawIT -{ - - @Test - public void shouldLoadMultipleJavaModules_JavaHome() throws Exception - { - OutputValidator validator = assumeJigsaw() - .setForkJvm() - .debugLogging() - .execute( "verify" ) - .verifyErrorFree( 1 ); - - validator.verifyTextInLog( "loaded class java.sql.SQLException" ) - .verifyTextInLog( "loaded class javax.xml.ws.Holder" ) - .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" ) - .verifyTextInLog( "loaded class javax.transaction.TransactionManager" ) - .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" ) - .assertThatLogLine( anyOf( is( "java.specification.version=9" ), - is( "java.specification.version=10" ) ), - greaterThanOrEqualTo( 1 ) ); - } - - @Test - public void shouldLoadMultipleJavaModules_JvmParameter() throws Exception - { - OutputValidator validator = assumeJava9Property() - .setForkJvm() - .debugLogging() - .sysProp( EXT_JDK_HOME_KEY, new File( EXT_JDK_HOME ).getCanonicalPath() ) - .execute( "verify" ) - .verifyErrorFree( 1 ); - - validator.verifyTextInLog( "loaded class java.sql.SQLException" ) - .verifyTextInLog( "loaded class javax.xml.ws.Holder" ) - .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" ) - .verifyTextInLog( "loaded class javax.transaction.TransactionManager" ) - .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" ) - .assertThatLogLine( anyOf( is( "java.specification.version=9" ), - is( "java.specification.version=10" ) ), - greaterThanOrEqualTo( 1 ) ); - } - - @Test - public void shouldLoadMultipleJavaModules_ToolchainsXML() throws Exception - { - OutputValidator validator = assumeJava9Property() - .setForkJvm() - .activateProfile( "use-toolchains" ) - .addGoal( "--toolchains" ) - .addGoal( System.getProperty( "maven.toolchains.file" ) ) - .execute( "verify" ) - .verifyErrorFree( 1 ); - - validator.verifyTextInLog( "loaded class java.sql.SQLException" ) - .verifyTextInLog( "loaded class javax.xml.ws.Holder" ) - .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" ) - .verifyTextInLog( "loaded class javax.transaction.TransactionManager" ) - .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" ) - .assertThatLogLine( anyOf( is( "java.specification.version=9" ), - is( "java.specification.version=10" ) ), - greaterThanOrEqualTo( 1 ) ); - } - - @Override - protected String getProjectDirectoryName() - { - return "java9-full-api"; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java deleted file mode 100644 index 6280835..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.OutputValidator; -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -import java.io.File; -import java.io.IOException; - -import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS; -import static org.fest.assertions.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assume.assumeTrue; - -/** - * Testing long path of base.dir where Windows CLI crashes. - * <br> - * Integration test for <a href="https://issues.apache.org/jira/browse/SUREFIRE-1400">SUREFIRE-1400</a>. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.20.1 - */ -public class LongWindowsPathIT - extends SurefireJUnit4IntegrationTestCase -{ - private static final String PROJECT_DIR = "long-windows-path"; - private static final String LONG_PATH = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - - // the IT engine crashes using long path - private static final String LONG_DIR = LONG_PATH + LONG_PATH + LONG_PATH; - - @Test - public void shouldRunInSystemTmp() throws Exception - { - assumeTrue( IS_OS_WINDOWS ); - - OutputValidator validator = unpack().setForkJvm() - .showErrorStackTraces() - .executeTest() - .verifyErrorFreeLog(); - - validator.assertThatLogLine( containsString( "SUREFIRE-1400 user.dir=" ), is( 1 ) ) - .assertThatLogLine( containsString( "SUREFIRE-1400 surefire.real.class.path=" ), is( 1 ) ); - - for ( String line : validator.loadLogLines() ) - { - if ( line.contains( "SUREFIRE-1400 user.dir=" ) ) - { - File buildDir = new File( System.getProperty( "user.dir" ), "target" ); - File itBaseDir = new File( buildDir, "LongWindowsPathIT_shouldRunInSystemTmp" ); - - assertThat( line ) - .contains( itBaseDir.getAbsolutePath() ); - } - else if ( line.contains( "SUREFIRE-1400 surefire.real.class.path=" ) ) - { - assertThat( line ) - .contains( System.getProperty( "java.io.tmpdir" ) ); - } - } - } - - private SurefireLauncher unpack() throws IOException - { - return unpack( PROJECT_DIR/*, "_" + LONG_DIR*/ ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java deleted file mode 100644 index 3c3d2c6..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.junit.Test; - -import java.io.IOException; - -public class ModulePathIT - extends AbstractJigsawIT -{ - @Test - public void testModulePath() - throws IOException - { - assumeJigsaw() - .debugLogging() - .executeTest() - .verifyErrorFreeLog() - .assertTestSuiteResults( 2 ); - } - - @Override - protected String getProjectDirectoryName() - { - return "modulepath"; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java deleted file mode 100644 index 1be88b7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.junit.Test; - -/** - * SUREFIRE-621 Asserts proper test counts when running junit 3 tests in parallel - * - * @author Kristian Rosenvold - */ -public class NoRunnableTestsInClassIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testJunit3ParallelBuildResultCount() - { - unpack( "norunnableTests" ).failNever().executeTest().verifyTextInLog( - "No tests found in junit.norunnabletests.BasicTest" ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java deleted file mode 100644 index 71bccd6..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.junit.Test; - -/** - * Test useManifestOnlyJar option - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class PlainOldJavaClasspathIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testPlainOldJavaClasspath() - { - executeErrorFreeTest( "plain-old-java-classpath", 1 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java deleted file mode 100644 index bec3e99..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * 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.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Test library using a conflicting version of plexus-utils - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class PlexusConflictIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testPlexusConflict() - { - unpack().executeTest().verifyErrorFree( 1 ); - } - - @Test - public void testPlexusConflictIsolatedClassLoader() - { - unpack().useSystemClassLoader(false).executeTest().verifyErrorFree( 1 ); - } - - private SurefireLauncher unpack() - { - return unpack( "/plexus-conflict" ); - } -} \ No newline at end of file