http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire901MIssingResultfileWhenNoTestsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire901MIssingResultfileWhenNoTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire901MIssingResultfileWhenNoTestsIT.java new file mode 100644 index 0000000..14e278e --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire901MIssingResultfileWhenNoTestsIT.java @@ -0,0 +1,39 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * 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; + +/** + * Failsafe should work with early return when no tests + * s + */ +public class Surefire901MIssingResultfileWhenNoTestsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void failsafeWithNoTests() + { + unpack( "failsafe-notests" ).executeVerify(); + } + +}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java new file mode 100755 index 0000000..8317c52 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire907PerThreadWithoutThreadCountIT.java @@ -0,0 +1,42 @@ +package org.apache.maven.surefire.its.jiras; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; + +import org.junit.Test; + +public class Surefire907PerThreadWithoutThreadCountIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void categoryAB() + { + OutputValidator validator = unpack( "fork-mode" ) + .forkPerThread() + .reuseForks( false ) + .maven() + .withFailure() + .executeTest(); + + validator.verifyTextInLog( "Fork mode perthread requires a thread count" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire920TestFailureIgnoreWithTimeoutIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire920TestFailureIgnoreWithTimeoutIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire920TestFailureIgnoreWithTimeoutIT.java new file mode 100755 index 0000000..4f60895 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire920TestFailureIgnoreWithTimeoutIT.java @@ -0,0 +1,45 @@ +package org.apache.maven.surefire.its.jiras; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; + +import org.junit.Test; + +public class Surefire920TestFailureIgnoreWithTimeoutIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void timeoutInForkWithBuildFail() + { + OutputValidator validator = + unpack( "fork-timeout" ).sysProp( "junit.parallel", "none" ).maven().withFailure().executeTest(); + validator.verifyTextInLog( "There was a timeout or other error in the fork" ); + } + + @Test + public void timeoutInForkWithNoBuildFail() + { + OutputValidator validator = + unpack( "fork-timeout" ).sysProp( "junit.parallel", "none" ).mavenTestFailureIgnore( true ).executeTest(); + validator.verifyTextInLog( "[ERROR] There was a timeout or other error in the fork" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire926FailureWith2ProvidersIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire926FailureWith2ProvidersIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire926FailureWith2ProvidersIT.java new file mode 100644 index 0000000..e6f9dc6 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire926FailureWith2ProvidersIT.java @@ -0,0 +1,36 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class Surefire926FailureWith2ProvidersIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "surefire-926-2-provider-failure" ).maven().withFailure().executeTest(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire930TestNgSuiteXmlIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire930TestNgSuiteXmlIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire930TestNgSuiteXmlIT.java new file mode 100644 index 0000000..5963662 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire930TestNgSuiteXmlIT.java @@ -0,0 +1,37 @@ +package org.apache.maven.surefire.its.jiras; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; + +import org.junit.Test; + +public class Surefire930TestNgSuiteXmlIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void suiteXmlRun() + { + unpack( + "surefire-930-failsafe-runtests" ).maven().withFailure().executeVerify().assertIntegrationTestSuiteResults( + 1, 0, 1, 0 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java new file mode 100644 index 0000000..59d2170 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire943ReportContentIT.java @@ -0,0 +1,159 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * 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.FileNotFoundException; + +import org.apache.maven.shared.utils.xml.Xpp3Dom; +import org.apache.maven.shared.utils.xml.Xpp3DomBuilder; +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Assert; +import org.junit.Test; + +public class Surefire943ReportContentIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void test_noParallel() + throws Exception + { + doTest( "none" ); + } + + @Test + public void test_parallelBoth() + throws Exception + { + doTest( "both" ); + } + + private void doTest( String parallelMode ) + throws Exception + { + OutputValidator validator = + unpack( "surefire-943-report-content" ).maven() + .sysProp( "parallel", parallelMode ) + .sysProp( "threadCount", 4 ) + .withFailure().executeTest(); + + validator.assertTestSuiteResults( 10, 1, 3, 3 ); + + validate( validator, "org.sample.module.My1Test", 1 ); + validate( validator, "org.sample.module.My2Test", 1 ); + validate( validator, "org.sample.module.My3Test", 0 ); + validateSkipped( validator, "org.sample.module.My4Test" ); + validateFailInBeforeClass( validator, "org.sample.module.My5Test" ); + } + + private void validateFailInBeforeClass( OutputValidator validator, String className ) + throws FileNotFoundException + { + Xpp3Dom[] children = readTests( validator, className ); + + Assert.assertEquals( 1, children.length ); + + Xpp3Dom child = children[0]; + + Assert.assertEquals( className, child.getAttribute( "classname" ) ); + Assert.assertEquals( className, child.getAttribute( "name" ) ); + + Assert.assertEquals( "Expected error tag for failed BeforeClass method for " + className, 1, + child.getChildren( "error" ).length ); + + Assert.assertTrue( "time for test failure in BeforeClass is expected to be positive", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 0.0d ) >= 0 ); + + Assert.assertTrue( "time for test failure in BeforeClass is expected to be resonably low", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 2.0d ) <= 0 ); + + } + + private void validateSkipped( OutputValidator validator, String className ) + throws FileNotFoundException + { + Xpp3Dom[] children = readTests( validator, className ); + + Assert.assertEquals( 1, children.length ); + + Xpp3Dom child = children[0]; + + Assert.assertEquals( className, child.getAttribute( "classname" ) ); + Assert.assertEquals( className, child.getAttribute( "name" ) ); + + Assert.assertEquals( "Expected skipped tag for ignored method for " + className, 1, + child.getChildren( "skipped" ).length ); + + Assert.assertTrue( "time for ignored test is expected to be zero", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 0.0d ) == 0 ); + } + + private void validate( OutputValidator validator, String className, int ignored ) + throws FileNotFoundException + { + Xpp3Dom[] children = readTests( validator, className ); + + Assert.assertEquals( 2 + ignored, children.length ); + + for ( Xpp3Dom child : children ) + { + Assert.assertEquals( className, child.getAttribute( "classname" ) ); + + if ( "alwaysSuccessful".equals( child.getAttribute( "name" ) ) ) + { + Assert.assertEquals( "Expected no failures for method alwaysSuccessful for " + className, 0, + child.getChildCount() ); + + Assert.assertTrue( "time for successful test is expected to be positive", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 0.0d ) > 0 ); + } + else if ( child.getAttribute( "name" ).contains( "Ignored" ) ) + { + Assert.assertEquals( "Expected skipped-tag for ignored method for " + className, 1, + child.getChildren( "skipped" ).length ); + + Assert.assertTrue( "time for ignored test is expected to be zero", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 0.0d ) == 0 ); + + } + else + { + Assert.assertEquals( "Expected methods \"alwaysSuccessful\", \"*Ignored\" and \"fails\" in " + + className, "fails", child.getAttribute( "name" ) ); + Assert.assertEquals( "Expected failure description for method \"fails\" in " + className, 1, + child.getChildren( "failure" ).length ); + Assert.assertTrue( "time for failed test is expected to be positive", + Double.compare( Double.parseDouble( child.getAttribute( "time" ) ), 0.0d ) > 0 ); + } + } + } + + private Xpp3Dom[] readTests( OutputValidator validator, String className ) + throws FileNotFoundException + { + Xpp3Dom testResult = + Xpp3DomBuilder.build( validator.getSurefireReportsXmlFile( "TEST-" + className + ".xml" ).getFileInputStream(), + "UTF-8" ); + Xpp3Dom[] children = testResult.getChildren( "testcase" ); + return children; + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java new file mode 100644 index 0000000..ea663ab --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire946KillMainProcessInReusableForkIT.java @@ -0,0 +1,71 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * 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.BeforeClass; +import org.junit.Test; + +public class Surefire946KillMainProcessInReusableForkIT + extends SurefireJUnit4IntegrationTestCase +{ + + // there are 10 test classes that each would wait 2 seconds. + private static final int TEST_SLEEP_TIME = 2000; + + @BeforeClass + public static void installSelfdestructPlugin() + throws Exception + { + unpack( Surefire946KillMainProcessInReusableForkIT.class, "surefire-946-self-destruct-plugin", "plugin" ).executeInstall(); + } + + @Test( timeout = 30000 ) + public void testHalt() + throws Exception + { + doTest( "halt" ); + } + + @Test( timeout = 30000 ) + public void testExit() + throws Exception + { + doTest( "exit" ); + } + + @Test( timeout = 30000 ) + public void testInterrupt() + throws Exception + { + doTest( "interrupt" ); + } + + private void doTest( String method ) + { + unpack( "surefire-946-killMainProcessInReusableFork" ) + .sysProp( "selfdestruct.timeoutInMillis", "5000" ) + .sysProp( "selfdestruct.method", method ) + .sysProp( "testSleepTime", String.valueOf( TEST_SLEEP_TIME ) ) + .addGoal( "org.apache.maven.plugins.surefire:maven-selfdestruct-plugin:selfdestruct" ) + .setForkJvm() + .forkPerThread().threadCount( 1 ).reuseForks( true ).maven().withFailure().executeTest(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire972BizarreNoClassDefIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire972BizarreNoClassDefIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire972BizarreNoClassDefIT.java new file mode 100644 index 0000000..94db9f8 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire972BizarreNoClassDefIT.java @@ -0,0 +1,32 @@ +package org.apache.maven.surefire.its.jiras; + +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.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. + */ +public class Surefire972BizarreNoClassDefIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJunit3ParallelBuildResultCount() + { + unpack( "surefire-972-bizarre-noclassdef" ).maven().withFailure().executeVerify(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java new file mode 100644 index 0000000..0f30dbc --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java @@ -0,0 +1,40 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +public class Surefire975DefaultVMEncodingIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void runWithRussian1251() + throws Exception + { + OutputValidator outputValidator = + unpack( "surefire-975-wrong-encoding" ).setMavenOpts( "-Dfile.encoding=windows-1251" ).executeTest(); + outputValidator.getSurefireReportsXmlFile( "TEST-EncodingInReportTest.xml" ).assertContainsText( + "\u043A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0435" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire979WrongClassLoaderIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire979WrongClassLoaderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire979WrongClassLoaderIT.java new file mode 100644 index 0000000..d648576 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire979WrongClassLoaderIT.java @@ -0,0 +1,39 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +public class Surefire979WrongClassLoaderIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void wrongClassloaderUSedInSmartStacktraceparser() + throws Exception + { + OutputValidator outputValidator = + unpack( "surefire-979-smartStackTrace-wrongClassloader" ).failNever().executeTest(); + outputValidator.verifyTextInLog( "java.lang.NoClassDefFoundError: org/apache/commons/io/input/AutoCloseInputStream" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire985ParameterizedRunnerAndCategoriesIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire985ParameterizedRunnerAndCategoriesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire985ParameterizedRunnerAndCategoriesIT.java new file mode 100644 index 0000000..b86b291 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire985ParameterizedRunnerAndCategoriesIT.java @@ -0,0 +1,68 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * 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.FileNotFoundException; + +import org.apache.maven.shared.utils.xml.Xpp3Dom; +import org.apache.maven.shared.utils.xml.Xpp3DomBuilder; +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.TestFile; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class Surefire985ParameterizedRunnerAndCategoriesIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void test() + throws Exception + { + OutputValidator validator = unpack( "surefire-985-parameterized-and-categories" ).maven().executeTest(); + validator.assertTestSuiteResults( 12, 0, 0, 0 ); + + assertFalse( validator.getSurefireReportsXmlFile( "TEST-sample.parameterized.Parameterized01Test.xml" ).exists() ); + + TestFile reportFile2 = + validator.getSurefireReportsXmlFile( "TEST-sample.parameterized.Parameterized02Test.xml" ); + assertTestCount( reportFile2, 4 ); + + TestFile reportFile3 = + validator.getSurefireReportsXmlFile( "TEST-sample.parameterized.Parameterized03Test.xml" ); + assertTestCount( reportFile3, 8 ); + + } + + private void assertTestCount( TestFile reportFile, int tests ) + throws FileNotFoundException + { + assertTrue( reportFile.exists() ); + + Xpp3Dom testResult = Xpp3DomBuilder.build( reportFile.getFileInputStream(), "UTF-8" ); + Xpp3Dom[] children = testResult.getChildren( "testcase" ); + assertEquals( tests, children.length ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire995CategoryInheritanceIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire995CategoryInheritanceIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire995CategoryInheritanceIT.java new file mode 100644 index 0000000..d776724 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire995CategoryInheritanceIT.java @@ -0,0 +1,90 @@ +package org.apache.maven.surefire.its.jiras; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +/** + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-995">SUREFIRE-995</a> + * @since 2.18.1 + */ +public class Surefire995CategoryInheritanceIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void negativeTestShouldRunAllCategories() + { + unpack() + .setTestToRun( "Special*Test" ) + .executeTest() + .verifyErrorFree( 3 ); + } + + @Test + public void junit411ShouldRunExplicitCategory() + { + unpack() + .addGoal( "-Ppositive-tests" ) + .sysProp( "version.junit", "4.11" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyTextInLog( "CategorizedTest#a" ); + } + + @Test + public void junit411ShouldExcludeExplicitCategory() + { + unpack() + .addGoal( "-Ppositive-tests-excluded-categories" ) + .sysProp( "version.junit", "4.11" ) + .executeTest() + .verifyErrorFree( 2 ); + } + + @Test + public void junit412ShouldRunInheritedCategory() + { + unpack() + .setTestToRun( "Special*Test" ) + .addGoal( "-Ppositive-tests" ) + .executeTest() + .verifyErrorFree( 2 ); + } + + @Test + public void junit412ShouldExcludeInheritedCategory() + { + unpack() + .setTestToRun( "Special*Test" ) + .addGoal( "-Ppositive-tests-excluded-categories" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyTextInLog( "SpecialNonCategoryTest#test" ); + } + + private SurefireLauncher unpack() + { + return unpack( "surefire-995-categoryInheritance" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/SurefireToolchains/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/SurefireToolchains/pom.xml b/surefire-its/src/test/resources/SurefireToolchains/pom.xml new file mode 100644 index 0000000..2d066eb --- /dev/null +++ b/surefire-its/src/test/resources/SurefireToolchains/pom.xml @@ -0,0 +1,72 @@ + +<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>test</groupId> + <artifactId>SurefireToolchains</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>Test :: SurefireToolchains</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <prerequisites> + <maven>2.2.1</maven> + </prerequisites> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-toolchains-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>toolchain</goal> + </goals> + </execution> + </executions> + <configuration> + <toolchains> + <jdk> + <version>1.5</version> + <vendor>sun</vendor> + </jdk> + </toolchains> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/SurefireToolchains/src/main/java/test/surefiretoolchains/App.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/SurefireToolchains/src/main/java/test/surefiretoolchains/App.java b/surefire-its/src/test/resources/SurefireToolchains/src/main/java/test/surefiretoolchains/App.java new file mode 100644 index 0000000..0a56a54 --- /dev/null +++ b/surefire-its/src/test/resources/SurefireToolchains/src/main/java/test/surefiretoolchains/App.java @@ -0,0 +1,29 @@ +package test.surefiretoolchains; + +/* + * 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 final class App +{ + + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/SurefireToolchains/src/test/java/test/surefiretoolchains/AppTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/SurefireToolchains/src/test/java/test/surefiretoolchains/AppTest.java b/surefire-its/src/test/resources/SurefireToolchains/src/test/java/test/surefiretoolchains/AppTest.java new file mode 100644 index 0000000..1c061d0 --- /dev/null +++ b/surefire-its/src/test/resources/SurefireToolchains/src/test/java/test/surefiretoolchains/AppTest.java @@ -0,0 +1,36 @@ +package test.surefiretoolchains; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class AppTest +{ + + @Test + public void testApp() + { + // 1.5.0_19-b02 + assertEquals( "1.5.0_19", System.getProperty( "java.version" ) ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/additional-classpath/extraResource/test.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/additional-classpath/extraResource/test.txt b/surefire-its/src/test/resources/additional-classpath/extraResource/test.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/additional-classpath/extraResource2/test2.txt ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/additional-classpath/extraResource2/test2.txt b/surefire-its/src/test/resources/additional-classpath/extraResource2/test2.txt new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/additional-classpath/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/additional-classpath/pom.xml b/surefire-its/src/test/resources/additional-classpath/pom.xml new file mode 100644 index 0000000..01ce10c --- /dev/null +++ b/surefire-its/src/test/resources/additional-classpath/pom.xml @@ -0,0 +1,65 @@ +<?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>additional-classpath</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for additionalClasspathElements</name> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <additionalClasspathElements> + <additionalClasspathElement>${basedir}/extraResource</additionalClasspathElement> + <additionalClasspathElement>${abc}, ${basedir}/extraResource2</additionalClasspathElement> + <!-- SUREFIRE-694 --> + <additionalClasspathElement></additionalClasspathElement> + <!-- SUREFIRE-694 --> + </additionalClasspathElements> + </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/additional-classpath/src/test/java/additionalClasspath/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/additional-classpath/src/test/java/additionalClasspath/BasicTest.java b/surefire-its/src/test/resources/additional-classpath/src/test/java/additionalClasspath/BasicTest.java new file mode 100644 index 0000000..43826b8 --- /dev/null +++ b/surefire-its/src/test/resources/additional-classpath/src/test/java/additionalClasspath/BasicTest.java @@ -0,0 +1,34 @@ +package additionalClasspath; + +/* + * 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 BasicTest + extends TestCase +{ + + public void testExtraResource() + { + assertNotNull( BasicTest.class.getResourceAsStream( "/test.txt" ) ); + assertNotNull( BasicTest.class.getResourceAsStream( "/test2.txt" ) ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/aggregate-report/child1/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/aggregate-report/child1/pom.xml b/surefire-its/src/test/resources/aggregate-report/child1/pom.xml new file mode 100644 index 0000000..9897a25 --- /dev/null +++ b/surefire-its/src/test/resources/aggregate-report/child1/pom.xml @@ -0,0 +1,52 @@ +<?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>aggregate-report</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>aggregate-child1</artifactId> + <name>child1 for aggregate-reports</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + </plugins> + </reporting> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/aggregate-report/child1/src/test/java/aggregateReport/FailingTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/aggregate-report/child1/src/test/java/aggregateReport/FailingTest.java b/surefire-its/src/test/resources/aggregate-report/child1/src/test/java/aggregateReport/FailingTest.java new file mode 100644 index 0000000..440ade7 --- /dev/null +++ b/surefire-its/src/test/resources/aggregate-report/child1/src/test/java/aggregateReport/FailingTest.java @@ -0,0 +1,33 @@ +package aggregateReport; + +/* + * 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 FailingTest + extends TestCase +{ + + public void testFailure() + { + fail( "This test is supposed to fail" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/aggregate-report/child2/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/aggregate-report/child2/pom.xml b/surefire-its/src/test/resources/aggregate-report/child2/pom.xml new file mode 100644 index 0000000..b67c49a --- /dev/null +++ b/surefire-its/src/test/resources/aggregate-report/child2/pom.xml @@ -0,0 +1,52 @@ +<?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>aggregate-report</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>aggregate-child2</artifactId> + <name>child2 for aggregate-reports</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + </plugin> + </plugins> + </reporting> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/aggregate-report/child2/src/test/java/aggregateReport/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/aggregate-report/child2/src/test/java/aggregateReport/BasicTest.java b/surefire-its/src/test/resources/aggregate-report/child2/src/test/java/aggregateReport/BasicTest.java new file mode 100644 index 0000000..529e7ca --- /dev/null +++ b/surefire-its/src/test/resources/aggregate-report/child2/src/test/java/aggregateReport/BasicTest.java @@ -0,0 +1,87 @@ +package aggregateReport; + +/* + * 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() + { + System.out.println( "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/aggregate-report/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/aggregate-report/pom.xml b/surefire-its/src/test/resources/aggregate-report/pom.xml new file mode 100644 index 0000000..42f0f32 --- /dev/null +++ b/surefire-its/src/test/resources/aggregate-report/pom.xml @@ -0,0 +1,67 @@ +<?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>aggregate-report</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for aggregate-report</name> + <packaging>pom</packaging> + <modules> + <module>child1</module> + <module>child2</module> + </modules> + + <build> + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <testFailureIgnore>true</testFailureIgnore> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <reporting> + <plugins> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <configuration> + <aggregate>true</aggregate> + </configuration> + </plugin> + </plugins> + </reporting> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/.gitignore ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/.gitignore b/surefire-its/src/test/resources/ant-ignore/.gitignore new file mode 100644 index 0000000..2d7276b --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/.gitignore @@ -0,0 +1,3 @@ +*.jar +TEST* + http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/build.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/build.xml b/surefire-its/src/test/resources/ant-ignore/build.xml new file mode 100644 index 0000000..69795d0 --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/build.xml @@ -0,0 +1,52 @@ +<project name="MyProject" xmlns:ivy="antlib:org.apache.ivy.ant" default="dist" basedir="."> + <description> + simple example build file + </description> + <!-- set global properties for this build --> + <property name="src" location="src/test"/> + <property name="build" location="build"/> + <property name="dist" location="dist"/> + + + <target name="resolve" description="--> retrieve dependencies with ivy"> + <ivy:retrieve /> + </target> + + <target name="init"> + <!-- Create the time stamp --> + <tstamp/> + <!-- Create the build directory structure used by compile --> + <mkdir dir="${build}"/> + </target> + + <target name="compile" depends="init, resolve" + description="compile the source " > + <javac srcdir="${src}" destdir="${build}" includeantruntime="true" classpath="lib/junit-4.8.1.jar" /> + </target> + + <target name="dist" depends="compile" + description="generate the distribution" > + <!-- Create the distribution directory --> + <mkdir dir="${dist}/lib"/> + + <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> + <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> + </target> + + <target name="test" depends="compile"> + <junit> + <classpath path="build:lib/junit-4.8.1.jar"/> + <formatter type="brief" usefile="true" /> + <formatter type="xml" usefile="true" /> + <test name="antignore.BasicTest" /> + </junit> +</target> + + <target name="clean" + description="clean up" > + <!-- Delete the ${build} and ${dist} directory trees --> + <delete dir="${build}"/> + <delete dir="${dist}"/> + </target> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/ivy.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/ivy.xml b/surefire-its/src/test/resources/ant-ignore/ivy.xml new file mode 100644 index 0000000..64df19c --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/ivy.xml @@ -0,0 +1,6 @@ +<ivy-module version="2.0"> + <info organisation="org.apache" module="hello-ivy"/> + <dependencies> + <dependency org="junit" name="junit" rev="4.8.1"/> + </dependencies> +</ivy-module> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/pom.xml b/surefire-its/src/test/resources/ant-ignore/pom.xml new file mode 100644 index 0000000..6360bed --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/pom.xml @@ -0,0 +1,47 @@ +<?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>ant-ignore</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test of @Ignore annotation, can be used side-by-side with maven and ant </name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.4</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/src/ivy.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/src/ivy.xml b/surefire-its/src/test/resources/ant-ignore/src/ivy.xml new file mode 100644 index 0000000..64df19c --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/src/ivy.xml @@ -0,0 +1,6 @@ +<ivy-module version="2.0"> + <info organisation="org.apache" module="hello-ivy"/> + <dependencies> + <dependency org="junit" name="junit" rev="4.8.1"/> + </dependencies> +</ivy-module> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/ant-ignore/src/test/java/antignore/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/ant-ignore/src/test/java/antignore/BasicTest.java b/surefire-its/src/test/resources/ant-ignore/src/test/java/antignore/BasicTest.java new file mode 100644 index 0000000..750bd60 --- /dev/null +++ b/surefire-its/src/test/resources/ant-ignore/src/test/java/antignore/BasicTest.java @@ -0,0 +1,42 @@ +package antignore; + +/* + * 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.Assert; +import org.junit.Ignore; +import org.junit.Test; + +public class BasicTest +{ + + @Test + @Ignore + public void testIgnorable() + { + Assert.fail( "you should have ignored me!" ); + } + + @Test + public void testSomethingElse() + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/argLine-parameter/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/argLine-parameter/pom.xml b/surefire-its/src/test/resources/argLine-parameter/pom.xml new file mode 100644 index 0000000..0cce4c9 --- /dev/null +++ b/surefire-its/src/test/resources/argLine-parameter/pom.xml @@ -0,0 +1,61 @@ +<?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>testArgLine</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for argLine configuration</name> + + <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> + <configuration> + <forkMode>once</forkMode> + <argLine>-Dfoo.property="foo foo/foo/bar/1.0" -Dbar.property="bar bar/foo/bar/2.0"</argLine> + </configuration> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/argLine-parameter/src/test/java/argLine/TestSurefireArgLine.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/argLine-parameter/src/test/java/argLine/TestSurefireArgLine.java b/surefire-its/src/test/resources/argLine-parameter/src/test/java/argLine/TestSurefireArgLine.java new file mode 100644 index 0000000..1765c84 --- /dev/null +++ b/surefire-its/src/test/resources/argLine-parameter/src/test/java/argLine/TestSurefireArgLine.java @@ -0,0 +1,40 @@ +package argLine; + +/* + * 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 TestSurefireArgLine + extends TestCase +{ + + public void testArgLine() + { + String fooProperty = System.getProperty( "foo.property" ); + assertEquals( "incorrect foo.property; " + + "Surefire should have passed this in correctly", + "foo foo/foo/bar/1.0", fooProperty ); + String barProperty = System.getProperty( "bar.property" ); + assertEquals( "incorrect bar.property; " + + "Surefire should have passed this in correctly", + "bar bar/foo/bar/2.0", barProperty ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/argLine-properties/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/argLine-properties/pom.xml b/surefire-its/src/test/resources/argLine-properties/pom.xml new file mode 100644 index 0000000..2a6d6c2 --- /dev/null +++ b/surefire-its/src/test/resources/argLine-properties/pom.xml @@ -0,0 +1,84 @@ +<?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>testArgProperties</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for late replacement argLine properties.</name> + + <properties> + <from.prop>from-prop-value</from.prop> + <override.prop>not-override-prop-value</override.prop> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>properties-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <executions> + <execution> + <id>default</id> + <phase>validate</phase> + <goals> + <goal>read-project-properties</goal> + </goals> + <configuration> + <files> + <file>${project.basedir}/src/test/resources/it.properties</file> + </files> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <forkMode>once</forkMode> + <argLine>-Dp1=@{from.prop} -Dp2=@{override.prop} -Dp3=@{undefined.prop} -Dp4=@{generated.prop}</argLine> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java b/surefire-its/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java new file mode 100644 index 0000000..a16fceb --- /dev/null +++ b/surefire-its/src/test/resources/argLine-properties/src/test/java/argLine-properties/TestSurefireArgLineProperties.java @@ -0,0 +1,58 @@ +package argLine; + +/* + * 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.Assert; +import org.junit.Test; + +public class TestSurefireArgLineProperties +{ + @Test + public void testFromProp() + { + String fromProp = System.getProperty("p1"); + Assert.assertNotNull(fromProp, "incorrect arg line, no p1 present?"); + Assert.assertEquals("from-prop-value", fromProp); + } + + @Test + public void testOverrideProp() + { + String overrideProp = System.getProperty("p2"); + Assert.assertNotNull(overrideProp, "incorrect arg line, no p2 present?"); + Assert.assertEquals("override-prop-value", overrideProp); + } + + @Test + public void testUndefinedProp() + { + String undefinedProp = System.getProperty("p3"); + Assert.assertNotNull(undefinedProp, "incorrect arg line, no p3 present?"); + Assert.assertEquals("@{undefined.prop}", undefinedProp); + } + + @Test + public void testGeneratedProp() + { + String generatedProp = System.getProperty("p4"); + Assert.assertNotNull(generatedProp, "incorrect arg line, no p4 present?"); + Assert.assertEquals("generated-prop-value", generatedProp); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/argLine-properties/src/test/resources/it.properties ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/argLine-properties/src/test/resources/it.properties b/surefire-its/src/test/resources/argLine-properties/src/test/resources/it.properties new file mode 100644 index 0000000..dd889a2 --- /dev/null +++ b/surefire-its/src/test/resources/argLine-properties/src/test/resources/it.properties @@ -0,0 +1,19 @@ +# 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. + +override.prop=override-prop-value +generated.prop=generated-prop-value http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/assumpationFailureReport/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/assumpationFailureReport/pom.xml b/surefire-its/src/test/resources/assumpationFailureReport/pom.xml new file mode 100644 index 0000000..8530eca --- /dev/null +++ b/surefire-its/src/test/resources/assumpationFailureReport/pom.xml @@ -0,0 +1,63 @@ +<?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"> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>assumpationFailure</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>assumpationFailureReportTest</name> + <url>http://maven.apache.org</url> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/assumpationFailureReport/src/test/java/assumpationFailure/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/assumpationFailureReport/src/test/java/assumpationFailure/Test1.java b/surefire-its/src/test/resources/assumpationFailureReport/src/test/java/assumpationFailure/Test1.java new file mode 100644 index 0000000..3653ce6 --- /dev/null +++ b/surefire-its/src/test/resources/assumpationFailureReport/src/test/java/assumpationFailure/Test1.java @@ -0,0 +1,35 @@ +package assumptionFailure; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import org.junit.Test; +import org.junit.Assume; + +import static org.junit.Assert.fail; + +public class Test1 +{ + @Test + public void testAssumptionFailureReport() + { + Assume.assumeTrue( "The test is skipped if it is false" , false ); + fail( "This is not expected to test" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/classpath-filtering/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-filtering/pom.xml b/surefire-its/src/test/resources/classpath-filtering/pom.xml new file mode 100644 index 0000000..49c4e34 --- /dev/null +++ b/surefire-its/src/test/resources/classpath-filtering/pom.xml @@ -0,0 +1,65 @@ +<?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>classpath-dependency-filter</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for filtering classpath dependencies</name> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <classpathDependencyExcludes> + <exclude>org.apache.commons:*</exclude> + </classpathDependencyExcludes> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-email</artifactId> + <version>1.2</version> + </dependency> + <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/classpath-filtering/src/test/java/classpathFiltering/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-filtering/src/test/java/classpathFiltering/BasicTest.java b/surefire-its/src/test/resources/classpath-filtering/src/test/java/classpathFiltering/BasicTest.java new file mode 100644 index 0000000..5f8b23a --- /dev/null +++ b/surefire-its/src/test/resources/classpath-filtering/src/test/java/classpathFiltering/BasicTest.java @@ -0,0 +1,44 @@ +package classpathFiltering; + +/* + * 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 BasicTest + extends TestCase +{ + + public void testDependencyFilter() { + + Class testClass = null; + String testClassName = "org.apache.commons.mail.Email"; + try + { + testClass = Class.forName( testClassName ); + System.out.println( "Able to load class " + testClass ); + } + catch ( ClassNotFoundException e ) + { + System.out.println( "Couldn't load " + testClassName ); + } + assertNull( testClass ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/classpath-order/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/classpath-order/pom.xml b/surefire-its/src/test/resources/classpath-order/pom.xml new file mode 100644 index 0000000..b49fda7 --- /dev/null +++ b/surefire-its/src/test/resources/classpath-order/pom.xml @@ -0,0 +1,64 @@ +<?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>classpath-order</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test proper order of class path elements: test-classes, classes, dependencies</name> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + <version>${surefire.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project>