http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java deleted file mode 100644 index a358172..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgReportTestIT.java +++ /dev/null @@ -1,74 +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; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; - -/** - * Test surefire-report on TestNG test - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class CheckTestNgReportTestIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testNgReport() - throws Exception - { - unpack( "/testng-simple" ) - .sysProp( "testNgVersion", "5.7" ) - .sysProp( "testNgClassifier", "jdk15" ) - .addSurefireReportGoal() - .executeCurrentGoals() - .verifyErrorFree( 3 ) - .getSiteFile( "surefire-report.html" ) - .assertFileExists(); - } - - @Test - public void shouldNotBeVerbose() - throws Exception - { - unpack( "/testng-simple" ) - .sysProp( "testNgVersion", "5.10" ) - .sysProp( "testNgClassifier", "jdk15" ) - .executeTest() - .verifyErrorFreeLog() - .assertThatLogLine( containsString( "[Parser] Running:" ), is( 0 ) ); - } - - @Test - public void shouldBeVerbose() - throws Exception - { - unpack( "/testng-simple" ) - .sysProp( "testNgVersion", "5.10" ) - .sysProp( "testNgClassifier", "jdk15" ) - .sysProp( "surefire.testng.verbose", "10" ) - .executeTest() - .verifyErrorFreeLog() - .assertThatLogLine( containsString( "[Parser] Running:" ), is( 1 ) ); - } -}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java deleted file mode 100644 index 2e56dc9..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlIT.java +++ /dev/null @@ -1,60 +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.Ignore; -import org.junit.Test; - -/** - * Test simple TestNG suite XML file - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class CheckTestNgSuiteXmlIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void suiteXml() - { - unpack().executeTest().verifyErrorFree( 2 ); - } - - @Test - @Ignore( "Fails - see SUREFIRE-1123" ) - public void suiteXmlForkModeAlways() - { - unpack().forkAlways().executeTest().verifyErrorFree( 2 ); - } - - @Test - public void suiteXmlForkCountTwoReuse() - { - unpack().forkCount( 2 ).reuseForks( true ).executeTest().verifyErrorFree( 2 ); - } - - private SurefireLauncher unpack() - { - return unpack( "testng-suite-xml" ) - .sysProp( "testNgVersion", "5.7" ) - .sysProp( "testNgClassifier", "jdk15" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java deleted file mode 100644 index e2b63b6..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java +++ /dev/null @@ -1,44 +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; - -/** - * Use -Dtest to run a single TestNG test, overriding the suite XML parameter. - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class CheckTestNgSuiteXmlSingleIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void TestNgSuite() - { - unpack( "/testng-twoTestCaseSuite" ) - .sysProp( "testNgVersion", "5.7" ) - .sysProp( "testNgClassifier", "jdk15" ) - .setTestToRun( "TestNGTestTwo" ) - .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/CheckTestNgVersionsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java deleted file mode 100644 index 6d2bbfa..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgVersionsIT.java +++ /dev/null @@ -1,223 +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.List; - -import org.apache.maven.plugins.surefire.report.ReportTestSuite; -import org.apache.maven.surefire.its.fixture.HelperAssertions; -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.Ignore; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Basic suite test using all known versions of TestNG. Used for regression testing Surefire against old versions. To - * check new versions of TestNG work with current versions of Surefire, instead run the full test suite with - * -Dtestng.version=5.14.2 (for example) - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> - */ -public class CheckTestNgVersionsIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Test public void test47() - throws Exception - { - runTestNgTest( "4.7", "jdk15" ); - } - - @Test @Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" ) public void XXXtest50() - throws Exception - { - runTestNgTest( "5.0", "jdk15" ); - } - - @Test @Ignore( "5.0 and 5.0.1 jars on central are malformed SUREFIRE-375 + MAVENUPLOAD-1024" ) public void XXXtest501() - throws Exception - { - runTestNgTest( "5.0.1", "jdk15" ); - } - - @Test public void test502() - throws Exception - { - runTestNgTest( "5.0.2", "jdk15" ); - } - - @Test public void test51() - throws Exception - { - runTestNgTest( "5.1", "jdk15" ); - } - - @Test public void test55() - throws Exception - { - runTestNgTest( "5.5", "jdk15" ); - } - - @Test public void test56() - throws Exception - { - runTestNgTest( "5.6", "jdk15" ); - } - - @Test public void test57() - throws Exception - { - runTestNgTest( "5.7", "jdk15" ); - } - - @Test public void test58() - throws Exception - { - runTestNgTest( "5.8", "jdk15" ); - } - - @Test public void test59() - throws Exception - { - runTestNgTest( "5.9", "jdk15" ); - } - - @Test public void test510() - throws Exception - { - runTestNgTest( "5.10", "jdk15" ); - } - - @Test public void test511() - throws Exception - { - runTestNgTest( "5.11", "jdk15" ); - } - - @Test public void test512() - throws Exception - { - runTestNgTest( "5.12.1" ); - } - - @Test public void test513() - throws Exception - { - runTestNgTest( "5.13" ); - } - - @Test public void test5131() - throws Exception - { - runTestNgTest( "5.13.1" ); - } - - @Test public void test514() - throws Exception - { - runTestNgTest( "5.14" ); - } - - @Test public void test5141() - throws Exception - { - runTestNgTest( "5.14.1" ); - } - - @Test public void test5142() - throws Exception - { - runTestNgTest( "5.14.2" ); - } - - @Test public void test60() - throws Exception - { - runTestNgTest( "6.0" ); - } - - @Test public void test685() - throws Exception - { - runTestNgTestWithRunOrder( "6.8.5" ); - } - - private void runTestNgTestWithRunOrder( String version ) - throws Exception - { - runTestNgTest( version, null, true ); - } - - private void runTestNgTest( String version ) - throws Exception - { - runTestNgTest( version, null, false ); - } - - private void runTestNgTest( String version, boolean validateRunOrder ) - throws Exception - { - runTestNgTest( version, null, validateRunOrder ); - } - - private void runTestNgTest( String version, String classifier ) - throws Exception - { - runTestNgTest( version, classifier, false ); - } - - private void runTestNgTest( String version, String classifier, boolean validateRunOrder ) - throws Exception - { - final SurefireLauncher launcher = unpack( "testng-simple" ) - .sysProp( "testNgVersion", version ); - - if ( classifier != null ) - { - launcher.sysProp( "testNgClassifier", classifier ); - } - - final OutputValidator outputValidator = launcher.executeTest(); - - outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 ); - - if ( validateRunOrder ) - { - // assert correct run order of tests - List<ReportTestSuite> report = HelperAssertions.extractReports( outputValidator.getBaseDir() ); - - assertEquals( 3, report.size() ); - - assertTrue( "TestNGSuiteTestC was executed first", getTestClass( report, 0 ).endsWith( "TestNGSuiteTestC" ) ); - assertTrue( "TestNGSuiteTestB was executed second", getTestClass( report, 1 ).endsWith( "TestNGSuiteTestB" ) ); - assertTrue( "TestNGSuiteTestA was executed last", getTestClass( report, 2 ).endsWith( "TestNGSuiteTestA" ) ); - } - } - - private String getTestClass( List<ReportTestSuite> report, int i ) - { - return report.get( i ).getFullClassName(); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderIT.java deleted file mode 100644 index dfea90a..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClassPathOrderIT.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; - -/** - * Test for checking the order of class path elements - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> - */ -public class ClassPathOrderIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void classPathOrder() - { - unpack( "/classpath-order" ).executeTest().verifyErrorFree( 2 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathFilteringIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathFilteringIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathFilteringIT.java deleted file mode 100644 index 89aada7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathFilteringIT.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; - -/** - * Test additionalClasspathElements - * - * @author pgier - */ -public class ClasspathFilteringIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void additionalClasspath() - throws Exception - { - unpack( "classpath-filtering" ).debugLogging().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/ClasspathScopeFilteringIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java deleted file mode 100644 index ca64d87..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.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; - -/** - * Test additionalClasspathElements - * - * @author pgier - * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> - */ -public class ClasspathScopeFilteringIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void additionalClasspath() - { - unpack( "classpath-scope-filtering" ).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/ConsoleOutputIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java deleted file mode 100644 index e01d798..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java +++ /dev/null @@ -1,106 +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.nio.charset.Charset; - -import org.apache.maven.surefire.its.fixture.OutputValidator; -import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.TestFile; -import org.junit.Test; - -/** - * Basic suite test using all known versions of JUnit 4.x - * - * @author Kristian Rosenvold - */ -public class ConsoleOutputIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void properNewlinesAndEncodingWithDefaultEncodings() - { - final OutputValidator outputValidator = - unpack( "/consoleOutput" ).forkOnce().executeTest(); - - validate( outputValidator, true ); - } - - @Test - public void properNewlinesAndEncodingWithDifferentEncoding() - { - final OutputValidator outputValidator = - unpack( "/consoleOutput" ).forkOnce().argLine( "-Dfile.encoding=UTF-16" ).executeTest(); - - validate( outputValidator, true ); - } - - @Test - public void properNewlinesAndEncodingWithoutFork() - { - final OutputValidator outputValidator = - unpack( "/consoleOutput" ).forkNever().executeTest(); - - validate( outputValidator, false ); - } - - private void validate( final OutputValidator outputValidator, boolean includeShutdownHook ) - { - TestFile xmlReportFile = outputValidator.getSurefireReportsXmlFile( "TEST-consoleOutput.Test1.xml" ); - xmlReportFile.assertContainsText( "SoutLine" ); - xmlReportFile.assertContainsText( normalizeToDefaultCharset( "äöüÃ" ) ); - xmlReportFile.assertContainsText( normalizeToDefaultCharset( "failing with ü" ) ); - - TestFile outputFile = outputValidator.getSurefireReportsFile( "consoleOutput.Test1-output.txt" ); - outputFile.assertContainsText( "SoutAgain" ); - outputFile.assertContainsText( "SoutLine" ); - outputFile.assertContainsText( normalizeToDefaultCharset( "äöüÃ" ) ); - - if ( includeShutdownHook ) - { - outputFile.assertContainsText( "Printline in shutdown hook" ); - } - } - - /** - * @param string the string to normalize - * @return the string with all characters not available in the current charset being replaced, e.g. for US-ASCII, - * German umlauts would be replaced to ? - */ - private String normalizeToDefaultCharset( String string ) - { - Charset cs = Charset.defaultCharset(); - if ( cs.canEncode() ) - { - string = cs.decode( cs.encode( string ) ).toString(); - } - - return string; - } - - @Test - public void largerSoutThanMemory() - throws Exception - { - unpack( "consoleoutput-noisy" ).setMavenOpts( "-Xmx64m" ).sysProp( "thousand", "32000" ).executeTest(); - } - - -} \ 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/CrashDetectionIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java deleted file mode 100644 index b5489d1..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CrashDetectionIT.java +++ /dev/null @@ -1,61 +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; - -/** - * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> - */ -public class CrashDetectionIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void crashInFork() - { - unpack( "crash-detection" ).maven().withFailure().executeTest(); - } - - @Test - public void crashInReusableFork() - { - unpack( "crash-detection" ) - .forkPerThread() - .reuseForks( true ) - .threadCount( 1 ) - .maven() - .withFailure() - .executeTest(); - } - - @Test - public void hardCrashInReusableFork() - { - unpack( "crash-detection" ) - .forkPerThread() - .reuseForks( true ) - .threadCount( 1 ) - .addGoal( "-DkillHard=true" ) - .maven() - .withFailure() - .executeTest(); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationIT.java deleted file mode 100644 index b0907b8..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/DefaultConfigurationIT.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 basic default configuration, runs the JUnit 3 test in the src/test directory. - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class DefaultConfigurationIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void defaultConfiguration() - { - executeErrorFreeTest( "default-configuration", 1 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariableIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariableIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariableIT.java deleted file mode 100644 index 7f38a73..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariableIT.java +++ /dev/null @@ -1,40 +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 basic default configuration, runs the JUnit 3 test in the src/test directory. - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class EnvironmentVariableIT - extends SurefireJUnit4IntegrationTestCase -{ - - @Test - public void environmentVariable() - { - - executeErrorFreeTest( "junit44-environment", 1 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariablesIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariablesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariablesIT.java deleted file mode 100644 index 651200f..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/EnvironmentVariablesIT.java +++ /dev/null @@ -1,47 +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-763 Asserts that environment variables are correctly populated using "useSystemClassLoader=false" - * SUREFIRE-963 Asserts that empty environment variables are read as "". - * - * @author Kristian Rosenvold - * @author Christophe Deneux - */ -public class EnvironmentVariablesIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testWhenUseSystemClassLoader() - { - unpack( "/environment-variables" ).addGoal( "-DuseSystemClassLoader=true" ).executeTest(); - } - - @Test - public void testWhenDontUseSystemClassLoader() - { - unpack( "/environment-variables" ).addGoal( "-DuseSystemClassLoader=false" ).executeTest(); - } - -} \ 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/FailFastJUnitIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastJUnitIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastJUnitIT.java deleted file mode 100644 index beb1e32..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastJUnitIT.java +++ /dev/null @@ -1,77 +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.ArrayList; - -import static org.junit.runners.Parameterized.Parameters; - -/** - * Test class for SUREFIRE-580, configuration parameter {@code skipAfterFailureCount}. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.19 - */ -public class FailFastJUnitIT - extends AbstractFailFastIT -{ - - @Parameters(name = "{0}") - public static Iterable<Object[]> data() - { - /** - * reuseForks=false is not used because of race conditions and unpredictable commands received by - * MasterProcessReader, this feature has significant limitation. - */ - ArrayList<Object[]> args = new ArrayList<Object[]>(); - // description - // profile - // forkCount, - // fail-fast-count, - // reuseForks - // total - // failures - // errors - // skipped - args.add( new Object[] { "junit4-oneFork-ff1", "junit4", props( 1, 1, true ), 5, 0, 1, 4 } ); - args.add( new Object[] { "junit47-oneFork-ff1", "junit47", props( 1, 1, true ), 5, 0, 1, 4 } ); - args.add( new Object[] { "junit4-oneFork-ff2", "junit4", props( 1, 2, true ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit47-oneFork-ff2", "junit47", props( 1, 2, true ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit4-twoForks-ff1", "junit4", props( 2, 1, true ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit47-twoForks-ff1", "junit47",props( 2, 1, true ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit4-twoForks-ff2", "junit4", props( 2, 2, true ), 5, 0, 2, 2 } ); - args.add( new Object[] { "junit47-twoForks-ff2", "junit47",props( 2, 2, true ), 5, 0, 2, 2 } ); - args.add( new Object[] { "junit4-oneFork-ff3", "junit4", props( 1, 3, true ), 5, 0, 2, 0 } ); - args.add( new Object[] { "junit47-oneFork-ff3", "junit47", props( 1, 3, true ), 5, 0, 2, 0 } ); - args.add( new Object[] { "junit4-twoForks-ff3", "junit4", props( 2, 3, true ), 5, 0, 2, 0 } ); - args.add( new Object[] { "junit47-twoForks-ff3", "junit47",props( 2, 3, true ), 5, 0, 2, 0 } ); - /*args.add( new Object[] { "junit4-twoForks-ff1x","junit4", props( 2, 1, false ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit47-twoForks-ff1x","junit47",props( 2, 1, false ), 5, 0, 2, 3 } ); - args.add( new Object[] { "junit4-twoForks-ff2x","junit4", props( 2, 2, false ), 5, 0, 2, 2 } ); - args.add( new Object[] { "junit47-twoForks-ff2x","junit47",props( 2, 2, false ), 5, 0, 2, 2 } );*/ - return args; - } - - @Override - protected String withProvider() - { - return "junit"; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastTestNgIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastTestNgIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastTestNgIT.java deleted file mode 100644 index f4aa2b7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/FailFastTestNgIT.java +++ /dev/null @@ -1,69 +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.ArrayList; - -import static org.junit.runners.Parameterized.Parameters; - -/** - * Test class for SUREFIRE-580, configuration parameter {@code skipAfterFailureCount}. - * - * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> - * @since 2.19 - */ -public class FailFastTestNgIT - extends AbstractFailFastIT -{ - - @Parameters(name = "{0}") - public static Iterable<Object[]> data() - { - /** - * reuseForks=false is not used because of race conditions and unpredictable commands received by - * MasterProcessReader, this feature has significant limitation. - */ - ArrayList<Object[]> args = new ArrayList<Object[]>(); - // description - // profile - // forkCount, - // fail-fast-count, - // reuseForks - // total - // failures - // errors - // skipped - args.add( new Object[] { "testng-oneFork-ff1", null, props( 1, 1, true ), 5, 1, 0, 4 } ); - args.add( new Object[] { "testng-oneFork-ff2", null, props( 1, 2, true ), 5, 2, 0, 3 } ); - args.add( new Object[] { "testng-twoForks-ff1", null, props( 2, 1, true ), 5, 2, 0, 3 } ); - args.add( new Object[] { "testng-twoForks-ff2", null, props( 2, 2, true ), 5, 2, 0, 2 } ); - args.add( new Object[] { "testng-oneFork-ff3", null, props( 1, 3, true ), 5, 2, 0, 0 } ); - args.add( new Object[] { "testng-twoForks-ff3", null, props( 2, 3, true ), 5, 2, 0, 0 } ); - /*args.add( new Object[] { "testng-twoForks-ff1x", null, props( 2, 1, false ), 5, 2, 0, 3 } ); - args.add( new Object[] { "testng-twoForks-ff2x", null, props( 2, 2, false ), 5, 2, 0, 2 } );*/ - return args; - } - - @Override - protected String withProvider() - { - return "testng"; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.java deleted file mode 100644 index 6aac330..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputIT.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 org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; -import org.junit.Test; - -/** - * Asserts proper behaviour of console output when forking - * SUREFIRE-639 - * SUREFIRE-651 - * - * @author Kristian Rosenvold - */ -public class ForkConsoleOutputIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void printSummaryTrueWithRedirect() - { - unpack().setForkJvm() - .redirectToFile( true ) - .printSummary( true ) - .executeTest() - .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" ) - .assertFileExists(); - } - - @Test - public void printSummaryTrueWithoutRedirect() - { - unpack().setForkJvm() - .redirectToFile( false ) - .printSummary( true ) - .executeTest() - .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" ) - .assertFileNotExists(); - } - - @Test - public void printSummaryFalseWithRedirect() - { - unpack().setForkJvm() - .redirectToFile( true ) - .printSummary( false ) - .debugLogging() - .showErrorStackTraces() - .executeTest() - .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" ) - .assertFileExists(); - } - - @Test - public void printSummaryFalseWithoutRedirect() - { - unpack().setForkJvm() - .redirectToFile( false ) - .printSummary( false ) - .executeTest() - .getSurefireReportsFile( "forkConsoleOutput.Test1-output.txt" ) - .assertFileNotExists(); - } - - - private SurefireLauncher unpack() - { - return unpack( "/fork-consoleOutput" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java deleted file mode 100644 index e5feb7f..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkConsoleOutputWithErrorsIT.java +++ /dev/null @@ -1,47 +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; - -/** - * Asserts proper behaviour of console output when forking - * SUREFIRE-639 - * SUREFIRE-651 - * - * @author Kristian Rosenvold - */ -public class ForkConsoleOutputWithErrorsIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void xmlFileContainsConsoleOutput() - { - unpack( "/fork-consoleOutputWithErrors" ) - .setForkJvm() - .failNever() - .redirectToFile( true ) - .executeTest() - .getSurefireReportsXmlFile( "TEST-forkConsoleOutput.Test2.xml" ) - .assertContainsText( "sout: Will Fail soon" ) - .assertContainsText( "serr: Will Fail now" ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java deleted file mode 100644 index 574d144..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeIT.java +++ /dev/null @@ -1,241 +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.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -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.apache.maven.surefire.its.fixture.TestFile; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Test forkMode - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class ForkModeIT - extends SurefireJUnit4IntegrationTestCase -{ - - private OutputValidator outputValidator; - - @BeforeClass - public static void installDumpPidPlugin() - throws Exception - { - unpack( ForkModeIT.class, "test-helper-dump-pid-plugin", "plugin" ).executeInstall(); - } - - @Test - public void testForkModeAlways() - { - String[] pids = doTest( unpack( getProject() ).setForkJvm().forkAlways() ); - assertDifferentPids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkModePerTest() - { - String[] pids = doTest( unpack( getProject() ).setForkJvm().forkPerTest() ); - assertDifferentPids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkModeNever() - { - String[] pids = doTest( unpack( getProject() ).forkNever() ); - assertSamePids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertEquals( "my pid is equal to pid 1 of the test", getMainPID(), pids[0] ); - } - - @Test - public void testForkModeNone() - { - String[] pids = doTest( unpack( getProject() ).forkMode( "none" ) ); - assertSamePids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertEquals( "my pid is equal to pid 1 of the test", getMainPID(), pids[0] ); - } - - @Test - public void testForkModeOncePerThreadSingleThread() - { - String[] pids = doTest( unpack( getProject() ) - .setForkJvm() - .forkPerThread() - .reuseForks( true ) - .threadCount( 1 ) ); - assertSamePids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkModeOncePerThreadTwoThreads() - { - String[] pids = doTest( unpack( getProject() ) - .forkPerThread() - .reuseForks( true ) - .threadCount( 2 ) - .addGoal( "-DsleepLength=1200" ) ); - assertDifferentPids( pids, 2 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkCountZero() - { - String[] pids = doTest( unpack( getProject() ).forkCount( 0 ) ); - assertSamePids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertEquals( "my pid is equal to pid 1 of the test", getMainPID(), pids[0] ); - } - - @Test - public void testForkCountOneNoReuse() - { - String[] pids = doTest( unpack( getProject() ).setForkJvm().forkCount( 1 ).reuseForks( false ) ); - assertDifferentPids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkCountOneReuse() - { - String[] pids = doTest( unpack( getProject() ).setForkJvm().forkCount( 1 ).reuseForks( true ) ); - assertSamePids( pids ); - assertEndWith( pids, "_1_1", 3 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkCountTwoNoReuse() - { - String[] pids = - doTest( unpack( getProject() ).setForkJvm().forkCount( 2 ).reuseForks( false ).addGoal( "-DsleepLength=1200" ) ); - assertDifferentPids( pids ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - @Test - public void testForkCountTwoReuse() - { - String[] pids = - doTest( unpack( getProject() ).forkCount( 2 ).reuseForks( true ).addGoal( "-DsleepLength=1200" ) ); - assertDifferentPids( pids, 2 ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - private void assertEndWith( String[] pids, String suffix, int expectedMatches ) - { - int matches = 0; - for ( String pid : pids ) - { - if ( pid.endsWith( suffix ) ) - { - matches++; - } - } - - assertEquals( "suffix " + suffix + " matched the correct number of pids", expectedMatches, matches ); - } - - private void assertDifferentPids( String[] pids, int numOfDifferentPids ) - { - Set<String> pidSet = new HashSet<String>( Arrays.asList( pids ) ); - assertEquals( "number of different pids is not as expected", numOfDifferentPids, pidSet.size() ); - } - - @Test - public void testForkModeOnce() - { - String[] pids = doTest( unpack( getProject() ).forkOnce() ); - assertSamePids( pids ); - assertFalse( "pid 1 is not the same as the main process' pid", pids[0].equals( getMainPID() ) ); - } - - private String getMainPID() - { - final TestFile targetFile = outputValidator.getTargetFile( "maven.pid" ); - String pid = targetFile.slurpFile(); - return pid + " testValue_1_1"; - } - - private void assertSamePids( String[] pids ) - { - assertEquals( "pid 1 didn't match pid 2", pids[0], pids[1] ); - assertEquals( "pid 1 didn't match pid 3", pids[0], pids[2] ); - } - - private void assertDifferentPids( String[] pids ) - { - if ( pids[0].equals( pids[1] ) ) - { - fail( "pid 1 matched pid 2: " + pids[0] ); - } - - if ( pids[0].equals( pids[2] ) ) - { - fail( "pid 1 matched pid 3: " + pids[0] ); - } - - if ( pids[1].equals( pids[2] ) ) - { - fail( "pid 2 matched pid 3: " + pids[0] ); - } - } - - private String[] doTest( SurefireLauncher forkMode ) - { - forkMode.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" ); - forkMode.addGoal( "org.apache.maven.plugins.surefire:maven-dump-pid-plugin:dump-pid" ); - outputValidator = forkMode.executeTest(); - outputValidator.verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 ); - String[] pids = new String[3]; - for ( int i = 1; i <= pids.length; i++ ) - { - final TestFile targetFile = outputValidator.getTargetFile( "test" + i + "-pid" ); - String pid = targetFile.slurpFile(); - pids[i - 1] = pid; - } - return pids; - } - - protected String getProject() - { - return "fork-mode"; - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java deleted file mode 100644 index 22588cc..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeMultiModuleIT.java +++ /dev/null @@ -1,162 +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.*; -import org.junit.Test; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Test forkMode in a multi module project with parallel maven builds - * - * @author Andreas Gudian - */ -public class ForkModeMultiModuleIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testForkCountOneNoReuse() - { - List<String> pids = doTest( unpack( getProject() ).forkCount( 1 ).reuseForks( false ) ); - assertAllDifferentPids( pids ); - int matchesOne = countSuffixMatches( pids, "_1_1"); - int matchesTwo = countSuffixMatches( pids, "_2_2" ); - assertTrue( "At least one fork had forkNumber 1", matchesOne >= 1 ); - assertTrue( "At least one fork had forkNumber 2", matchesTwo >= 1 ); - assertEquals( "No other forkNumbers than 1 and 2 have been used", 6, matchesOne + matchesTwo); - } - - - @Test - public void testForkCountOneReuse() - { - List<String> pids = doTest( unpack( getProject() ).forkCount( 1 ).reuseForks( true ) ); - assertDifferentPids( pids, 2 ); - assertEndWith( pids, "_1_1", 3 ); - assertEndWith( pids, "_2_2", 3 ); - } - - @Test - public void testForkCountTwoNoReuse() - { - List<String> pids = doTest( unpack( getProject() ).forkCount( 2 ).reuseForks( false ) ); - assertAllDifferentPids( pids ); - int matchesOne = countSuffixMatches( pids, "_1_1"); - int matchesTwo = countSuffixMatches( pids, "_2_2" ); - int matchesThree = countSuffixMatches( pids, "_3_3"); - int matchesFour = countSuffixMatches( pids, "_4_4" ); - assertTrue( "At least one fork had forkNumber 1", matchesOne >= 1 ); - assertTrue( "At least one fork had forkNumber 2", matchesTwo >= 1 ); - assertTrue( "At least one fork had forkNumber 3", matchesThree >= 1 ); - assertTrue( "At least one fork had forkNumber 4", matchesFour >= 1 ); - assertEquals( "No other forkNumbers than 1, 2, 3, or 4 have been used", 6, matchesOne + matchesTwo + matchesThree + matchesFour ); - } - - @Test - public void testForkCountTwoReuse() - { - List<String> pids = - doTest( unpack( getProject() ).forkCount( 2 ).reuseForks( true ) ); - assertDifferentPids( pids, 4 ); - - int matchesOne = countSuffixMatches( pids, "_1_1"); - int matchesTwo = countSuffixMatches( pids, "_2_2" ); - int matchesThree = countSuffixMatches( pids, "_3_3"); - int matchesFour = countSuffixMatches( pids, "_4_4" ); - assertTrue( "At least one fork had forkNumber 1", matchesOne >= 1 ); - assertTrue( "At least one fork had forkNumber 2", matchesTwo >= 1 ); - assertTrue( "At least one fork had forkNumber 3", matchesThree >= 1 ); - assertTrue( "At least one fork had forkNumber 4", matchesFour >= 1 ); - assertEquals( "No other forkNumbers than 1, 2, 3, or 4 have been used", 6, matchesOne + matchesTwo + matchesThree + matchesFour ); - } - - private void assertEndWith( List<String> pids, String suffix, int expectedMatches ) - { - int matches = countSuffixMatches( pids, suffix ); - - assertEquals( "suffix " + suffix + " matched the correct number of pids", expectedMatches, matches ); - } - - private int countSuffixMatches( List<String> pids, String suffix ) - { - int matches = 0; - for ( String pid : pids ) - { - if ( pid.endsWith( suffix ) ) - { - matches++; - } - } - return matches; - } - - private void assertDifferentPids( List<String> pids, int numOfDifferentPids ) - { - Set<String> pidSet = new HashSet<String>( pids ); - assertEquals( "number of different pids is not as expected", numOfDifferentPids, pidSet.size() ); - } - - private void assertAllDifferentPids( List<String> pids ) - { - assertDifferentPids( pids, pids.size() ); - } - - private List<String> doTest( SurefireLauncher forkMode ) - { - forkMode.addGoal( "-T2" ); - forkMode.sysProp( "testProperty", "testValue_${surefire.threadNumber}_${surefire.forkNumber}" ); - final OutputValidator outputValidator = forkMode.setForkJvm().executeTest(); - List<String> pids = new ArrayList<String>( 6 ); - pids.addAll( validateModule( outputValidator, "module-a" ) ); - pids.addAll( validateModule( outputValidator, "module-b" ) ); - - return pids; - } - - private List<String> validateModule( OutputValidator outputValidator, String module ) - { - HelperAssertions.assertTestSuiteResults( 3, 0, 0, 0, new File( outputValidator.getBaseDir(), module ) ); - - List<String> pids = new ArrayList<String>( 3 ); - for ( int i = 1; i <= 3; i++ ) - { - final TestFile targetFile = outputValidator.getTargetFile( module, "test" + i + "-pid" ); - String pid = targetFile.slurpFile(); - pids.add( pid ); - } - - return pids; - } - - protected String getProject() - { - return "fork-mode-multimodule"; - } - - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java deleted file mode 100644 index 5ba0577..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ForkModeTestNGIT.java +++ /dev/null @@ -1,35 +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. - */ - -/** - * Test forkMode - * - * @author <a href="mailto:velo...@gmail.com">Marvin Froeder</a> - */ -public class ForkModeTestNGIT - extends ForkModeIT -{ - @Override - protected String getProject() - { - return "fork-mode-testng"; - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesFromFileIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesFromFileIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesFromFileIT.java deleted file mode 100644 index a6c539c..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesFromFileIT.java +++ /dev/null @@ -1,95 +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; - -/** - * Test include/exclude from files. - * <br> - * Based on {@link IncludesExcludesIT}. - */ -public class IncludesExcludesFromFileIT - extends SurefireJUnit4IntegrationTestCase -{ - private SurefireLauncher unpack() - { - return unpack( "/includes-excludes-from-file" ); - } - - @Test - public void testSimple() - { - testWithProfile( "simple" ); - } - - @Test - public void testSimpleMixed() - { - testWithProfile( "simple-mixed" ); - } - - @Test - public void testRegex() - { - testWithProfile( "regex" ); - } - - @Test - public void testPath() - { - testWithProfile( "path" ); - } - - @Test - public void testMissingExcludes() - { - expectBuildFailure("missing-excludes-file", "Failed to load list from file", "no-such-excludes-file"); - } - - @Test - public void testMissingIncludes() - { - expectBuildFailure( "missing-includes-file", "Failed to load list from file", "no-such-includes-file" ); - } - - private void testWithProfile( String profile ) - { - final OutputValidator outputValidator = unpack(). - activateProfile( profile ).executeTest().verifyErrorFree( 2 ); - - outputValidator.getTargetFile( "testTouchFile.txt" ).assertFileExists(); - outputValidator.getTargetFile( "defaultTestTouchFile.txt" ).assertFileExists(); - } - - private void expectBuildFailure( final String profile, final String... messages ) - { - final OutputValidator outputValidator = unpack().activateProfile( profile ) - .maven().withFailure().executeTest(); - - for ( String message : messages ) - { - outputValidator.verifyTextInLog( message ); - } - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesIT.java deleted file mode 100644 index 46bdeb6..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/IncludesExcludesIT.java +++ /dev/null @@ -1,68 +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; - -/** - * Test include/exclude patterns. - * - * @author Benjamin Bentmann - */ -public class IncludesExcludesIT - extends SurefireJUnit4IntegrationTestCase -{ - private SurefireLauncher unpack() - { - return unpack( "/includes-excludes" ); - } - - /** - * Test surefire inclusions/exclusions - */ - @Test - public void testIncludesExcludes() - { - testWithProfile( "simple" ); - } - - @Test - public void testRegexIncludesExcludes() - { - testWithProfile( "regex" ); - } - - @Test - public void testPathBasedIncludesExcludes() - { - testWithProfile( "path" ); - } - - private void testWithProfile( String profile ) - { - final OutputValidator outputValidator = unpack(). - activateProfile( profile ).executeTest().verifyErrorFree( 2 ); - outputValidator.getTargetFile( "testTouchFile.txt" ).assertFileExists(); - outputValidator.getTargetFile( "defaultTestTouchFile.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/JUnit44HamcrestIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44HamcrestIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44HamcrestIT.java deleted file mode 100644 index 7bf90f0..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit44HamcrestIT.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 project using JUnit4.4 (including Hamcrest extensions) - * - * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> - */ -public class JUnit44HamcrestIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void testJUnit44Hamcrest() - { - executeErrorFreeTest( "junit44-hamcrest", 1 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java deleted file mode 100644 index 57007a7..0000000 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit47ConcurrencyIT.java +++ /dev/null @@ -1,58 +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.junit.Test; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.*; -import static org.hamcrest.CoreMatchers.*; - -/** - * Basic suite test using all known versions of JUnit 4.x - * - * @author Kristian Rosenvold - */ -public class JUnit47ConcurrencyIT - extends SurefireJUnit4IntegrationTestCase -{ - @Test - public void test47() - throws Exception - { - OutputValidator validator = unpack( "junit47-concurrency" ) - .executeTest() - .verifyErrorFree( 4 ); - String result = null; - for ( String line : validator.loadLogLines() ) - { - if ( line.startsWith( "[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:" ) ) - { - result = line; - break; - } - } - assertNotNull( result); - assertThat( result, anyOf( containsString( "Time elapsed: 1." ), containsString( "Time elapsed: 0.9" ) ) ); - assertThat( result, endsWith( " s - in concurrentjunit47.src.test.java.junit47.BasicTest" ) ); - } -} \ No newline at end of file