http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test/java/testng/suiteXml/TestNGSuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test/java/testng/suiteXml/TestNGSuiteTest.java b/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test/java/testng/suiteXml/TestNGSuiteTest.java deleted file mode 100644 index 0ebf3df..0000000 --- a/surefire-integration-tests/src/test/resources/testng-suite-xml/src/test/java/testng/suiteXml/TestNGSuiteTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package testng.suiteXml; - -/* - * 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.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - - -/** - * Tests that forcing testng to run tests via the - * <code>"${maven.test.forcetestng}"</code> configuration option - * works. - * - * @author jkuhnert - */ -public class TestNGSuiteTest { - - /** - * Sets up testObject - */ - @BeforeClass - public void configureTest() - { - testObject = new Object(); - } - - Object testObject; - - /** - * Tests reporting an error - */ - @Test - public void isTestObjectNull() - { - assert testObject != null : "testObject is null"; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/pom.xml b/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/pom.xml deleted file mode 100644 index 818d53e..0000000 --- a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>it-parent</artifactId> - <version>1.0</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>testng-testrunnerfactory</artifactId> - <version>1.0</version> - <name>TestNG using custom test runner factory</name> - - <dependencies> - <dependency> - <!-- - TestNG 5.9 is the earliest version to expose the testrunfactory flag. - -testrunfactory parameter is buggy in 5.13.1 because expects String instead of Class - -testrunfactory works in 5.10 but fails on missing testng.css because not generated by TestNG itself. - Every next version changed API. - Here API applicable up to 5.12.1. - --> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>5.10</version> - <classifier>jdk15</classifier> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <properties> - <property> - <name>testrunfactory</name> - <value>testng.testrunnerfactory.TestNGCustomTestRunnerFactory</value> - </property> - </properties> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java b/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java deleted file mode 100644 index 4b998ed..0000000 --- a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/FileHelper.java +++ /dev/null @@ -1,25 +0,0 @@ -package testng.testrunnerfactory; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -public class FileHelper -{ - public static void writeFile( String fileName, String content ) - { - try - { - File target = new File( System.getProperty("user.dir"), "target" ).getCanonicalFile(); - File listenerOutput = new File( target, fileName ); - FileWriter out = new FileWriter( listenerOutput, true ); - out.write( content ); - out.flush(); - out.close(); - } - catch ( IOException exception ) - { - throw new RuntimeException( exception ); - } - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGCustomTestRunnerFactory.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGCustomTestRunnerFactory.java b/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGCustomTestRunnerFactory.java deleted file mode 100644 index d52ec96..0000000 --- a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGCustomTestRunnerFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -package testng.testrunnerfactory; - -import org.testng.ISuite; -import org.testng.ITestRunnerFactory; -import org.testng.TestRunner; -import org.testng.xml.XmlTest; -//import org.testng.IInvokedMethodListener; - -import java.util.List; - -public class TestNGCustomTestRunnerFactory - implements ITestRunnerFactory -{ - - public TestRunner newTestRunner( ISuite suite, XmlTest test/*, List<IInvokedMethodListener> listeners*/ ) - { - FileHelper.writeFile( "testrunnerfactory-output.txt", - "Instantiated Test Runner for suite:\n\t" + suite - + "\nand test:\n\t" + test +"\n\n" ); - return new TestRunner( suite, test, test.skipFailedInvocationCounts()/*, listeners*/ ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGSuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGSuiteTest.java b/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGSuiteTest.java deleted file mode 100644 index 6ad173d..0000000 --- a/surefire-integration-tests/src/test/resources/testng-testRunnerFactory/src/test/java/testng/testrunnerfactory/TestNGSuiteTest.java +++ /dev/null @@ -1,11 +0,0 @@ -package testng.testrunnerfactory; - -import org.testng.annotations.Test; - -public class TestNGSuiteTest -{ - @Test - public void doNothing() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml deleted file mode 100644 index f7477fe..0000000 --- a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>testng-twoTestCaseSuite</artifactId> - <version>1.0-SNAPSHOT</version> - <name>TestNG Suite XML with two test cases</name> - - <properties> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - - <profiles> - <profile> - <id>testng-old</id> - <activation> - <property><name>testNgClassifier</name></property> - </activation> - <dependencies> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>${testNgVersion}</version> - <classifier>${testNgClassifier}</classifier> - </dependency> - </dependencies> - </profile> - <profile> - <id>testng-new</id> - <activation> - <property><name>!testNgClassifier</name></property> - </activation> - <dependencies> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>${testNgVersion}</version> - </dependency> - </dependencies> - </profile> - </profiles> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <configuration> - <suiteXmlFiles> - <file>src/test/resources/suite.xml</file> - </suiteXmlFiles> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGSuiteTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGSuiteTest.java b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGSuiteTest.java deleted file mode 100644 index db8dc94..0000000 --- a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGSuiteTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package testng.two; - -/* - * 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.testng.annotations.Test; - - -public class TestNGSuiteTest { - - @Test - public void doNothing() - { - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGTestTwo.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGTestTwo.java b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGTestTwo.java deleted file mode 100644 index 9ab2c86..0000000 --- a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/java/testng/two/TestNGTestTwo.java +++ /dev/null @@ -1,32 +0,0 @@ -package testng.two; - -/* - * 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.testng.annotations.Test; - - -public class TestNGTestTwo { - - @Test - public void testTwo() - { - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/resources/suite.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/resources/suite.xml b/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/resources/suite.xml deleted file mode 100644 index a768654..0000000 --- a/surefire-integration-tests/src/test/resources/testng-twoTestCaseSuite/src/test/resources/suite.xml +++ /dev/null @@ -1,7 +0,0 @@ -<suite name="Foo"> - <test name="Bar"> - <packages> - <package name="testng.two" /> - </packages> - </test> -</suite> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/timeout-forked/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/timeout-forked/pom.xml b/surefire-integration-tests/src/test/resources/timeout-forked/pom.xml deleted file mode 100644 index fc95eb3..0000000 --- a/surefire-integration-tests/src/test/resources/timeout-forked/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>timeout-forked</artifactId> - <version>1.0-SNAPSHOT</version> - <name>Timeout forked process</name> - - <properties> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <configuration> - <forkedProcessTimeoutInSeconds>${forkTimeout}</forkedProcessTimeoutInSeconds> - <reportFormat>plain</reportFormat> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/timeout-forked/src/test/java/timeoutForked/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/timeout-forked/src/test/java/timeoutForked/BasicTest.java b/surefire-integration-tests/src/test/resources/timeout-forked/src/test/java/timeoutForked/BasicTest.java deleted file mode 100644 index 863ac6d..0000000 --- a/surefire-integration-tests/src/test/resources/timeout-forked/src/test/java/timeoutForked/BasicTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package timeoutForked; - -/* - * 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 junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class BasicTest - extends TestCase -{ - - public void testSleep() throws Exception - { - int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "10000" )); - Thread.sleep(sleepLength); - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/unicode-testnames/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/unicode-testnames/pom.xml b/surefire-integration-tests/src/test/resources/unicode-testnames/pom.xml deleted file mode 100644 index 31dd0d0..0000000 --- a/surefire-integration-tests/src/test/resources/unicode-testnames/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>unicode-testnames</artifactId> - <version>1.0-SNAPSHOT</version> - <name>Testcases with unicode names</name> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/EscapeTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/EscapeTest.java b/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/EscapeTest.java deleted file mode 100644 index 69ea6e1..0000000 --- a/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/EscapeTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package junit.twoTestCases; - -/* - * 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 junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class EscapeTest - extends TestCase -{ - - private boolean setUpCalled = false; - - private static boolean tearDownCalled = false; - - public EscapeTest( String name ) - { - super( name ); - } - - public static Test suite() - { - TestSuite suite = new TestSuite(); - Test test = new EscapeTest( "testSetUp" ); - suite.addTest( test ); - - return new TestSetup( suite ) - { - - protected void setUp() - { - //oneTimeSetUp(); - } - - protected void tearDown() - { - oneTimeTearDown(); - } - - }; - } - - protected void setUp() - { - setUpCalled = true; - tearDownCalled = false; - System.out.println( "Called setUp" ); - } - - protected void tearDown() - { - setUpCalled = false; - tearDownCalled = true; - System.out.println( "Called tearDown" ); - } - - public void testSetUp() - { - assertTrue( "setUp was not called", setUpCalled ); - } - - public static void oneTimeTearDown() - { - assertTrue( "tearDown was not called", tearDownCalled ); - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/XXYZTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/XXYZTest.java b/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/XXYZTest.java deleted file mode 100644 index 6496e1b..0000000 --- a/surefire-integration-tests/src/test/resources/unicode-testnames/src/test/java/junit/twoTestCases/XXYZTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package junit.twoTestCases; -/* - * 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 junit.framework.TestCase; - - -public class èç´¢å ¶æ Test - extends TestCase -{ - public void testIHopeTheChineseDoesntMeanAnyhtingOffensiveç´¢å ¶(){ - - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/webapp/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/webapp/pom.xml b/surefire-integration-tests/src/test/resources/webapp/pom.xml deleted file mode 100644 index 6777637..0000000 --- a/surefire-integration-tests/src/test/resources/webapp/pom.xml +++ /dev/null @@ -1,109 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.surefire.its</groupId> - <artifactId>webapp</artifactId> - <packaging>war</packaging> - <version>1.0-SNAPSHOT</version> - <name>sample webapp with Jetty test</name> - <build> - <finalName>webapp</finalName> - <plugins> - <plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - </plugin> - - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <version>2.0</version> - <executions> - <execution> - <phase>generate-test-resources</phase> - <goals> - <goal>exploded</goal> - </goals> - <configuration> - <webappDirectory>${project.build.directory}/webapp</webappDirectory> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>jetty</groupId> - <artifactId>org.mortbay.jetty</artifactId> - <version>5.1.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.4</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>jetty</groupId> - <artifactId>jasper-compiler</artifactId> - <version>5.1.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>jetty</groupId> - <artifactId>jasper-runtime</artifactId> - <version>5.1.10</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>1.7.0</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - </dependency> - <dependency> - <groupId>ant</groupId> - <artifactId>ant</artifactId> - <version>1.6.5</version> - </dependency> - <dependency> - <groupId>commons-el</groupId> - <artifactId>commons-el</artifactId> - <version>1.0</version> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>default-tools.jar</id> - <activation> - <property> - <name>java.vendor</name> - <value>Sun Microsystems Inc.</value> - </property> - </activation> - <dependencies> - <dependency> - <groupId>com.sun</groupId> - <artifactId>tools</artifactId> - <version>system</version> - <scope>system</scope> - <systemPath>${java.home}/../lib/tools.jar</systemPath> - </dependency> - </dependencies> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/WEB-INF/web.xml b/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 9f88c1f..0000000 --- a/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE web-app PUBLIC - "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd" > - -<web-app> - <display-name>Archetype Created Web Application</display-name> -</web-app> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/index.jsp ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/index.jsp b/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/index.jsp deleted file mode 100644 index c38169b..0000000 --- a/surefire-integration-tests/src/test/resources/webapp/src/main/webapp/index.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<html> -<body> -<h2>Hello World!</h2> -</body> -</html> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/webapp/src/test/java/WebAppTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/webapp/src/test/java/WebAppTest.java b/surefire-integration-tests/src/test/resources/webapp/src/test/java/WebAppTest.java deleted file mode 100644 index b4c4e15..0000000 --- a/surefire-integration-tests/src/test/resources/webapp/src/test/java/WebAppTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.io.InputStream; -import java.net.URL; - -import junit.framework.TestCase; - -import org.mortbay.jetty.Server; - - -public class WebAppTest - extends TestCase -{ - private Server server = null; - - public void setUp() - throws Exception - { - System.setProperty( "org.mortbay.xml.XmlParser.NotValidating", "true" ); - - server = new Server(); - String testPort = ":18080"; - server.addListener( testPort ); - server.addWebApplication( "127.0.0.1", "/webapp", "target/webapp" ); - - server.start(); - } - - public void testBlah() - throws Exception - { - URL url = new URL( "http://127.0.0.1:18080/webapp/index.jsp" ); - InputStream stream = url.openStream(); - StringBuffer sb = new StringBuffer(); - for ( int i = stream.read(); i != -1; i = stream.read() ) - { - sb.append( (char) i ); - } - String value = sb.toString(); - assertTrue( value, value.contains( "Hello" ) ); - } - - public void tearDown() - throws Exception - { - if ( server != null ) - server.stop(); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/pom.xml b/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/pom.xml deleted file mode 100644 index fa19695..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>localhost</groupId> - <artifactId>working-directory-test</artifactId> - <version>1.0</version> - <name>Don't run tests if working directory is invalid property.</name> - - <properties> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <configuration> - <workingDirectory>${notSet}</workingDirectory> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/src/test/java/MyTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/src/test/java/MyTest.java b/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/src/test/java/MyTest.java deleted file mode 100644 index d59a11f..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory-is-invalid-property/src/test/java/MyTest.java +++ /dev/null @@ -1,27 +0,0 @@ -import junit.framework.TestCase; - -/* - * 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. - */ - - -public class MyTest extends TestCase { - public void testSomething() { - assertTrue(true); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory-missing/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory-missing/pom.xml b/surefire-integration-tests/src/test/resources/working-directory-missing/pom.xml deleted file mode 100644 index 515a414..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory-missing/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>localhost</groupId> - <artifactId>working-directory-test</artifactId> - <version>1.0</version> - <name>Run tests in a nonexistent working directory</name> - <properties> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.2</version> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <configuration> - <workingDirectory>${project.build.directory}/surefire-working-directory</workingDirectory> - </configuration> - </plugin> - </plugins> - </build> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory-missing/src/test/java/MyTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory-missing/src/test/java/MyTest.java b/surefire-integration-tests/src/test/resources/working-directory-missing/src/test/java/MyTest.java deleted file mode 100644 index d59a11f..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory-missing/src/test/java/MyTest.java +++ /dev/null @@ -1,27 +0,0 @@ -import junit.framework.TestCase; - -/* - * 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. - */ - - -public class MyTest extends TestCase { - public void testSomething() { - assertTrue(true); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory/child/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory/child/pom.xml b/surefire-integration-tests/src/test/resources/working-directory/child/pom.xml deleted file mode 100644 index bdfbed8..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory/child/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>working-directory</artifactId> - <version>1.0-SNAPSHOT</version> - </parent> - - <artifactId>working-directory-child</artifactId> - <name>Test for working directory configuration</name> - - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>3.8.1</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java b/surefire-integration-tests/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java deleted file mode 100644 index 1708202..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory/child/src/test/java/workingDir/BasicTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package workingDir; - -/* - * 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 junit.framework.TestCase; -import java.io.*; -import java.util.Properties; - -public class BasicTest - extends TestCase -{ - - public void testWorkingDir() - throws Exception - { - File target = new File( "target" ).getAbsoluteFile(); - File outFile = new File( target, "out.txt" ); - FileOutputStream os = new FileOutputStream( outFile ); - String userDir = System.getProperty( "user.dir" ); - Properties p = new Properties(); - p.setProperty( "user.dir", userDir ); - p.store( os, "" ); - os.flush(); - os.close(); - } - -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-integration-tests/src/test/resources/working-directory/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/working-directory/pom.xml b/surefire-integration-tests/src/test/resources/working-directory/pom.xml deleted file mode 100644 index 1a7b7d7..0000000 --- a/surefire-integration-tests/src/test/resources/working-directory/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>org.apache.maven.plugins.surefire</groupId> - <artifactId>working-directory</artifactId> - <version>1.0-SNAPSHOT</version> - <name>Test for working directory configuration (parent)</name> - <packaging>pom</packaging> - - <properties> - <maven.compiler.source>1.7</maven.compiler.source> - <maven.compiler.target>1.7</maven.compiler.target> - </properties> - - <modules> - <module>child</module> - </modules> - - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - </plugin> - </plugins> - </pluginManagement> - </build> -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml new file mode 100644 index 0000000..e679753 --- /dev/null +++ b/surefire-its/pom.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ 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. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire</artifactId> + <version>2.21.0-SNAPSHOT</version> + </parent> + + <artifactId>surefire-is</artifactId> + + <name>Maven Surefire Integration Tests</name> + <description>Used internally testing MOJOs. The project is not deployed.</description> + + <properties> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-report-parser</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-verifier</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-settings</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.sourceforge.htmlunit</groupId> + <artifactId>htmlunit</artifactId> + <version>2.8</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-artifact</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + <dependency> + <!-- Java 9 requires version 3.6+ (todo use in parent POM. Note: versions 3.6, 3.7 are compiled with Java 7) --> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.7</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <test>*Test</test> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> + <configuration> + <jvm>${jdk.home}/bin/java</jvm> + <runOrder>alphabetical</runOrder> + <threadCount>1</threadCount> + <perCoreThreadCount>false</perCoreThreadCount> + <forkMode>once</forkMode> + <argLine>-server -Xmx64m -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Djava.awt.headless=true</argLine> + <includes> + <include>org/apache/**/*IT*.java</include> + </includes> + <!-- Pass current surefire version to the main suite so that it --> + <!-- can forward to all integration test projects. SUREFIRE-513 --> + <systemPropertyVariables> + <surefire.version>${project.version}</surefire.version> + <maven.home>${maven.home}</maven.home> + <maven.settings.file>${project.basedir}/../surefire-setup-integration-tests/target/private/it-settings.xml + </maven.settings.file> + <maven.toolchains.file>${project.basedir}/../surefire-setup-integration-tests/target/private/toolchains.xml + </maven.toolchains.file> + <maven.repo.local>${project.basedir}/../surefire-setup-integration-tests/target/it-repo</maven.repo.local> + <maven.test.tmpdir>${project.build.directory}</maven.test.tmpdir> + <user.localRepository>${settings.localRepository}</user.localRepository> + <useInterpolatedSettings>false</useInterpolatedSettings> + <testBuildDirectory>${project.build.testOutputDirectory}</testBuildDirectory> + <verifier.forkMode>forked</verifier.forkMode> + <jdk.home>${jdk.home}</jdk.home> + <jacoco.agent>${jacoco-it.agent}</jacoco.agent> + </systemPropertyVariables> + <redirectTestOutputToFile>false</redirectTestOutputToFile> + <useFile>false</useFile> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>require-maven-2.1.0</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <!-- Some plugin features require a recent Maven runtime to work (e.g. SystemPropertiesTest) --> + <version>[2.1.0,)</version> + </requireMavenVersion> + </rules> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <!-- todo dont skip since of failsafe:2.19 internal use if having src/main/java/... --> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>jacoco-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>jacoco-agent-it</id> + <goals> + <goal>prepare-agent-integration</goal> + </goals> + <configuration> + <propertyName>jacoco-it.agent</propertyName> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java new file mode 100644 index 0000000..9a49d1a --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java @@ -0,0 +1,105 @@ +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.MavenLauncher; +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.runners.Parameterized.Parameter; + +/** + * Base test class for SUREFIRE-580, configuration parameter {@code skipAfterFailureCount}. + * + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @since 2.19 + */ +@RunWith( Parameterized.class ) +public abstract class AbstractFailFastIT + extends SurefireJUnit4IntegrationTestCase +{ + @Parameter( 0 ) + public String description; + + @Parameter( 1 ) + public String profile; + + @Parameter( 2 ) + public Map<String, String> properties; + + @Parameter( 3 ) + public int total; + + @Parameter( 4 ) + public int failures; + + @Parameter( 5 ) + public int errors; + + @Parameter( 6 ) + public int skipped; + + protected abstract String withProvider(); + + protected final OutputValidator prepare( String description, String profile, Map<String, String> properties ) + { + MavenLauncher launcher = unpack( "/fail-fast-" + withProvider(), "_" + description ) + .maven(); + + if ( profile != null ) + { + launcher.addGoal( "-P " + profile ); + } + + if ( failures != 0 || errors != 0 ) + { + launcher.withFailure(); + } + + return launcher.sysProp( properties ).executeTest(); + } + + protected final OutputValidator prepare( String description, Map<String, String> properties ) + { + return prepare( description, null, properties ); + } + + protected static Map<String, String> props( int forkCount, int skipAfterFailureCount, boolean reuseForks ) + { + Map<String, String> props = new HashMap<String, String>( 3 ); + props.put( "surefire.skipAfterFailureCount", "" + skipAfterFailureCount ); + props.put( "forkCount", "" + forkCount ); + props.put( "reuseForks", "" + reuseForks ); + return props; + } + + @Test + public void test() + { + prepare( description, profile, properties ) + .assertTestSuiteResults( total, errors, failures, skipped ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java new file mode 100644 index 0000000..7f73d48 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractJigsawIT.java @@ -0,0 +1,111 @@ +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 java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.StringTokenizer; + +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.junit.Assert.fail; +import static org.junit.Assume.assumeTrue; + +/** + * Abstract test class for Jigsaw tests. + * + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @since 2.20.1 + */ +public abstract class AbstractJigsawIT + extends SurefireJUnit4IntegrationTestCase +{ + private static final double JIGSAW_JAVA_VERSION = 9.0d; + + protected abstract String getProjectDirectoryName(); + + protected SurefireLauncher assumeJigsaw() throws IOException + { + assumeTrue( "There's no JDK 9 provided.", + isJavaVersion9AtLeast() || EXT_JDK_HOME != null && isExtJavaVerion9AtLeast() ); + // fail( EXT_JDK_HOME_KEY + " was provided with value " + EXT_JDK_HOME + " but it is not Jigsaw Java 9." ); + + SurefireLauncher launcher = unpack(); + + return EXT_JDK_HOME == null ? launcher : launcher.setLauncherJavaHome( EXT_JDK_HOME ); + } + + protected SurefireLauncher assumeJava9Property() throws IOException + { + assumeTrue( "There's no JDK 9 provided.", EXT_JDK_HOME != null && isExtJavaVerion9AtLeast() ); + return unpack(); + } + + private SurefireLauncher unpack() + { + return unpack( getProjectDirectoryName() ); + } + + private static boolean isJavaVersion9AtLeast() + { + return Double.valueOf( System.getProperty( "java.specification.version" ) ) >= JIGSAW_JAVA_VERSION; + } + + private static boolean isExtJavaVerion9AtLeast() throws IOException + { + File release = new File( EXT_JDK_HOME, "release" ); + + if ( !release.isFile() ) + { + fail( EXT_JDK_HOME_KEY + " was provided with value " + EXT_JDK_HOME + " but file does not exist " + + EXT_JDK_HOME + File.separator + "release" + ); + } + + Properties properties = new Properties(); + try ( InputStream is = new FileInputStream( release ) ) + { + properties.load( is ); + } + String javaVersion = properties.getProperty( "JAVA_VERSION" ).replace( "\"", "" ); + StringTokenizer versions = new StringTokenizer( javaVersion, "._" ); + + if ( versions.countTokens() == 1 ) + { + javaVersion = versions.nextToken(); + } + else if ( versions.countTokens() >= 2 ) + { + javaVersion = versions.nextToken() + "." + versions.nextToken(); + } + else + { + fail( "unexpected java version format" ); + } + + return Double.valueOf( javaVersion ) >= JIGSAW_JAVA_VERSION; + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseIT.java new file mode 100644 index 0000000..0260ba0 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestCaseIT.java @@ -0,0 +1,41 @@ +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 files with "Abstract" in their name that aren't really abstract, + * and abstract classes that don't say "Abstract" in their name + * + * @author <a href="mailto:dfabul...@apache.org">Dan Fabulich</a> + * @author <a href="mailto:krosenv...@apache.org">Kristian Rosenvold</a> + */ +public class AbstractTestCaseIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void abstractTestCase() + { + unpack( "/default-configuration-abstract" ).executeTest().verifyErrorFree( 1 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestMultipleMethodPatterns.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestMultipleMethodPatterns.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestMultipleMethodPatterns.java new file mode 100644 index 0000000..01932fa --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractTestMultipleMethodPatterns.java @@ -0,0 +1,483 @@ +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.Settings; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +import static org.apache.maven.surefire.its.fixture.TestFramework.*; +import static org.apache.maven.surefire.its.fixture.Configuration.*; +import static org.hamcrest.core.AnyOf.anyOf; +import static org.hamcrest.core.Is.is; +import static org.junit.Assume.assumeThat; + +/** + * Test project using multiple method patterns, including wildcards in class and method names. + */ +public abstract class AbstractTestMultipleMethodPatterns + extends SurefireJUnit4IntegrationTestCase +{ + private static final String CSV_DELIMITER_SHORT = ","; + private static final String CSV_DELIMITER_LONG = ", "; + private static final String NOT_DELIMITER = "!"; + + protected abstract Settings getSettings(); + + protected abstract SurefireLauncher unpack(); + + protected SurefireLauncher prepare( String tests ) + { + SurefireLauncher launcher = unpack().addGoal( "-P " + getSettings().profile() ); + String[] includedExcluded = splitIncludesExcludes( tests ); + switch ( getSettings().getConfiguration() ) { + case TEST: + launcher.setTestToRun( tests ); + break; + case INCLUDES: + launcher.sysProp( "included", tests ); + break; + case INCLUDES_EXCLUDES: + launcher.sysProp( "included", includedExcluded[0] ); + launcher.sysProp( "excluded", includedExcluded[1] ); + break; + default: + throw new IllegalArgumentException( "Unsupported configuration " + getSettings().getConfiguration() ); + } + return launcher; + } + + private static String[] splitIncludesExcludes( String patterns ) + { + String included = ""; + String excluded = ""; + for ( String pattern : patterns.split( CSV_DELIMITER_SHORT ) ) + { + pattern = pattern.trim(); + if ( pattern.startsWith( NOT_DELIMITER ) ) + { + excluded += pattern.substring( NOT_DELIMITER.length() ).trim(); + excluded += CSV_DELIMITER_LONG; + } + else + { + included += pattern; + included += CSV_DELIMITER_LONG; + } + } + return new String[]{ trimEndComma( included ), trimEndComma( excluded ) }; + } + + private static String trimEndComma( String pattern ) + { + pattern = pattern.trim(); + return pattern.endsWith( CSV_DELIMITER_LONG ) + ? pattern.substring( 0, pattern.length() - CSV_DELIMITER_LONG.length() ) : pattern; + } + + @Test + public void simpleNameTest() + throws Exception + { + prepare( "TestTwo" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void simpleNameTestAsParallel() + throws Exception + { + assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) ); + prepare( "TestTwo" ) + .parallel( "classes" ) + .useUnlimitedThreads() + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void simpleNameTestWithJavaExt() + throws Exception + { + prepare( "TestTwo.java" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void simpleNameTestWithWildcardPkg() + throws Exception + { + prepare( "**/TestTwo" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void simpleNameTestWithJavaExtWildcardPkg() + throws Exception + { + prepare( "**/TestTwo.java" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void fullyQualifiedTest() + throws Exception + { + prepare( "jiras/surefire745/TestTwo.java" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void shouldMatchSimpleClassNameAndMethod() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "BasicTest#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + /** + * This method name was shorten because it cause 261 character long path on Windows with Jenkins Pipeline. + */ + @Test + public void matchSimpleClassAndMethodWithJavaExt() + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "BasicTest.java#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + /** + * This method name was shorten because it cause 261 character long path on Windows with Jenkins Pipeline. + */ + @Test + public void matchSimpleClassAndMethodWithWildcardPkg() + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "**/BasicTest#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + /** + * This method name was shorten because it cause 261 character long path on Windows with Jenkins Pipeline. + */ + @Test + public void matchSimpleClassAndMethodWithJavaExtWildcardPkg() + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "**/BasicTest.java#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + @Test + public void shouldMatchWildcardPackageAndClassAndMethod() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "jiras/**/BasicTest#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + @Test + public void regexClass() + throws Exception + { + prepare( "%regex[.*.TestTwo.*]" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestTwo#testSuccessTwo" ); + } + + @Test + public void testSuccessTwo() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "#testSuccessTwo" ) + .maven().debugLogging() + .executeTest() + .verifyErrorFree( 5 ) + .verifyErrorFreeLog(); + } + + @Test + public void testRegexSuccessTwo() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "%regex[#testSuccessTwo]" ) + .executeTest() + .verifyErrorFree( 5 ) + .verifyErrorFreeLog(); + } + + @Test + public void regexClassAndMethod() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "%regex[.*.BasicTest.*#testSuccessTwo]" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + @Test + public void shouldMatchExactClassAndMethodWildcard() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "BasicTest#test*One" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessOne" ); + } + + @Test + public void shouldMatchExactClassAndMethodsWildcard() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "BasicTest#testSuccess*" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessTwo" ); + } + + @Test + public void shouldMatchExactClassAndMethodCharacters() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "BasicTest#test???????One" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.BasicTest#testSuccessOne" ); + } + + @Test + public void shouldMatchExactClassAndMethodsPostfix() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "TestFive#testSuccess???" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestFive#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestFive#testSuccessTwo" ); + } + + @Test + public void shouldMatchExactClassAndMethodPostfix() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "TestFive#testSuccess?????" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestFive#testSuccessThree" ); + } + + @Test + public void shouldMatchExactClassAndMultipleMethods() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "TestFive#testSuccessOne+testSuccessThree" ) + .executeTest() + .verifyErrorFree( 2 ) + .verifyErrorFreeLog() + .verifyTextInLog( "jiras.surefire745.TestFive#testSuccessOne" ) + .verifyTextInLog( "jiras.surefire745.TestFive#testSuccessThree" ); + } + + @Test + public void shouldMatchMultiplePatterns() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + String test = "jiras/surefire745/BasicTest#testSuccessOne+testSuccessTwo"//2 + + ',' + "jiras/**/TestTwo"//2 + + ',' + "jiras/surefire745/TestThree#testSuccess*"//2 + + ',' + "TestFour#testSuccess???"//2 + + ',' + "jiras/surefire745/*Five#test*One";//1 + + prepare( test ) + .executeTest() + .verifyErrorFree( 9 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldMatchMultiplePatternsAsParallel() + throws Exception + { + assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) ); + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + String test = "jiras/surefire745/BasicTest#testSuccessOne+testSuccessTwo"//2 + + ',' + "jiras/**/TestTwo"//2 + + ',' + "jiras/surefire745/TestThree#testSuccess*"//2 + + ',' + "TestFour#testSuccess???"//2 + + ',' + "jiras/surefire745/*Five#test*One";//1 + + prepare( test ) + .parallel( "classes" ) + .useUnlimitedThreads() + .executeTest() + .verifyErrorFree( 9 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldMatchMultiplePatternsComplex() + throws Exception + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + String test = "**/BasicTest#testSuccessOne+testSuccessTwo"//2 + + ',' + "jiras/**/TestTwo"//2 + + ',' + "?????/surefire745/TestThree#testSuccess*"//2 + + ',' + "jiras/surefire745/TestFour.java#testSuccess???"//2 + + ',' + "jiras/surefire745/*Five#test*One";//1 + + prepare( test ) + .executeTest() + .verifyErrorFree( 9 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldMatchMultiplePatternsComplexAsParallel() + throws Exception + { + assumeThat( getSettings().getFramework(), anyOf( is( JUNIT47 ), is( TestNG ) ) ); + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + String test = "**/BasicTest#testSuccessOne+testSuccessTwo"//2 + + ',' + "jiras/**/TestTwo"//2 + + ',' + "?????/surefire745/TestThree#testSuccess*"//2 + + ',' + "jiras/surefire745/TestFour.java#testSuccess???"//2 + + ',' + "jiras/surefire745/*Five#test*One";//1 + + prepare( test ) + .parallel( "classes" ) + .useUnlimitedThreads() + .executeTest() + .verifyErrorFree( 9 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldNotRunExcludedClasses() + { + prepare( "!BasicTest, !**/TestTwo, !**/TestThree.java" ) + .executeTest() + .verifyErrorFree( 6 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldNotRunExcludedClassesIfIncluded() + { + prepare( "TestF*.java, !**/TestFour.java" ) + .executeTest() + .verifyErrorFree( 3 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldNotRunExcludedMethods() + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "!#*Fail*, !%regex[#.*One], !#testSuccessThree" ) + .executeTest() + .verifyErrorFree( 5 ) + .verifyErrorFreeLog(); + } + + @Test + public void shouldNotRunExcludedClassesAndMethods() + { + assumeThat( getSettings().getConfiguration(), is( TEST ) ); + prepare( "!#*Fail*, !TestFour#testSuccessTwo" ) + .executeTest() + .verifyErrorFree( 11 ) + .verifyErrorFreeLog(); + } + + @Test + public void negativeTest() + { + assumeThat( getSettings().getConfiguration(), anyOf( is( INCLUDES ), is( INCLUDES_EXCLUDES ), + is( INCLUDES_FILE ), is( INCLUDES_EXCLUDES_FILE ) ) ); + String pattern = "TestFive#testSuccessOne+testSuccessThree"; + prepare( pattern ) + .failNever() + .executeTest() + .verifyTextInLog( "Method filter prohibited in includes|excludes|includesFile|excludesFile parameter: " + + pattern ); + } +}