Author: krosenvold Date: Thu Aug 9 17:44:00 2012 New Revision: 1371335 URL: http://svn.apache.org/viewvc?rev=1371335&view=rev Log: o Fixed IT's for maven 2.2.1 by using JUnit4x categories
Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Not2xCompatible.java - copied, changed from r1371299, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java maven/surefire/trunk/surefire-integration-tests/src/test/resources/junit48-categories/log Modified: maven/surefire/trunk/surefire-integration-tests/pom.xml maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java Modified: maven/surefire/trunk/surefire-integration-tests/pom.xml URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/pom.xml?rev=1371335&r1=1371334&r2=1371335&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/pom.xml (original) +++ maven/surefire/trunk/surefire-integration-tests/pom.xml Thu Aug 9 17:44:00 2012 @@ -53,11 +53,12 @@ <version>2.0.6</version> <scope>test</scope> </dependency> - <!-- dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.10</version> <scope>test</scope> - </dependency --> + </dependency> <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> @@ -97,6 +98,13 @@ <testBuildDirectory>${project.build.testOutputDirectory}</testBuildDirectory> </systemPropertyVariables> </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${shadedVersion}</version> + </dependency> + </dependencies> </plugin> </plugins> </pluginManagement> @@ -212,6 +220,13 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <version>${shadedVersion}</version> + <configuration> + <excludedGroups>org.apache.maven.surefire.its.Not2xCompatible</excludedGroups> + </configuration> + </plugin> </plugins> </build> </profile> Copied: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Not2xCompatible.java (from r1371299, maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java) URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Not2xCompatible.java?p2=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Not2xCompatible.java&p1=maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java&r1=1371299&r2=1371335&rev=1371335&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Not2xCompatible.java Thu Aug 9 17:44:00 2012 @@ -1,4 +1,4 @@ -package org.apache.maven.surefire.its.jiras; +package org.apache.maven.surefire.its; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -19,31 +19,9 @@ package org.apache.maven.surefire.its.ji * under the License. */ -import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase; -import org.apache.maven.surefire.its.fixture.SurefireLauncher; - /** - * @author Kristian Rosenvold + * Marks an integration test as not compatible with 2.2.1 */ -public class Surefire735ForkFailWithRedirectConsoleOutputIT - extends SurefireIntegrationTestCase +public interface Not2xCompatible { - - public void testVMStartFail() - throws Exception - { - unpack().failNever().executeTest().verifyTextInLog( "Invalid maximum heap size: -Xmxxxx712743m" ); - } - - public void testVMStartFtestVMStartFailail() - throws Exception - { - unpack().executeTestWithFailure(); - } - - public SurefireLauncher unpack() - { - return unpack( "fork-fail" ); - } - } Added: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java?rev=1371335&view=auto ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java (added) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java Thu Aug 9 17:44:00 2012 @@ -0,0 +1,57 @@ +package org.apache.maven.surefire.its.fixture; + +/* + * 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.apache.maven.it.VerificationException; + +/** + * Contains commonly used features for most tests, encapsulating + * common use cases. + * <p/> + * Also includes thread-safe access to the extracted resource + * files, which AbstractSurefireIntegrationTestClass does not. + * Thread safe only for running in "classes" mode. + * + * @author Kristian Rosenvold + */ +public abstract class SurefireJUnit4IntegrationTestCase +{ + public OutputValidator executeErrorFreeTest( String sourceName, int total ) + { + return unpack( sourceName ).executeTest().verifyErrorFree( total ); + } + + public SurefireLauncher unpack( String sourceName ) + { + try + { + return new SurefireLauncher( this.getClass(), sourceName ); + } + catch ( VerificationException e ) + { + throw new SurefireVerifierException( e ); + } + catch ( IOException e ) + { + throw new SurefireVerifierException( e ); + } + } +} Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java?rev=1371335&r1=1371334&r2=1371335&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java Thu Aug 9 17:44:00 2012 @@ -19,23 +19,30 @@ package org.apache.maven.surefire.its.ji * under the License. */ -import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase; +import org.apache.maven.surefire.its.Not2xCompatible; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; +import org.junit.experimental.categories.Category; + /** * @author Kristian Rosenvold */ +@Category( Not2xCompatible.class) public class Surefire735ForkFailWithRedirectConsoleOutputIT - extends SurefireIntegrationTestCase + extends SurefireJUnit4IntegrationTestCase { - public void testVMStartFail() + @Test + public void vmStartFail() throws Exception { unpack().failNever().executeTest().verifyTextInLog( "Invalid maximum heap size: -Xmxxxx712743m" ); } - public void testVMStartFtestVMStartFailail() + @Test + public void vmStartFailShouldFailBuildk() throws Exception { unpack().executeTestWithFailure(); Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java?rev=1371335&r1=1371334&r2=1371335&view=diff ============================================================================== --- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java (original) +++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java Thu Aug 9 17:44:00 2012 @@ -1,27 +1,34 @@ package org.apache.maven.surefire.its.jiras; -import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase; +import org.apache.maven.surefire.its.Not2xCompatible; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category( Not2xCompatible.class) public class Surefire806SpecifiedTestControlsIT - extends SurefireIntegrationTestCase + extends SurefireJUnit4IntegrationTestCase { - public void testSingleTestInOneExecutionOfMultiExecutionProject() + @Test + public void singleTestInOneExecutionOfMultiExecutionProject() { unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun( "FirstTest" ).failIfNoSpecifiedTests( false ).executeTest().verifyErrorFree( 1 ); } - public void testTwoSpecifiedTestExecutionsInCorrectExecutionBlocks() + @Test + public void twoSpecifiedTestExecutionsInCorrectExecutionBlocks() { unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun( "FirstTest,SecondTest" ).executeTest().verifyErrorFree( 2 ); } - public void testSingleTestInSingleExecutionProject() + @Test + public void singleTestInSingleExecutionProject() { unpack( "/surefire-806-specifiedTests-single" ).setTestToRun( "ThirdTest" ).failIfNoSpecifiedTests( false ).executeTest().verifyErrorFree( 1 ); } - }