Return-Path: X-Original-To: apmail-maven-commits-archive@www.apache.org Delivered-To: apmail-maven-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 10FA4E264 for ; Tue, 4 Dec 2012 21:01:41 +0000 (UTC) Received: (qmail 23106 invoked by uid 500); 4 Dec 2012 21:01:40 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 23052 invoked by uid 500); 4 Dec 2012 21:01:40 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 23043 invoked by uid 99); 4 Dec 2012 21:01:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Dec 2012 21:01:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 89B328186D4; Tue, 4 Dec 2012 21:01:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: krosenvold@apache.org To: commits@maven.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Made the IT's unpack so that each test-method execution gets its own sub-folder under target/TestClassName/testMethodName Message-Id: <20121204210140.89B328186D4@tyr.zones.apache.org> Date: Tue, 4 Dec 2012 21:01:40 +0000 (UTC) Updated Branches: refs/heads/master ddb6b922b -> 9d77a8ede Made the IT's unpack so that each test-method execution gets its own sub-folder under target/TestClassName/testMethodName This makes it so much easier to diagnose failures since in past times, different test methods running after the first method could overwrite the results from the failing test. This requires Verifier 1.4-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/9d77a8ed Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/9d77a8ed Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/9d77a8ed Branch: refs/heads/master Commit: 9d77a8edea9a4806f6e47a2f1094b5436df31fae Parents: ddb6b92 Author: Kristian Rosenvold Authored: Tue Dec 4 15:07:49 2012 +0100 Committer: Kristian Rosenvold Committed: Tue Dec 4 21:59:33 2012 +0100 ---------------------------------------------------------------------- surefire-integration-tests/pom.xml | 6 +- .../its/fixture/SurefireIntegrationTestCase.java | 18 ++- .../fixture/SurefireJUnit4IntegrationTestCase.java | 2 +- .../surefire/its/fixture/SurefireLauncher.java | 154 +++++++++++---- .../surefire/its/fixture/SurefireLauncherTest.java | 20 ++ .../its/jiras/Surefire141PluggableProvidersIT.java | 6 +- .../its/jiras/Surefire162CharsetProviderIT.java | 2 +- .../pom.xml | 50 +++++ .../maven/surefire/testprovider/TestProvider.java | 56 ++++++ ...che.maven.surefire.providerapi.SurefireProvider | 1 + .../surefire-141-pluggableproviders/pom.xml | 65 ++++++ .../src/test/java/surefire141/BasicTest.java | 67 +++++++ .../src/test/java/surefire141/TestTwo.java | 9 + .../test-provider/pom.xml | 47 ----- .../maven/surefire/testprovider/TestProvider.java | 58 ------ ...che.maven.surefire.providerapi.SurefireProvider | 1 - .../surefire-141-pluggableproviders/test/pom.xml | 62 ------ .../test/java/junit/twoTestCases/BasicTest.java | 67 ------- .../src/test/java/junit/twoTestCases/TestTwo.java | 9 - 19 files changed, 413 insertions(+), 287 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/pom.xml b/surefire-integration-tests/pom.xml index 16c9cdf..053281c 100644 --- a/surefire-integration-tests/pom.xml +++ b/surefire-integration-tests/pom.xml @@ -36,7 +36,7 @@ UTF-8 false 5.7 - 1 + 4 ${maven.home} false @@ -45,7 +45,7 @@ org.apache.maven.shared maven-verifier - 1.3 + 1.4-SNAPSHOT org.apache.maven @@ -87,7 +87,7 @@ maven-failsafe-plugin ${shadedVersion} - ${surefire.threadcount} + 1 false http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireIntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireIntegrationTestCase.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireIntegrationTestCase.java index bba88cf..e6a0dee 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireIntegrationTestCase.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireIntegrationTestCase.java @@ -46,7 +46,23 @@ public abstract class SurefireIntegrationTestCase { try { - return new SurefireLauncher( this.getClass(), sourceName ); + return new SurefireLauncher( this.getClass(), sourceName, "" ); + } + catch ( VerificationException e ) + { + throw new SurefireVerifierException( e ); + } + catch ( IOException e ) + { + throw new SurefireVerifierException( e ); + } + } + + public SurefireLauncher unpack( String sourceName, String suffix ) + { + try + { + return new SurefireLauncher( this.getClass(), sourceName, suffix ); } catch ( VerificationException e ) { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java index d181311..9bb8317 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireJUnit4IntegrationTestCase.java @@ -43,7 +43,7 @@ public abstract class SurefireJUnit4IntegrationTestCase { try { - return new SurefireLauncher( this.getClass(), sourceName ); + return new SurefireLauncher( this.getClass(), sourceName, "" ); } catch ( VerificationException e ) { http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java index d3e5579..36b5c53 100755 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java @@ -19,6 +19,12 @@ package org.apache.maven.surefire.its.fixture; * under the License. */ +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.commons.lang.text.StrSubstitutor; import org.apache.maven.artifact.versioning.ArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion; @@ -29,13 +35,6 @@ import org.apache.maven.it.Verifier; import org.apache.maven.it.util.ResourceExtractor; import org.apache.maven.shared.utils.io.FileUtils; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * Encapsulate all needed features to start a surefire run *

@@ -57,48 +56,107 @@ public class SurefireLauncher private final String surefireVersion = System.getProperty( "surefire.version" ); - private final Verifier verifier; + private Verifier verifier; - private final OutputValidator surefireVerifier; + private OutputValidator validator; private boolean failIfNoTests; + private final Class testClass; + + private final String resourceName; + + private final String suffix; + - public SurefireLauncher( Class testClass, String resourceName ) + public SurefireLauncher( Class testClass, String resourceName, String suffix ) throws VerificationException, IOException { - this( createVerifier( testClass, resourceName ) ); - + this.testClass = testClass; + this.resourceName = resourceName; + this.suffix = suffix != null ? suffix : ""; + goals.clear(); + goals.addAll( getInitialGoals() ); + cliOptions.clear(); } public SurefireLauncher( Verifier verifier ) { + this.testClass = null; + this.resourceName = null; + this.suffix = ""; this.verifier = verifier; - this.surefireVerifier = new OutputValidator( verifier ); goals.clear(); goals.addAll( getInitialGoals() ); cliOptions.clear(); } - private static Verifier createVerifier( Class testClass, String resourceName ) + private Verifier createVerifier( Class testClass, String resourceName ) throws IOException, VerificationException { return new Verifier( simpleExtractResources( testClass, resourceName ).getAbsolutePath() ); } - private static File simpleExtractResources( Class cl, String resourcePath ) + private File simpleExtractResources( Class cl, String resourcePath ) throws IOException { if ( !resourcePath.startsWith( "/" ) ) { resourcePath = "/" + resourcePath; } - String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) ); - File tempDir = new File( tempDirPath, cl.getSimpleName() ); + File tempDir = getUnpackDir(); File testDir = new File( tempDir, resourcePath ); FileUtils.deleteDirectory( testDir ); - return ResourceExtractor.extractResourcePath( cl, resourcePath, tempDir, true ); + return ResourceExtractor.extractResourceToDestination( cl, resourcePath, tempDir, true ); + } + + private File getUnpackDir() + { + String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) ); + return new File( tempDirPath, testClass.getSimpleName() + File.separator + getTestMethodName() + suffix); + } + + String getTestMethodName() + { + // dirty. Im sure we can use junit4 rules to attach testname to thread instead + StackTraceElement[] stackTrace = getStackTraceElements(); + StackTraceElement topInTestClass = null; + topInTestClass = findTopElemenent( stackTrace, testClass ); + if (topInTestClass == null){ + // Look in superclass... + topInTestClass = findTopElemenent( stackTrace, testClass.getSuperclass() ); + } + if ( topInTestClass != null ) + { + return topInTestClass.getMethodName(); + } + throw new IllegalStateException( "Cannot find " + testClass.getName() + "in stacktrace" ); + } + + private StackTraceElement findTopElemenent( StackTraceElement[] stackTrace, Class testClassToLookFor ) + { + StackTraceElement bestmatch = null; + for ( StackTraceElement stackTraceElement : stackTrace ) + { + if ( stackTraceElement.getClassName().equals( testClassToLookFor.getName() ) ) + { + bestmatch = stackTraceElement; + } + } + return bestmatch; + } + + StackTraceElement[] getStackTraceElements() + { + try + { + throw new RuntimeException(); + } + catch ( RuntimeException e ) + { + return e.getStackTrace(); + } } public void reset() @@ -111,14 +169,14 @@ public class SurefireLauncher public SurefireLauncher getSubProjectLauncher( String subProject ) throws VerificationException { - final File subFile = surefireVerifier.getSubFile( subProject ); + final File subFile = getValidator().getSubFile( subProject ); return new SurefireLauncher( new Verifier( subFile.getAbsolutePath() ) ); } public OutputValidator getSubProjectValidator( String subProject ) throws VerificationException { - final File subFile = surefireVerifier.getSubFile( subProject ); + final File subFile = getValidator().getSubFile( subProject ); return new OutputValidator( new Verifier( subFile.getAbsolutePath() ) ); } @@ -186,7 +244,7 @@ public class SurefireLauncher public SurefireLauncher assertNotPresent( String subFile ) { - verifier.assertFileNotPresent( surefireVerifier.getSubFile( subFile ).getAbsolutePath() ); + getVerifier().assertFileNotPresent( getValidator().getSubFile( subFile ).getAbsolutePath() ); return this; } @@ -247,7 +305,7 @@ public class SurefireLauncher } catch ( SurefireVerifierException ignore ) { - return surefireVerifier; + return getValidator(); } throw new RuntimeException( "Expecting build failure, got none!" ); } @@ -260,7 +318,7 @@ public class SurefireLauncher } catch ( SurefireVerifierException ignore ) { - return surefireVerifier; + return getValidator(); } throw new RuntimeException( "Expecting build failure, got none!" ); } @@ -269,7 +327,7 @@ public class SurefireLauncher public FailsafeOutputValidator executeVerify() { OutputValidator verify = execute( "verify" ); - return new FailsafeOutputValidator( verify.getVerifier()); + return new FailsafeOutputValidator( verify.getVerifier() ); } public OutputValidator execute( String goal ) @@ -310,10 +368,10 @@ public class SurefireLauncher cliOptions.add( "-s " + interpolatedSettings.getCanonicalPath() ); } - verifier.setCliOptions( cliOptions ); + getVerifier().setCliOptions( cliOptions ); - verifier.executeGoals( goals, envvars ); - return surefireVerifier; + getVerifier().executeGoals( goals, envvars ); + return getValidator(); } catch ( IOException e ) { @@ -325,7 +383,7 @@ public class SurefireLauncher } finally { - verifier.resetStreams(); + getVerifier().resetStreams(); } } @@ -379,6 +437,7 @@ public class SurefireLauncher { return forkMode( "pertest" ); } + public SurefireLauncher forkPerThread() { return forkMode( "perthread" ); @@ -388,12 +447,12 @@ public class SurefireLauncher { return forkMode( "onceperthread" ); } - - public SurefireLauncher threadCount(int threadCount) + + public SurefireLauncher threadCount( int threadCount ) { return addGoal( "-DthreadCount=" + threadCount ); } - + public SurefireLauncher forkMode( String forkMode ) { return addGoal( "-DforkMode=" + forkMode ); @@ -484,7 +543,8 @@ public class SurefireLauncher public File getUnpackLocation() { - return new File( verifier.getBasedir() ); + getVerifier(); // Make sure we have unpacked + return getUnpackDir(); } public SurefireLauncher addFailsafeReportOnlyGoal() @@ -511,7 +571,7 @@ public class SurefireLauncher { try { - FileUtils.deleteDirectory( surefireVerifier.getSubFile( "site" ) ); + FileUtils.deleteDirectory( getValidator().getSubFile( "site" ) ); } catch ( IOException e ) { @@ -526,8 +586,32 @@ public class SurefireLauncher return this; } - public OutputValidator getSurefireVerifier() + public OutputValidator getValidator() + { + if ( validator == null ) + { + this.validator = new OutputValidator( getVerifier() ); + } + return validator; + } + + private Verifier getVerifier() { - return surefireVerifier; + if ( verifier == null ) + { + try + { + this.verifier = createVerifier( testClass, resourceName ); + } + catch ( IOException e ) + { + throw new RuntimeException( e ); + } + catch ( VerificationException e ) + { + throw new RuntimeException( e ); + } + } + return verifier; } } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java new file mode 100644 index 0000000..6580012 --- /dev/null +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncherTest.java @@ -0,0 +1,20 @@ +package org.apache.maven.surefire.its.fixture; + +import org.apache.maven.it.VerificationException; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + +/** + * @author Kristian Rosenvold + */ +public class SurefireLauncherTest { + @Test + public void launcherGetsProperMethodName() throws IOException, VerificationException { + String method = new SurefireLauncher(SurefireLauncherTest.class, "foo", "").getTestMethodName(); + assertEquals( "launcherGetsProperMethodName", method); + + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java index 47764c3..6b0c946 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java @@ -19,6 +19,8 @@ package org.apache.maven.surefire.its.jiras; * under the License. */ +import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireIntegrationTestCase; /** @@ -32,9 +34,9 @@ public class Surefire141PluggableProvidersIT public void testParallelBuildResultCount() throws Exception { - unpack( "surefire-141-pluggableproviders/test-provider" ).executeInstall(); + OutputValidator outputValidator = unpack( "surefire-141-pluggableproviders-provider" , "prov").executeInstall(); - unpack( "surefire-141-pluggableproviders/test" ).setEOption().executeTest().verifyTextInLog( + unpack( "surefire-141-pluggableproviders" ).setEOption().executeTest().verifyTextInLog( "Using configured provider org.apache.maven.surefire.testprovider.TestProvider" ).verifyTextInLog( "Using configured provider org.apache.maven.surefire.junit.JUnit3Provider" ).verifyErrorFreeLog(); } http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire162CharsetProviderIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire162CharsetProviderIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire162CharsetProviderIT.java index 5b66fb3..b593976 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire162CharsetProviderIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire162CharsetProviderIT.java @@ -38,7 +38,7 @@ public class Surefire162CharsetProviderIT throws Exception { SurefireLauncher unpack = unpack( "/surefire-162-charsetProvider" ); - OutputValidator verifier = unpack.getSurefireVerifier(); + OutputValidator verifier = unpack.getValidator(); File jarFile = new File( verifier.getArtifactPath( "jcharset", "jcharset", "1.2.1", "jar" ) ); jarFile.getParentFile().mkdirs(); FileUtils.copyFile( verifier.getSubFile( "repo/jcharset/jcharset/1.2.1/jcharset-1.2.1.jar" ), jarFile ); http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml new file mode 100644 index 0000000..418ec0f --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + org.apache.maven.plugins.surefire + surefire-test-provider + 1.0-SNAPSHOT + Test provider + + + 2.12.4 + + + + org.apache.maven.surefire + surefire-api + ${surefire.version} + + + + + + + src/main/resources/META-INF + META-INF + + + + + + http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java new file mode 100644 index 0000000..47faf6f --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java @@ -0,0 +1,56 @@ +package org.apache.maven.surefire.testprovider; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Iterator; +import org.apache.maven.surefire.providerapi.AbstractProvider; +import org.apache.maven.surefire.providerapi.ProviderParameters; +import org.apache.maven.surefire.report.ReporterException; +import org.apache.maven.surefire.suite.RunResult; +import org.apache.maven.surefire.testset.TestSetFailedException; + +/** + * @author Kristian Rosenvold + */ +public class TestProvider extends AbstractProvider +{ + + public TestProvider( ProviderParameters booterParameters ) + { + } + + + public Boolean isRunnable() + { + return Boolean.TRUE; + } + + public Iterator getSuites() + { + + return null; + } + + public RunResult invoke( Object forkTestSet ) + throws TestSetFailedException, ReporterException + { + return new RunResult( 1,0,0,2 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider new file mode 100644 index 0000000..d52f21c --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider @@ -0,0 +1 @@ +org.apache.maven.surefire.testprovider.TestProvider http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/pom.xml b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/pom.xml new file mode 100644 index 0000000..774bb50 --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/pom.xml @@ -0,0 +1,65 @@ + + + + + 4.0.0 + + org.apache.maven.plugins.surefire + surefire141-test + 1.0-SNAPSHOT + surefire-141-pluggableproviders + + + + junit + junit + 4.8.1 + test + + + + + 2.12.4 + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + + org.apache.maven.surefire + surefire-junit3 + ${surefire.version} + + + org.apache.maven.plugins.surefire + surefire-test-provider + 1.0-SNAPSHOT + + + + + + + http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/BasicTest.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/BasicTest.java new file mode 100644 index 0000000..0546955 --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/BasicTest.java @@ -0,0 +1,67 @@ +package surefire141; +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 ) + { + super( name ); + } + + public static Test suite() + { + TestSuite suite = new TestSuite(); + Test test = new BasicTest( "testSetUp" ); + suite.addTest( test ); + TestSetup setup = new TestSetup( suite ) + { + + protected void setUp() + { + //oneTimeSetUp(); + } + + protected void tearDown() + { + oneTimeTearDown(); + } + + }; + + return setup; + } + + 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/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/TestTwo.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/TestTwo.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/TestTwo.java new file mode 100644 index 0000000..6132bec --- /dev/null +++ b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/src/test/java/surefire141/TestTwo.java @@ -0,0 +1,9 @@ +package surefire141; +import junit.framework.TestCase; + + +public class TestTwo + extends TestCase +{ + public void testTwo() {} +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/pom.xml b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/pom.xml deleted file mode 100644 index ea1c86f..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - 4.0.0 - - org.apache.maven.plugins.surefire - surefire-test-provider - 1.0-SNAPSHOT - Test provider - - - - org.apache.maven.surefire - surefire-api - ${surefire.version} - - - - - - - src/main/resources/META-INF - META-INF - - - - - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java deleted file mode 100644 index 2a2cf46..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/java/org/apache/maven/surefire/testprovider/TestProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.maven.surefire.testprovider; - -/* - * 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.providerapi.AbstractProvider; -import org.apache.maven.surefire.providerapi.ProviderParameters; -import org.apache.maven.surefire.report.ReporterException; -import org.apache.maven.surefire.report.ReporterFactory; -import org.apache.maven.surefire.suite.RunResult; -import org.apache.maven.surefire.testset.TestSetFailedException; - -import java.util.Iterator; - -/** - * @author Kristian Rosenvold - */ -public class TestProvider extends AbstractProvider -{ - - public TestProvider( ProviderParameters booterParameters ) - { - } - - - public Boolean isRunnable() - { - return Boolean.TRUE; - } - - public Iterator getSuites() - { - - return null; - } - - public RunResult invoke( Object forkTestSet ) - throws TestSetFailedException, ReporterException - { - return new RunResult( 1,0,0,2 ); - } -} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider deleted file mode 100644 index d52f21c..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test-provider/src/main/resources/META-INF/services/org.apache.maven.surefire.providerapi.SurefireProvider +++ /dev/null @@ -1 +0,0 @@ -org.apache.maven.surefire.testprovider.TestProvider http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/pom.xml b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/pom.xml deleted file mode 100644 index 69aba95..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.surefire - junit-twoTestCases - 1.0-SNAPSHOT - surefire-414-pluggableproviders - - - - junit - junit - 4.8.1 - test - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire.version} - - - org.apache.maven.surefire - surefire-junit3 - ${surefire.version} - - - org.apache.maven.plugins.surefire - surefire-test-provider - 1.0-SNAPSHOT - - - - - - - http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/BasicTest.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/BasicTest.java deleted file mode 100644 index 749f731..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/BasicTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package junit.twoTestCases; -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 ) - { - super( name ); - } - - public static Test suite() - { - TestSuite suite = new TestSuite(); - Test test = new BasicTest( "testSetUp" ); - suite.addTest( test ); - TestSetup setup = new TestSetup( suite ) - { - - protected void setUp() - { - //oneTimeSetUp(); - } - - protected void tearDown() - { - oneTimeTearDown(); - } - - }; - - return setup; - } - - 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/9d77a8ed/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/TestTwo.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/TestTwo.java b/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/TestTwo.java deleted file mode 100644 index fba0f57..0000000 --- a/surefire-integration-tests/src/test/resources/surefire-141-pluggableproviders/test/src/test/java/junit/twoTestCases/TestTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package junit.twoTestCases; -import junit.framework.TestCase; - - -public class TestTwo - extends TestCase -{ - public void testTwo() {} -}