This is an automated email from the ASF dual-hosted git repository. tibordigana pushed a commit to branch SUREFIRE-1578 in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 8902b57b0e262c0b93e8f126ae530ed9d9e564fb Author: Tibor17 <tibordig...@apache.org> AuthorDate: Wed Oct 3 12:37:46 2018 +0200 [SUREFIRE-1578] Remove obsolete module surefire-setup-integration-tests --- pom.xml | 1 - surefire-its/pom.xml | 34 ++- .../maven/surefire/its/AbstractFailFastIT.java | 9 +- .../apache/maven/surefire/its/ConsoleOutputIT.java | 10 +- .../maven/surefire/its/fixture/MavenLauncher.java | 79 ++---- .../surefire/its/fixture/SurefireLauncher.java | 11 +- .../Surefire1396CustomProviderClassPathIT.java | 3 - .../its/jiras/Surefire141PluggableProvidersIT.java | 6 - .../its/jiras/Surefire740TruncatedCommaIT.java | 7 +- ...Surefire946KillMainProcessInReusableForkIT.java | 5 - surefire-its/src/test/resources/settings.xml | 42 +--- .../src/test}/resources/toolchains.xml | 0 surefire-setup-integration-tests/pom.xml | 279 --------------------- .../surefire/its/SetUpForIntegrationTest.java | 44 ---- .../maven/surefire/its/StagedLocalRepoHelper.java | 160 ------------ 15 files changed, 65 insertions(+), 625 deletions(-) diff --git a/pom.xml b/pom.xml index 2834a88..280289f 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,6 @@ <module>maven-surefire-plugin</module> <module>maven-failsafe-plugin</module> <module>maven-surefire-report-plugin</module> - <module>surefire-setup-integration-tests</module> <module>surefire-its</module> </modules> diff --git a/surefire-its/pom.xml b/surefire-its/pom.xml index 5ee30c9..391543e 100644 --- a/surefire-its/pom.xml +++ b/surefire-its/pom.xml @@ -46,6 +46,7 @@ <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-verifier</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven</groupId> @@ -61,22 +62,45 @@ <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-artifact</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-shared-utils</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> + <scope>test</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> + <scope>test</scope> </dependency> </dependencies> <build> + <resources> + <resource> + <directory>src/test/resources</directory> + <targetPath>${project.build.outputDirectory}</targetPath> + <excludes> + <exclude>settings.xml</exclude> + <exclude>toolchains.xml</exclude> + </excludes> + </resource> + <resource> + <directory>src/test/resources</directory> + <filtering>true</filtering> + <targetPath>${project.build.directory}/private</targetPath> + <includes> + <include>settings.xml</include> + <include>toolchains.xml</include> + </includes> + </resource> + </resources> <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> @@ -111,15 +135,9 @@ <systemPropertyVariables> <surefire.version>${project.version}</surefire.version> <maven.home>${maven.home}</maven.home> - <maven.settings.file>${project.basedir}/../surefire-setup-integration-tests/target/private/it-settings.xml - </maven.settings.file> - <maven.toolchains.file>${project.basedir}/../surefire-setup-integration-tests/target/private/toolchains.xml - </maven.toolchains.file> - <maven.repo.local>${project.basedir}/../surefire-setup-integration-tests/target/it-repo</maven.repo.local> + <maven.settings.file>${project.build.directory}/private/settings.xml</maven.settings.file> + <maven.toolchains.file>${project.build.directory}/private/toolchains.xml</maven.toolchains.file> <maven.test.tmpdir>${project.build.directory}</maven.test.tmpdir> - <user.localRepository>${settings.localRepository}</user.localRepository> - <useInterpolatedSettings>false</useInterpolatedSettings> - <testBuildDirectory>${project.build.testOutputDirectory}</testBuildDirectory> <verifier.forkMode>forked</verifier.forkMode> <jdk.home>${jdk.home}</jdk.home> <jacoco.agent>${jacoco-it.agent}</jacoco.agent> diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java index 9a49d1a..14b19c7 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/AbstractFailFastIT.java @@ -64,7 +64,7 @@ public abstract class AbstractFailFastIT protected abstract String withProvider(); - protected final OutputValidator prepare( String description, String profile, Map<String, String> properties ) + private OutputValidator prepare( String description, String profile, Map<String, String> properties ) { MavenLauncher launcher = unpack( "/fail-fast-" + withProvider(), "_" + description ) .maven(); @@ -82,12 +82,7 @@ public abstract class AbstractFailFastIT return launcher.sysProp( properties ).executeTest(); } - protected final OutputValidator prepare( String description, Map<String, String> properties ) - { - return prepare( description, null, properties ); - } - - protected static Map<String, String> props( int forkCount, int skipAfterFailureCount, boolean reuseForks ) + static Map<String, String> props( int forkCount, int skipAfterFailureCount, boolean reuseForks ) { Map<String, String> props = new HashMap<String, String>( 3 ); props.put( "surefire.skipAfterFailureCount", "" + skipAfterFailureCount ); diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java index e01d798..734d773 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ConsoleOutputIT.java @@ -97,10 +97,10 @@ public class ConsoleOutputIT @Test public void largerSoutThanMemory() - throws Exception { - unpack( "consoleoutput-noisy" ).setMavenOpts( "-Xmx64m" ).sysProp( "thousand", "32000" ).executeTest(); + unpack( "consoleoutput-noisy" ) + .setMavenOpts( "-Xmx64m" ) + .sysProp( "thousand", "32000" ) + .executeTest(); } - - -} \ No newline at end of file +} diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java index bd12dda..1cbfb6b 100755 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java @@ -19,7 +19,6 @@ package org.apache.maven.surefire.its.fixture; * under the License. */ -import org.apache.commons.lang.text.StrSubstitutor; import org.apache.maven.it.VerificationException; import org.apache.maven.it.Verifier; import org.apache.maven.it.util.ResourceExtractor; @@ -42,7 +41,7 @@ import static java.util.Collections.unmodifiableList; * * @author Kristian Rosenvold */ -public class MavenLauncher +public final class MavenLauncher { private final List<String> cliOptions = new ArrayList<String>(); @@ -66,7 +65,7 @@ public class MavenLauncher private boolean expectFailure; - public MavenLauncher( Class testClass, String resourceName, String suffix, String[] cli ) + MavenLauncher( Class testClass, String resourceName, String suffix, String[] cli ) { this.testCaseBeingRun = testClass; this.resourceName = resourceName; @@ -76,7 +75,7 @@ public class MavenLauncher resetCliOptions(); } - public MavenLauncher( Class testClass, String resourceName, String suffix ) + MavenLauncher( Class testClass, String resourceName, String suffix ) { this( testClass, resourceName, suffix, null ); } @@ -104,18 +103,16 @@ public class MavenLauncher unpackedAt = dest; } - public void resetGoals() + private void resetGoals() { goals.clear(); } - void addCliOption( String cliOption ) + private void addCliOption( String cliOption ) { cliOptions.add( cliOption ); } - - private StackTraceElement findTopElemenent( StackTraceElement[] stackTrace, Class testClassToLookFor ) { StackTraceElement bestmatch = null; @@ -129,7 +126,7 @@ public class MavenLauncher return bestmatch; } - StackTraceElement[] getStackTraceElements() + private static StackTraceElement[] getStackTraceElements() { try { @@ -153,7 +150,6 @@ public class MavenLauncher } public MavenLauncher getSubProjectLauncher( String subProject ) - throws VerificationException { MavenLauncher mavenLauncher = new MavenLauncher( testCaseBeingRun, resourceName + File.separator + subProject, suffix, cli ); @@ -168,7 +164,6 @@ public class MavenLauncher return new OutputValidator( new Verifier( subFile.getAbsolutePath() ) ); } - public MavenLauncher addEnvVar( String key, String value ) { envvars.put( key, value ); @@ -279,16 +274,14 @@ public class MavenLauncher throw new RuntimeException( "Expecting build failure, got none!" ); } return verify; - } public MavenLauncher withFailure() { - this.expectFailure = true; + expectFailure = true; return this; } - public OutputValidator execute( String goal ) { addGoal( goal ); @@ -297,48 +290,22 @@ public class MavenLauncher public OutputValidator executeCurrentGoals() { - - String userLocalRepo = System.getProperty( "user.localRepository" ); - String testBuildDirectory = System.getProperty( "testBuildDirectory" ); - boolean useInterpolatedSettings = Boolean.getBoolean( "useInterpolatedSettings" ); - try { - if ( useInterpolatedSettings ) - { - File interpolatedSettings = new File( testBuildDirectory, "interpolated-settings" ); - - if ( !interpolatedSettings.exists() ) - { - // hack "a la" invoker plugin to download dependencies from local repo - // and not download from central - - Map<String, String> values = new HashMap<String, String>( 1 ); - values.put( "localRepositoryUrl", toUrl( userLocalRepo ) ); - StrSubstitutor strSubstitutor = new StrSubstitutor( values ); - - String fileContent = FileUtils.fileRead( new File( testBuildDirectory, "settings.xml" ) ); - - String filtered = strSubstitutor.replace( fileContent ); - - FileUtils.fileWrite( interpolatedSettings.getAbsolutePath(), filtered ); - - } - - addCliOption( "-s " + interpolatedSettings.getCanonicalPath() ); - } + File generatedSettings = new File( System.getProperty( "maven.settings.file" ) ).getCanonicalFile(); + String generatedSettingsPath = generatedSettings.getAbsolutePath(); + addCliOption( "-s " + generatedSettingsPath ); getVerifier().setCliOptions( cliOptions ); - getVerifier().executeGoals( goals, envvars ); return getValidator(); } catch ( IOException e ) { - throw new SurefireVerifierException( e.getMessage(), e ); + throw new SurefireVerifierException( e.getLocalizedMessage(), e ); } catch ( VerificationException e ) { - throw new SurefireVerifierException( e.getMessage(), e ); + throw new SurefireVerifierException( e.getLocalizedMessage(), e ); } finally { @@ -346,20 +313,6 @@ public class MavenLauncher } } - private static String toUrl( String filename ) - { - /* - * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here - * as-is but use the decoded path component in the URL. - */ - String url = "file://" + new File( filename ).toURI().getPath(); - if ( url.endsWith( "/" ) ) - { - url = url.substring( 0, url.length() - 1 ); - } - return url; - } - public MavenLauncher activateProfile( String profile ) { return addGoal( "-P" + profile ); @@ -417,7 +370,7 @@ public class MavenLauncher { if ( validator == null ) { - this.validator = new OutputValidator( getVerifier() ); + validator = new OutputValidator( getVerifier() ); } return validator; } @@ -436,6 +389,9 @@ public class MavenLauncher cli == null ? new Verifier( ensureUnpacked().getAbsolutePath(), null, false ) : new Verifier( ensureUnpacked().getAbsolutePath(), null, false, cli ); + + verifier.getVerifierProperties() + .setProperty( "use.mavenRepoLocal", "false" ); } catch ( VerificationException e ) { @@ -469,10 +425,9 @@ public class MavenLauncher { throw new RuntimeException( e ); } - } - File getUnpackDir() + private File getUnpackDir() { String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) ); return new File( tempDirPath, diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java index 5ec5e09..0e40622 100755 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java @@ -115,7 +115,6 @@ public final class SurefireLauncher } public SurefireLauncher getSubProjectLauncher( String subProject ) - throws VerificationException { return new SurefireLauncher( mavenLauncher.getSubProjectLauncher( subProject ) ); } @@ -194,12 +193,10 @@ public final class SurefireLauncher } public OutputValidator executeInstall() - throws VerificationException { return mavenLauncher.execute( "install" ); } - public FailsafeOutputValidator executeVerify() { OutputValidator verify = execute( "verify" ); @@ -321,12 +318,6 @@ public final class SurefireLauncher return this; } - - protected String getSurefireVersion() - { - return surefireVersion; - } - public SurefireLauncher disablePerCoreThreadCount() { mavenLauncher.sysProp( "perCoreThreadCount", false ); @@ -477,7 +468,7 @@ public final class SurefireLauncher private String getReportPluginGoal( String goal ) { - return "org.apache.maven.plugins:maven-surefire-report-plugin:" + getSurefireVersion() + ":" + goal; + return "org.apache.maven.plugins:maven-surefire-report-plugin:" + surefireVersion + ":" + goal; } public SurefireLauncher setTestToRun( String basicTest ) diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1396CustomProviderClassPathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1396CustomProviderClassPathIT.java index 4a27688..60b372f 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1396CustomProviderClassPathIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1396CustomProviderClassPathIT.java @@ -19,7 +19,6 @@ package org.apache.maven.surefire.its.jiras; * under the License. */ -import org.apache.maven.it.VerificationException; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.junit.BeforeClass; import org.junit.Test; @@ -32,14 +31,12 @@ public class Surefire1396CustomProviderClassPathIT { @BeforeClass public static void installProvider() - throws VerificationException { unpack( Surefire1396CustomProviderClassPathIT.class, "surefire-1396-pluggableproviders-classpath-provider", "prov" ).executeInstall(); } @Test public void pluggableProviderClasspathCorrect() - throws Exception { unpack( "surefire-1396-pluggableproviders-classpath" ) .setForkJvm() diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java index 0856482..0d4faf5 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java @@ -19,7 +19,6 @@ package org.apache.maven.surefire.its.jiras; * under the License. */ -import org.apache.maven.it.VerificationException; import org.apache.maven.surefire.its.fixture.OutputValidator; import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireVerifierException; @@ -41,7 +40,6 @@ public class Surefire141PluggableProvidersIT { @BeforeClass public static void installProvider() - throws VerificationException { unpack( Surefire141PluggableProvidersIT.class, "surefire-141-pluggableproviders-provider", "prov" ) .executeInstall(); @@ -49,7 +47,6 @@ public class Surefire141PluggableProvidersIT @Test public void pluggableProviderPresent() - throws Exception { unpack( "surefire-141-pluggableproviders" ) .setForkJvm() @@ -64,7 +61,6 @@ public class Surefire141PluggableProvidersIT @Test public void invokeRuntimeException() - throws Exception { final String errorText = "Let's fail with a runtimeException"; @@ -87,7 +83,6 @@ public class Surefire141PluggableProvidersIT @Test public void invokeReporterException() - throws Exception { final String errorText = "Let's fail with a reporterexception"; @@ -110,7 +105,6 @@ public class Surefire141PluggableProvidersIT @Test public void constructorRuntimeException() - throws Exception { final String errorText = "Let's fail with a runtimeException"; diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java index e05cee7..70484ca 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java @@ -37,8 +37,11 @@ public class Surefire740TruncatedCommaIT @Test public void testRussianLocaleReport() { - OutputValidator validator = unpack( "/surefire-740-comma-truncated" ).setMavenOpts( - "-Duser.language=ru -Duser.country=RU" ).failNever().addSurefireReportGoal().executeCurrentGoals(); + OutputValidator validator = unpack( "/surefire-740-comma-truncated" ) + .setMavenOpts( "-Duser.language=ru -Duser.country=RU" ) + .failNever() + .addSurefireReportGoal() + .executeCurrentGoals(); TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); assertTrue( "Expecting file", siteFile.exists() ); 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 index ea663ab..a5740c0 100644 --- 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 @@ -26,34 +26,29 @@ 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" ); } diff --git a/surefire-its/src/test/resources/settings.xml b/surefire-its/src/test/resources/settings.xml index 991a3e3..ae32218 100644 --- a/surefire-its/src/test/resources/settings.xml +++ b/surefire-its/src/test/resources/settings.xml @@ -17,37 +17,13 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<settings> - <profiles> - <profile> - <id>it-repo</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <repositories> - <repository> - <id>local.central</id> - <url>${localRepositoryUrl}</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>local.central</id> - <url>${localRepositoryUrl}</url> - <releases> - <enabled>true</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - </profile> - </profiles> +<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd"> + <localRepository>file://${maven.repo.local}</localRepository> + <interactiveMode>false</interactiveMode> + <pluginGroups> + <pluginGroup>org.apache.maven.plugins</pluginGroup> + <pluginGroup>org.codehaus.mojo</pluginGroup> + </pluginGroups> </settings> diff --git a/surefire-setup-integration-tests/src/main/resources/toolchains.xml b/surefire-its/src/test/resources/toolchains.xml similarity index 100% rename from surefire-setup-integration-tests/src/main/resources/toolchains.xml rename to surefire-its/src/test/resources/toolchains.xml diff --git a/surefire-setup-integration-tests/pom.xml b/surefire-setup-integration-tests/pom.xml deleted file mode 100644 index 573c537..0000000 --- a/surefire-setup-integration-tests/pom.xml +++ /dev/null @@ -1,279 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire</artifactId> - <version>2.22.1-SNAPSHOT</version> - </parent> - - <artifactId>surefire-setup-integration-tests</artifactId> - - <name>Maven Surefire Integration Test Setup</name> - <description>Creates internal M2 local repository in target/it-repo/. The project is not deployed.</description> - - <properties> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <it.settings.showPasswords>false</it.settings.showPasswords> - <testng.version>5.7</testng.version> - <surefire.threadcount>2</surefire.threadcount> - <surefire.build.version>2.8</surefire.build.version> - </properties> - - <dependencies> - <dependency> - <artifactId>maven-failsafe-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>${project.version}</version> - <type>maven-plugin</type> - </dependency> - <dependency> - <artifactId>maven-surefire-report-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>${project.version}</version> - <type>maven-plugin</type> - </dependency> - <dependency> - <artifactId>maven-surefire-plugin</artifactId> - <groupId>org.apache.maven.plugins</groupId> - <version>${project.version}</version> - <type>maven-plugin</type> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-testng</artifactId> - <version>${project.version}</version> - <exclusions> - <!-- SC don't want our surefire getting confused and trying to use the testng runner --> - <exclusion> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit3</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit4</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit47</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.maven</groupId> - <artifactId>maven-settings</artifactId> - <version>${mavenVersion}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.sourceforge.htmlunit</groupId> - <artifactId>htmlunit</artifactId> - <version>2.8</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.0.1</version> - </dependency> - </dependencies> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - <targetPath>${project.build.outputDirectory}</targetPath> - <excludes> - <exclude>toolchains.xml</exclude> - </excludes> - </resource> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - <targetPath>${project.build.directory}/private</targetPath> - <includes> - <include>toolchains.xml</include> - </includes> - </resource> - </resources> - <plugins> - <plugin> - <artifactId>maven-help-plugin</artifactId> - <executions> - <execution> - <id>settings.xml</id> - <phase>generate-test-resources</phase> - <goals> - <goal>effective-settings</goal> - </goals> - <configuration> - <output>${project.build.directory}/private/settings.xml</output> - <showPasswords>${it.settings.showPasswords}</showPasswords> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-invoker-plugin</artifactId> - <configuration> - <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath> - <extraArtifacts> - <extraArtifact>org.apache.maven.surefire:surefire-testng-utils:${project.version}</extraArtifact> - <extraArtifact>org.testng:testng:4.7:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.0.2:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.1:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.5:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.6:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.7:jar:jdk14</extraArtifact> - <extraArtifact>org.testng:testng:5.7:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.8:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.9:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.10:jar:jdk15</extraArtifact> - <extraArtifact>org.testng:testng:5.12.1</extraArtifact> - <extraArtifact>org.testng:testng:5.13</extraArtifact> - <extraArtifact>org.testng:testng:5.13.1</extraArtifact> - <extraArtifact>org.testng:testng:5.14</extraArtifact> - <extraArtifact>org.testng:testng:5.14.1</extraArtifact> - <extraArtifact>org.testng:testng:5.14.2</extraArtifact> - <extraArtifact>org.testng:testng:5.14.9</extraArtifact> - <extraArtifact>org.testng:testng:6.0</extraArtifact> - <extraArtifact>org.testng:testng:6.5.1</extraArtifact> - <extraArtifact>com.google.inject:guice:3.0:jar:no_aop</extraArtifact> - <extraArtifact>log4j:log4j:1.2.16</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-clean-plugin:2.4.1</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-compiler-plugin:2.3.2</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-compiler-plugin:2.5.1</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-install-plugin:2.3.1</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-compiler-plugin:2.0.2</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-resources-plugin:2.5</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-jar-plugin:2.3.2</extraArtifact> - <extraArtifact>org.apache.commons:commons-email:1.2</extraArtifact> - <extraArtifact>org.codehaus.mojo:build-helper-maven-plugin:1.2</extraArtifact> - <extraArtifact>org.apache.maven.reporting:maven-reporting-api:2.2.1</extraArtifact> - <extraArtifact>commons-collections:commons-collections:3.2</extraArtifact> - <extraArtifact>commons-logging:commons-logging:1.0.4</extraArtifact> - <extraArtifact>xml-apis:xml-apis:1.0.b2</extraArtifact> - <extraArtifact>org.apache.httpcomponents:httpclient:4.0.2</extraArtifact> - <extraArtifact>junit:junit:4.4</extraArtifact> - <extraArtifact>junit:junit:4.5</extraArtifact> - <extraArtifact>junit:junit:4.7</extraArtifact> - <extraArtifact>junit:junit:4.8.1</extraArtifact> - <extraArtifact>junit:junit:4.8.2</extraArtifact> - <extraArtifact>junit:junit:4.11</extraArtifact> - <extraArtifact>junit:junit:4.12</extraArtifact> - <extraArtifact>junit:junit-dep:4.8</extraArtifact> - <extraArtifact>junit:junit-dep:4.7</extraArtifact> - <extraArtifact>junit:junit-dep:4.4</extraArtifact> - <extraArtifact>org.apache.maven.plugins:maven-surefire-plugin:2.10</extraArtifact> - <extraArtifact>org.apache.maven.surefire:surefire-junit3:2.10</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.0.4</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.4.1</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.5.1</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.5.8</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-utils:1.5.15</extraArtifact> - <extraArtifact>org.mockito:mockito-core:1.8.5</extraArtifact> - <extraArtifact>org.powermock:powermock-mockito-release-full:1.6.4:jar:full</extraArtifact> - <extraArtifact>org.codehaus.plexus:plexus-interpolation:1.12</extraArtifact> - <extraArtifact>org.hamcrest:hamcrest-core:1.3</extraArtifact> - <extraArtifact>org.hamcrest:hamcrest-library:1.3</extraArtifact> - <extraArtifact>org.easytesting:fest-assert:1.4</extraArtifact> - </extraArtifacts> - </configuration> - <executions> - <execution> - <goals> - <goal>install</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <!--test>**/SetUpForIntegrationTest</test--> - <!-- Pass current surefire version to the main suite so that it --> - <!-- can forward to all integration test projects. SUREFIRE-513 --> - <systemPropertyVariables> - <surefire.version>${project.version}</surefire.version> - <testng.version>${testng.version}</testng.version> - <maven.home>${maven.home}</maven.home> - <maven.settings.file>${project.build.directory}/private/settings.xml</maven.settings.file> - <maven.staged.local.repo>${project.build.directory}/it-repo</maven.staged.local.repo> - </systemPropertyVariables> - </configuration> - <dependencies> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-shadefire</artifactId> - <version>2.12.4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 --> - </dependency> - </dependencies> - </plugin> - <plugin> - <artifactId>maven-enforcer-plugin</artifactId> - <executions> - <execution> - <id>require-maven-2.1.0</id> - <goals> - <goal>enforce</goal> - </goals> - <configuration> - <rules> - <requireMavenVersion> - <!-- Some plugin features require a recent Maven runtime to work (e.g. SystemPropertiesTest) --> - <version>[2.1.0,)</version> - </requireMavenVersion> - </rules> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <artifactId>maven-install-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <artifactId>maven-deploy-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/SetUpForIntegrationTest.java b/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/SetUpForIntegrationTest.java deleted file mode 100644 index 6a9f585..0000000 --- a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/SetUpForIntegrationTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.maven.surefire.its; -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -import java.io.File; -import java.io.IOException; - -import junit.framework.TestCase; - -/** - * Created by IntelliJ IDEA. - * - * @author Stephen Connolly - * @since 05-Jan-2010 08:17:17 - */ -public class SetUpForIntegrationTest - extends TestCase -{ - public void testSmokes() - throws IOException - { - // if the properties are missing we'll fail the test with an NPE and stop the build. - File originalSettings = new File( System.getProperty( "maven.settings.file" ) ); - File newRepo = new File( System.getProperty( "maven.staged.local.repo" ) ); - File newSettings = new File( originalSettings.getParentFile(), "it-" + originalSettings.getName() ); - StagedLocalRepoHelper.createStagedSettingsXml( originalSettings, newRepo, newSettings ); - } -} diff --git a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java b/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java deleted file mode 100644 index 202d665..0000000 --- a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java +++ /dev/null @@ -1,160 +0,0 @@ -package org.apache.maven.surefire.its; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Random; -import org.apache.maven.settings.Profile; -import org.apache.maven.settings.Repository; -import org.apache.maven.settings.RepositoryPolicy; -import org.apache.maven.settings.Settings; -import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; -import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; -import org.apache.maven.shared.utils.ReaderFactory; -import org.apache.maven.shared.utils.WriterFactory; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - * Helper class to assist in using verifier with a staged local repository. - * - * @author Stephen Connolly - * @since 05-Jan-2010 07:36:22 - */ -public final class StagedLocalRepoHelper -{ - private StagedLocalRepoHelper() - { - throw new IllegalAccessError( "Helper class" ); - } - - private static String toUrl( String filename ) - { - /* - * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here - * as-is but use the decoded path component in the URL. - */ - String url = "file://" + new File( filename ).toURI().getPath(); - if ( url.endsWith( "/" ) ) - { - url = url.substring( 0, url.length() - 1 ); - } - return url; - } - - - public static void createStagedSettingsXml( File originalSettingsXml, File stagedLocalRepo, File stagedSettingsXml ) - throws IOException - { - Random entropy = new Random(); - try - { - System.out.println( Settings.class.getClassLoader() - .getResource( "org/apache/maven/settings/Server.class" ) ); - Settings settings = new SettingsXpp3Reader().read( ReaderFactory.newXmlReader( originalSettingsXml ) ); - - String localRepo = System.getProperty( "maven.repo.local" ); - - if ( localRepo == null ) - { - localRepo = settings.getLocalRepository(); - } - - if ( localRepo == null ) - { - localRepo = System.getProperty( "user.home" ) + "/.m2/repository"; - } - - File repoDir = new File( localRepo ); - - if ( !repoDir.exists() ) - { - repoDir.mkdirs(); - } - - // normalize path - localRepo = repoDir.getAbsolutePath(); - - Profile profile = new Profile(); - do - { - profile.setId( "stagedLocalRepo" + entropy.nextLong() ); - } - while ( settings.getProfilesAsMap().containsKey( profile.getId() ) ); - - Repository repository = new Repository(); - repository.setId( profile.getId() + entropy.nextLong() ); - RepositoryPolicy policy = new RepositoryPolicy(); - policy.setEnabled( true ); - policy.setChecksumPolicy( "ignore" ); - policy.setUpdatePolicy( "never" ); - repository.setReleases( policy ); - repository.setSnapshots( policy ); - repository.setLayout( "default" ); - repository.setName( "Original Local Repository" ); - repository.setUrl( toUrl( localRepo ) ); - profile.addPluginRepository( repository ); - profile.addRepository( repository ); - settings.addProfile( profile ); - settings.addActiveProfile( profile.getId() ); - settings.setLocalRepository( stagedLocalRepo.getAbsolutePath() ); - - for ( Object o : settings.getProfiles() ) - { - profile = (Profile) o; - disableUpdates( profile.getRepositories() ); - disableUpdates( profile.getPluginRepositories() ); - } - - new SettingsXpp3Writer().write( WriterFactory.newXmlWriter( stagedSettingsXml ), settings ); - } - catch ( XmlPullParserException e ) - { - IOException ioe = new IOException( e.getMessage() ); - ioe.initCause( e ); - throw ioe; - } - } - - private static void disableUpdates( List<Repository> repositories ) - { - if ( repositories != null ) - { - for (Repository repo : repositories) { - repo.setReleases(disableUpdates(repo.getReleases())); - repo.setSnapshots(disableUpdates(repo.getSnapshots())); - } - } - } - - private static RepositoryPolicy disableUpdates( RepositoryPolicy policy ) - { - if ( policy == null ) - { - policy = new RepositoryPolicy(); - } - - policy.setUpdatePolicy( "never" ); - - return policy; - } - -}