http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java new file mode 100644 index 0000000..7497816 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test1.java @@ -0,0 +1,67 @@ +package forkMode; + +/* + * 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.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.Random; + +import junit.framework.TestCase; + +public class Test1 + extends TestCase +{ + + private static final Random RANDOM = new Random(); + + public void test1() + throws IOException, InterruptedException + { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" )); + Thread.sleep(sleepLength); + dumpPidFile( this ); + } + + public static void dumpPidFile( TestCase test ) + throws IOException + { + String fileName = test.getName() + "-pid"; + File target = new File( "target" ).getCanonicalFile(); // getCanonicalFile required for embedded mode + if ( !( target.exists() && target.isDirectory() ) ) + { + target = new File( "." ); + } + File pidFile = new File( target, fileName ); + FileWriter fw = new FileWriter( pidFile ); + // DGF little known trick... this is guaranteed to be unique to the PID + // In fact, it usually contains the pid and the local host name! + String pid = ManagementFactory.getRuntimeMXBean().getName(); + fw.write( pid ); + fw.write( " " ); + fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) ); + fw.flush(); + fw.close(); + System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() ); + } + + +}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java new file mode 100644 index 0000000..e9d0652 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test2.java @@ -0,0 +1,36 @@ +package forkMode; + +/* + * 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.IOException; + +import junit.framework.TestCase; + +public class Test2 + extends TestCase +{ + + public void test2() throws IOException, InterruptedException { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "1500" )); + Thread.sleep(sleepLength); + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java new file mode 100644 index 0000000..c8eef74 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/module-b/src/test/java/forkMode/Test3.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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.IOException; + +import junit.framework.TestCase; + +public class Test3 + extends TestCase +{ + + public void test3() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml b/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml new file mode 100644 index 0000000..e0786b1 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-multimodule/pom.xml @@ -0,0 +1,66 @@ +<?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>fork-mode-multimodule</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for forkMode Multimodule</name> + + <packaging>pom</packaging> + + <properties> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <modules> + <module>module-a</module> + <module>module-b</module> + </modules> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>${forkMode}</forkMode> + <threadCount>${threadCount}</threadCount> + <runOrder>alphabetical</runOrder> + </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-its/src/test/resources/fork-mode-resource-loading/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml b/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml new file mode 100644 index 0000000..e40033c --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-resource-loading/pom.xml @@ -0,0 +1,54 @@ +<?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>fork-mode-resource-loading</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for forkMode</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> + </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-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java b/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java new file mode 100644 index 0000000..e2c3d51 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/java/forkMode/ResourceLoadTest.java @@ -0,0 +1,46 @@ +package forkMode; + +/* + * 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.IOException; +import java.io.InputStream; +import java.net.URL; + +public class ResourceLoadTest + extends TestCase +{ + + public void testGetResourceUrl() throws IOException { + final URL resource = this.getClass().getClassLoader().getResource( "myFile.txt" ); + assertNotNull( resource ); + } + + public void testGetResource() throws IOException { + final InputStream resource = this.getClass().getClassLoader().getResourceAsStream( "myFile.txt" ); + assertNotNull( resource ); + } + + public void testGetResourceThreadLoader() throws IOException { + final InputStream resource = Thread.currentThread().getContextClassLoader().getResourceAsStream( "myFile.txt" ); + assertNotNull( resource ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt b/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt new file mode 100644 index 0000000..51f466f --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-resource-loading/src/test/resources/myFile.txt @@ -0,0 +1 @@ +A file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-testng/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-testng/pom.xml b/surefire-its/src/test/resources/fork-mode-testng/pom.xml new file mode 100644 index 0000000..8e25749 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-testng/pom.xml @@ -0,0 +1,50 @@ +<?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>fork-mode-testng</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for forkMode</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> + <forkMode>${forkMode}</forkMode> + <threadCount>${threadCount}</threadCount> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <version>5.7</version> + <classifier>jdk15</classifier> + <scope>test</scope> + <exclusions> + <exclusion> + <!-- NOTE: Deliberately excluding junit to enforce TestNG only tests, cf. SUREFIRE-642 --> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java new file mode 100644 index 0000000..8caec4e --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test1.java @@ -0,0 +1,65 @@ +package forkMode; + +/* + * 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.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.Random; + +import org.testng.annotations.Test; + +public class Test1 +{ + + private static final Random RANDOM = new Random(); + + @Test + public void test1() + throws IOException, InterruptedException + { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" )); + Thread.sleep(sleepLength); + dumpPidFile( "test1" ); + } + + public static void dumpPidFile( String name ) + throws IOException + { + String fileName = name + "-pid"; + File target = new File( "target" ).getCanonicalFile(); + if ( !( target.exists() && target.isDirectory() ) ) + { + target = new File( "." ); + } + File pidFile = new File( target, fileName ); + FileWriter fw = new FileWriter( pidFile ); + // DGF little known trick... this is guaranteed to be unique to the PID + // In fact, it usually contains the pid and the local host name! + String pid = ManagementFactory.getRuntimeMXBean().getName(); + fw.write( pid ); + fw.write( " " ); + fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) ); + fw.flush(); + fw.close(); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java new file mode 100644 index 0000000..d7e8be9 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test2.java @@ -0,0 +1,33 @@ +package forkMode; + +/* + * 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.IOException; + +import org.testng.annotations.Test; + +public class Test2 +{ + @Test + public void test2() throws IOException { + Test1.dumpPidFile( "test2" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java new file mode 100644 index 0000000..e52f2b7 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode-testng/src/test/java/forkMode/Test3.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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.IOException; + +import org.testng.annotations.Test; + +public class Test3 +{ + + @Test + public void test3() throws IOException { + Test1.dumpPidFile( "test3" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode/pom.xml b/surefire-its/src/test/resources/fork-mode/pom.xml new file mode 100644 index 0000000..28bfb4d --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode/pom.xml @@ -0,0 +1,59 @@ +<?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>fork-mode</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for forkMode</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> + <forkMode>${forkMode}</forkMode> + <threadCount>${threadCount}</threadCount> + <runOrder>alphabetical</runOrder> + </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-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java new file mode 100644 index 0000000..980123c --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test1.java @@ -0,0 +1,67 @@ +package forkMode; + +/* + * 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.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.Random; + +import junit.framework.TestCase; + +public class Test1 + extends TestCase +{ + + private static final Random RANDOM = new Random(); + + public void test1() + throws IOException, InterruptedException + { + int sleepLength = Integer.valueOf( System.getProperty( "sleepLength", "750" )); + Thread.sleep(sleepLength); + dumpPidFile( this ); + } + + public static void dumpPidFile( TestCase test ) + throws IOException + { + String fileName = test.getName() + "-pid"; + File target = new File( "target" ).getCanonicalFile(); // getCanonicalFile required for embedded mode + if ( !( target.exists() && target.isDirectory() ) ) + { + target = new File( "." ); + } + File pidFile = new File( target, fileName ); + FileWriter fw = new FileWriter( pidFile ); + // DGF little known trick... this is guaranteed to be unique to the PID + // In fact, it usually contains the pid and the local host name! + String pid = ManagementFactory.getRuntimeMXBean().getName(); + fw.write( pid ); + fw.write( " " ); + fw.write( System.getProperty( "testProperty", String.valueOf( RANDOM.nextLong() ) ) ); + fw.flush(); + fw.close(); + System.out.println( "Done Writing pid file" + pidFile.getAbsolutePath() ); + } + + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java new file mode 100644 index 0000000..33d3cf1 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test2.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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.IOException; + +import junit.framework.TestCase; + +public class Test2 + extends TestCase +{ + + public void test2() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java new file mode 100644 index 0000000..c8eef74 --- /dev/null +++ b/surefire-its/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java @@ -0,0 +1,34 @@ +package forkMode; + +/* + * 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.IOException; + +import junit.framework.TestCase; + +public class Test3 + extends TestCase +{ + + public void test3() throws IOException { + Test1.dumpPidFile(this); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/pom.xml b/surefire-its/src/test/resources/fork-timeout/pom.xml new file mode 100644 index 0000000..25365a2 --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/pom.xml @@ -0,0 +1,47 @@ +<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>fork-timeout-test</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>fork-timeout</name> + <url>http://maven.apache.org</url> + <properties> + <junit.version>4.8.1</junit.version> + <junit.parallel>classes</junit.parallel> + <forkMode>once</forkMode> + <timeOut>1</timeOut> + <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>${junit.version}</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>${forkMode}</forkMode> + <parallel>${junit.parallel}</parallel> + <threadCount>3</threadCount> + <perCoreThreadCount>false</perCoreThreadCount> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <forkedProcessTimeoutInSeconds>${timeOut}</forkedProcessTimeoutInSeconds> + <reportFormat>plain</reportFormat> + <useFile>true</useFile> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/BaseForkTimeout.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/BaseForkTimeout.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/BaseForkTimeout.java new file mode 100644 index 0000000..a2dc6cb --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/BaseForkTimeout.java @@ -0,0 +1,53 @@ +package forktimeout; + +/* + * 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 abstract class BaseForkTimeout +{ + protected void dumpStuff( String prefix ) + { + reallySleep( 990 ); + for ( int i = 0; i < 200; i++ ) + { + System.out.println( prefix + " with lots of output " + i ); + System.err.println( prefix + "e with lots of output " + i ); + } + System.out.println( prefix + "last line" ); + System.err.println( prefix + "e last line" ); + } + + private void reallySleep( long timeout ) + { + long endAt = System.currentTimeMillis() + timeout; + try + { + Thread.sleep( timeout ); + while ( System.currentTimeMillis() < endAt ) + { + Thread.yield(); + Thread.sleep( 5 ); + } + } + catch ( InterruptedException e ) + { + throw new RuntimeException( e ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test1.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test1.java new file mode 100644 index 0000000..d176fce --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test1.java @@ -0,0 +1,34 @@ +package forktimeout; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +public class Test1 + extends BaseForkTimeout +{ + @Test + public void test690() + { + dumpStuff( "test690" ); + System.out.println( " with lots of output " ); + System.err.println( "e with lots of output " ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test2.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test2.java new file mode 100644 index 0000000..25b0ecd --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test2.java @@ -0,0 +1,30 @@ +package forktimeout; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import org.junit.Test; + +public class Test2 extends BaseForkTimeout +{ + @Test + public void test690_2() { + dumpStuff( "test690_2" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test3.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test3.java new file mode 100644 index 0000000..b618bdb --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test3.java @@ -0,0 +1,32 @@ +package forktimeout; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import org.junit.Test; + +public class Test3 extends BaseForkTimeout +{ + + @Test + public void test690_3() { + dumpStuff( "test690_3" ); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test4.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test4.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test4.java new file mode 100644 index 0000000..4582c65 --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test4.java @@ -0,0 +1,32 @@ +package forktimeout; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import org.junit.Test; + +public class Test4 + extends BaseForkTimeout +{ + @Test + public void test690_4() { + dumpStuff( "test690_4" ); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test5.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test5.java b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test5.java new file mode 100644 index 0000000..886385d --- /dev/null +++ b/surefire-its/src/test/resources/fork-timeout/src/test/java/forktimeout/Test5.java @@ -0,0 +1,32 @@ +package forktimeout; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import org.junit.Test; + +public class Test5 + extends BaseForkTimeout +{ + @Test + public void test690_5() { + dumpStuff( "test690_5" ); + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/common-excludes.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/common-excludes.txt b/surefire-its/src/test/resources/includes-excludes-from-file/common-excludes.txt new file mode 100644 index 0000000..483aae3 --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/common-excludes.txt @@ -0,0 +1,3 @@ +# common excludes + +**/DontRunTest.* \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/path-includes.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/path-includes.txt b/surefire-its/src/test/resources/includes-excludes-from-file/path-includes.txt new file mode 100644 index 0000000..cedff2a --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/path-includes.txt @@ -0,0 +1,3 @@ +# path includes + +*/test/* http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml b/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml new file mode 100644 index 0000000..39313db --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/pom.xml @@ -0,0 +1,153 @@ +<?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> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>maven-it-includes-excludes</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>Maven Integration Test :: includes-excludes-from-file</name> + <description>Test surefire inclusion/exclusions from files</description> + + <properties> + <junit.version>3.8.2</junit.version> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <artifactId>junit</artifactId> + <groupId>junit</groupId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + </plugin> + </plugins> + </pluginManagement> + </build> + + <profiles> + <profile> + <id>simple</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/common-excludes.txt</excludesFile> + <includesFile>${project.basedir}/simple-includes.txt</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>simple-mixed</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/common-excludes.txt</excludesFile> + <includes> + <include>**/NotIncludedByDefault.java</include> + </includes> + <includesFile>${project.basedir}/simple-mixed-includes.txt</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>regex</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/common-excludes.txt</excludesFile> + <includesFile>${project.basedir}/regex-includes.txt</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>path</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/common-excludes.txt</excludesFile> + <includesFile>${project.basedir}/path-includes.txt</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>missing-excludes-file</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/no-such-excludes-file</excludesFile> + <includesFile>${project.basedir}/simple-includes.txt</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + <profile> + <id>missing-includes-file</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludesFile>${project.basedir}/common-excludes.txt</excludesFile> + <includesFile>${project.basedir}/no-such-includes-file</includesFile> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/regex-includes.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/regex-includes.txt b/surefire-its/src/test/resources/includes-excludes-from-file/regex-includes.txt new file mode 100644 index 0000000..fcf6f9e --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/regex-includes.txt @@ -0,0 +1,3 @@ +# regex includes + +%regex[.*Test.*|.*Not.*] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/simple-includes.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/simple-includes.txt b/surefire-its/src/test/resources/includes-excludes-from-file/simple-includes.txt new file mode 100644 index 0000000..d2b1d12 --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/simple-includes.txt @@ -0,0 +1,4 @@ +# simple includes + +**/NotIncludedByDefault.java +**/*Test.java \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/simple-mixed-includes.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/simple-mixed-includes.txt b/surefire-its/src/test/resources/includes-excludes-from-file/simple-mixed-includes.txt new file mode 100644 index 0000000..68a1d5c --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/simple-mixed-includes.txt @@ -0,0 +1,3 @@ +# simple-mixed includes + +**/*Test.java \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java new file mode 100644 index 0000000..be6a6bb --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DefaultTest.java @@ -0,0 +1,34 @@ +package org.test; + +/* + * 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.FileOutputStream; + +public class DefaultTest +{ + public void testRun() + throws Exception + { + FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" ); + fout.write( '!' ); + fout.flush(); + fout.close(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DontRunTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DontRunTest.java b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DontRunTest.java new file mode 100644 index 0000000..0cce390 --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/DontRunTest.java @@ -0,0 +1,30 @@ +package org.test; + +/* + * 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 DontRunTest extends TestCase +{ + public void testRun() + { + assertEquals(true, false); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java new file mode 100644 index 0000000..58b962a --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/NotIncludedByDefault.java @@ -0,0 +1,34 @@ +package org.test; + +/* + * 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.FileOutputStream; + +public class NotIncludedByDefault +{ + public void testRun() + throws Exception + { + FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" ); + fout.write( '!' ); + fout.flush(); + fout.close(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/aTestXmlFile.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/aTestXmlFile.xml b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/aTestXmlFile.xml new file mode 100644 index 0000000..17f382f --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes-from-file/src/test/java/org/test/aTestXmlFile.xml @@ -0,0 +1,24 @@ +<?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> + <foo/> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes/pom.xml b/surefire-its/src/test/resources/includes-excludes/pom.xml new file mode 100644 index 0000000..77711f7 --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes/pom.xml @@ -0,0 +1,135 @@ +<?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> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>maven-it-includes-excludes</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>Maven Integration Test :: includes-excludes</name> + <description>Test surefire inclusion/exclusions</description> + + <properties> + <junit.version>3.8.2</junit.version> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <artifactId>junit</artifactId> + <groupId>junit</groupId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + </plugin> + </plugins> + </pluginManagement> + </build> + <profiles> + <profile> + <id>simple</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/DontRunTest.*</exclude> + <exclude></exclude> + <exclude /> + </excludes> + <includes> + <include>**/NotIncludedByDefault.java</include> + <include>**/*Test.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>regex</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/DontRunTest.*</exclude> + </excludes> + <includes> + <include>%regex[.*Test.*|.*Not.*]</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>path</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/DontRunTest.java</exclude> + </excludes> + <includes> + <include>*/test/*</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>withXmlFile</id> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/DontRunTest.java</exclude> + </excludes> + <includes> + <include>**/*.xml</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + </profile> + + </profiles> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java new file mode 100644 index 0000000..be6a6bb --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DefaultTest.java @@ -0,0 +1,34 @@ +package org.test; + +/* + * 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.FileOutputStream; + +public class DefaultTest +{ + public void testRun() + throws Exception + { + FileOutputStream fout = new FileOutputStream( "target/defaultTestTouchFile.txt" ); + fout.write( '!' ); + fout.flush(); + fout.close(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DontRunTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DontRunTest.java b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DontRunTest.java new file mode 100644 index 0000000..0cce390 --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/DontRunTest.java @@ -0,0 +1,30 @@ +package org.test; + +/* + * 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 DontRunTest extends TestCase +{ + public void testRun() + { + assertEquals(true, false); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java new file mode 100644 index 0000000..58b962a --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/NotIncludedByDefault.java @@ -0,0 +1,34 @@ +package org.test; + +/* + * 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.FileOutputStream; + +public class NotIncludedByDefault +{ + public void testRun() + throws Exception + { + FileOutputStream fout = new FileOutputStream( "target/testTouchFile.txt" ); + fout.write( '!' ); + fout.flush(); + fout.close(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/aTestXmlFile.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/aTestXmlFile.xml b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/aTestXmlFile.xml new file mode 100644 index 0000000..17f382f --- /dev/null +++ b/surefire-its/src/test/resources/includes-excludes/src/test/java/org/test/aTestXmlFile.xml @@ -0,0 +1,24 @@ +<?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> + <foo/> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/isolated-classloader/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/isolated-classloader/pom.xml b/surefire-its/src/test/resources/isolated-classloader/pom.xml new file mode 100644 index 0000000..a853063 --- /dev/null +++ b/surefire-its/src/test/resources/isolated-classloader/pom.xml @@ -0,0 +1,56 @@ +<?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>isolated-classloader</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for useSystemClassLoader=false</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> + <useSystemClassLoader>false</useSystemClassLoader> + </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-its/src/test/resources/isolated-classloader/src/test/java/isolatedClassloader/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/isolated-classloader/src/test/java/isolatedClassloader/BasicTest.java b/surefire-its/src/test/resources/isolated-classloader/src/test/java/isolatedClassloader/BasicTest.java new file mode 100644 index 0000000..f293734 --- /dev/null +++ b/surefire-its/src/test/resources/isolated-classloader/src/test/java/isolatedClassloader/BasicTest.java @@ -0,0 +1,86 @@ +package isolatedClassloader; + +/* + * 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 +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + public BasicTest( String name, String extraName ) + { + super( name ); + } + + public static Test suite() + { + TestSuite suite = new TestSuite(); + Test test = new BasicTest( "testSetUp", "dummy" ); + 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-its/src/test/resources/java9-full-api/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/java9-full-api/pom.xml b/surefire-its/src/test/resources/java9-full-api/pom.xml new file mode 100644 index 0000000..2e4d4f3 --- /dev/null +++ b/surefire-its/src/test/resources/java9-full-api/pom.xml @@ -0,0 +1,132 @@ +<?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> + + <artifactId>java9-full-api</artifactId> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>once</forkMode> + </configuration> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + <configuration> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>javax.transaction</groupId> + <artifactId>javax.transaction-api</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>javax.xml.ws</groupId> + <artifactId>jaxws-api</artifactId> + <version>2.3.0</version> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.3.0</version> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>use-jvm-config-paramater</id> + <activation> + <property> + <name>jdk.home</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <jvm>${jdk.home}/bin/java</jvm> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>use-toolchains</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-toolchains-plugin</artifactId> + <version>1.1</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>toolchain</goal> + </goals> + </execution> + </executions> + <configuration> + <toolchains> + <jdk> + <version>9</version> + </jdk> + </toolchains> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/java9-full-api/src/test/java/J9IT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/java9-full-api/src/test/java/J9IT.java b/surefire-its/src/test/resources/java9-full-api/src/test/java/J9IT.java new file mode 100644 index 0000000..c74678d --- /dev/null +++ b/surefire-its/src/test/resources/java9-full-api/src/test/java/J9IT.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +public class J9IT +{ + @Test + public void testMiscellaneousAPI() throws java.sql.SQLException + { + System.out.println( "loaded class " + java.sql.SQLException.class.getName() ); + System.out.println( "loaded class " + javax.xml.ws.Holder.class.getName() ); + System.out.println( "loaded class " + javax.xml.bind.JAXBException.class.getName() ); + System.out.println( "loaded class " + javax.transaction.InvalidTransactionException.class.getName() ); + System.out.println( "from classloader " + javax.transaction.InvalidTransactionException.class.getClassLoader() ); + System.out.println( "loaded class " + javax.transaction.TransactionManager.class.getName() ); + System.out.println( "loaded class " + javax.xml.xpath.XPath.class.getName() ); + System.out.println( "java.specification.version=" + System.getProperty( "java.specification.version" ) ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/java9-full-api/src/test/java/J9Test.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/java9-full-api/src/test/java/J9Test.java b/surefire-its/src/test/resources/java9-full-api/src/test/java/J9Test.java new file mode 100644 index 0000000..6fc8536 --- /dev/null +++ b/surefire-its/src/test/resources/java9-full-api/src/test/java/J9Test.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +public class J9Test +{ + @Test + public void testMiscellaneousAPI() throws java.sql.SQLException + { + System.out.println( "loaded class " + java.sql.SQLException.class.getName() ); + System.out.println( "loaded class " + javax.xml.ws.Holder.class.getName() ); + System.out.println( "loaded class " + javax.xml.bind.JAXBException.class.getName() ); + System.out.println( "loaded class " + javax.transaction.InvalidTransactionException.class.getName() ); + System.out.println( "loaded class " + javax.transaction.TransactionManager.class.getName() ); + System.out.println( "loaded class " + javax.xml.xpath.XPath.class.getName() ); + System.out.println( "java.specification.version=" + System.getProperty( "java.specification.version" ) ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml b/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml new file mode 100644 index 0000000..9b86c75 --- /dev/null +++ b/surefire-its/src/test/resources/junit-fork-mode-always/pom.xml @@ -0,0 +1,57 @@ +<?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-fork-mode</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for forkMode</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> + <forkMode>${forkMode}</forkMode> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project>