From 79a5c280fee53445c9d2807ce0716477631fa800 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 5 Dec 2011 10:37:48 +0000 Subject: [PATCH] enhance it to add a use where a SNAPSHOT has been installed locally and ensure now it's a -SNAPSHOT rather than a timestamped one. git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@1210404 13f79535-47bb-0310-9956-ffa450edef68 --- .../MavenIT0146InstallerSnapshotNaming.java | 48 +++++++++++++++---- .../src/test/resources/it0146/pom.xml | 1 + .../src/test/resources/it0146/project/pom.xml | 30 ++++++++++++ .../project/src/main/resources/empty.txt | 1 + 4 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 its/core-it-suite/src/test/resources/it0146/project/pom.xml create mode 100644 its/core-it-suite/src/test/resources/it0146/project/src/main/resources/empty.txt diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java index 50d6ceecd1..f0f0433470 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0146InstallerSnapshotNaming.java @@ -19,21 +19,16 @@ package org.apache.maven.it; * under the License. */ -import org.apache.maven.it.util.FileUtils; import org.apache.maven.it.util.ResourceExtractor; import org.mortbay.jetty.Handler; import org.mortbay.jetty.Server; import org.mortbay.jetty.handler.DefaultHandler; import org.mortbay.jetty.handler.HandlerList; import org.mortbay.jetty.handler.ResourceHandler; -import org.mortbay.resource.FileResource; -import org.mortbay.resource.Resource; import java.io.File; import java.io.IOException; import java.net.InetAddress; -import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.util.Properties; public class MavenIT0146InstallerSnapshotNaming @@ -60,7 +55,6 @@ public class MavenIT0146InstallerSnapshotNaming ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() ); - // org/apache/maven/its/it0146/dep/0.1-SNAPSHOT/maven-metadata.xml HandlerList handlers = new HandlerList(); handlers.setHandlers( new Handler[]{ resourceHandler, new DefaultHandler() } ); @@ -73,7 +67,6 @@ public class MavenIT0146InstallerSnapshotNaming } - protected void tearDown() throws Exception { @@ -102,7 +95,6 @@ public class MavenIT0146InstallerSnapshotNaming verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); - verifier.getCliOptions().add( "--settings" ); verifier.getCliOptions().add( "settings.xml" ); @@ -120,4 +112,44 @@ public class MavenIT0146InstallerSnapshotNaming } + + public void testitNonTimestampedNameWithInstalledSNAPSHOT() + throws Exception + { + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.deleteArtifacts( "org.apache.maven.its.it0146" ); + verifier.getCliOptions().add( "-f" ); + verifier.getCliOptions().add( "project/pom.xml" ); + verifier.deleteDirectory( "project/target" ); + verifier.setLogFileName( "log2.txt" ); + + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( testDir.getAbsolutePath() ); + + Properties properties = verifier.newDefaultFilterProperties(); + properties.setProperty( "@host@", InetAddress.getLocalHost().getCanonicalHostName() ); + properties.setProperty( "@port@", Integer.toString( port ) ); + + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties ); + + verifier.getCliOptions().add( "--settings" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.setLogFileName( "log3.txt" ); + + + verifier.getCliOptions().add( "-X" ); + + verifier.deleteDirectory( "target" ); + + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertFilePresent( "target/appassembler/repo/dep-0.1-SNAPSHOT.jar" ); + + } } diff --git a/its/core-it-suite/src/test/resources/it0146/pom.xml b/its/core-it-suite/src/test/resources/it0146/pom.xml index bae07dcb27..cdb5c29a07 100644 --- a/its/core-it-suite/src/test/resources/it0146/pom.xml +++ b/its/core-it-suite/src/test/resources/it0146/pom.xml @@ -29,6 +29,7 @@ under the License. Maven Integration Test :: it-0146 Verify that download remote snapshot are correctly installed locally via Installer with timestamped name. + see issue related in this thread: http://mail-archives.apache.org/mod_mbox/maven-dev/201112.mbox/%3cCAPCjjnHjsQED0tzUztwWtQcSpYVN_k0-0Xq2B7QxTN5arZ-xzA@mail.gmail.com%3e diff --git a/its/core-it-suite/src/test/resources/it0146/project/pom.xml b/its/core-it-suite/src/test/resources/it0146/project/pom.xml new file mode 100644 index 0000000000..d5144c8339 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0146/project/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it0146 + dep + 0.1-SNAPSHOT + jar + + diff --git a/its/core-it-suite/src/test/resources/it0146/project/src/main/resources/empty.txt b/its/core-it-suite/src/test/resources/it0146/project/src/main/resources/empty.txt new file mode 100644 index 0000000000..7a2abe6ccc --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0146/project/src/main/resources/empty.txt @@ -0,0 +1 @@ +empty file \ No newline at end of file