Permalink
Browse files

add IT to verify results

NEXUS-5094
  • Loading branch information...
1 parent ffab40c commit 1418fc80e3f55d06a5641f9314b94979daa2ae95 @kellyrob99 kellyrob99 committed May 1, 2013
Showing with 697 additions and 0 deletions.
  1. +33 −0 nexus-core/src/test/java/org/sonatype/nexus/maven/tasks/DefaultSnapshotRemoverIT.java
  2. +32 −0 nexus-core/src/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/maven-metadata.xml
  3. +1 −0 ...s-core/src/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/maven-metadata.xml.md5
  4. +1 −0 ...-core/src/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/maven-metadata.xml.sha1
  5. BIN ...t/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1-alpha.jar
  6. +1 −0 ...sources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1-alpha.jar.md5
  7. +1 −0 ...ources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1-alpha.jar.sha1
  8. +122 −0 ...rc/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1.pom
  9. +1 −0 ...est/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1.pom.md5
  10. +1 −0 ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1.pom.sha1
  11. BIN ...t/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2-alpha.jar
  12. +1 −0 ...sources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2-alpha.jar.md5
  13. +1 −0 ...ources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2-alpha.jar.sha1
  14. +122 −0 ...rc/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2.pom
  15. +1 −0 ...est/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2.pom.md5
  16. +1 −0 ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2.pom.sha1
  17. BIN ...t/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3-alpha.jar
  18. +1 −0 ...sources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3-alpha.jar.md5
  19. +1 −0 ...ources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3-alpha.jar.sha1
  20. +122 −0 ...rc/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3.pom
  21. +1 −0 ...est/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3.pom.md5
  22. +1 −0 ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3.pom.sha1
  23. BIN ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4-beta.jar
  24. +1 −0 ...esources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4-beta.jar.md5
  25. +1 −0 ...sources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4-beta.jar.sha1
  26. +122 −0 ...rc/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4.pom
  27. +1 −0 ...est/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4.pom.md5
  28. +1 −0 ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4.pom.sha1
  29. BIN ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5-beta.jar
  30. +1 −0 ...esources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5-beta.jar.md5
  31. +1 −0 ...sources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5-beta.jar.sha1
  32. +122 −0 ...rc/test/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5.pom
  33. +1 −0 ...est/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5.pom.md5
  34. +1 −0 ...st/resources/reposes/snapshots/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5.pom.sha1
@@ -21,6 +21,8 @@
import org.sonatype.nexus.AbstractMavenRepoContentTests;
import org.sonatype.nexus.proxy.ItemNotFoundException;
import org.sonatype.nexus.proxy.ResourceStoreRequest;
+import org.sonatype.nexus.proxy.access.OpenAccessManager;
+import org.sonatype.nexus.proxy.item.StorageItem;
import org.sonatype.nexus.proxy.maven.MavenRepository;
import org.sonatype.nexus.proxy.maven.metadata.operations.MetadataBuilder;
import org.sonatype.nexus.proxy.maven.metadata.operations.MetadataException;
@@ -30,6 +32,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -741,6 +744,36 @@ public void testEndWithSNAPSHOT()
validateResults( snapshots, expecting );
}
+ /**
+ * This test case uses 3 alpha snapshots and 2 beta snapshots, and after running the task only one of each
+ * artifacts should still be present.
+ * @see <a href='https://issues.sonatype.org/browse/NEXUS-3148'>NEXUS-5094</a>
+ */
+ @Test
+ public void testSnapshotsWithClassifiers()
+ throws Exception
+ {
+ fillInRepo();
+
+ SnapshotRemovalRequest request = new SnapshotRemovalRequest( snapshots.getId(), 1, -1, false );
+ SnapshotRemovalResult snapshotRemovalResult = defaultNexus.removeSnapshots( request );
+ assertThat( snapshotRemovalResult.isSuccessful(), is( true ) );
+
+ HashMap<String, Boolean> expecting = new HashMap<String, Boolean>();
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1-alpha.jar", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154949-1.pom", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2-alpha.jar", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154953-2.pom", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3-alpha.jar", true );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.154956-3.pom", true );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4-beta.jar", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155001-4.pom", false );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5-beta.jar", true );
+ expecting.put( "/org/sonatype/test/1.0-SNAPSHOT/test-1.0-20130501.155005-5.pom", true );
+
+ validateResults( snapshots, expecting );
+ }
+
private Metadata readMavenMetadata( File mdFle )
throws MetadataException, IOException
{
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata modelVersion="1.1.0">
+ <groupId>org.sonatype</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20130501.155005</timestamp>
+ <buildNumber>5</buildNumber>
+ </snapshot>
+ <lastUpdated>20130501155005</lastUpdated>
+ <snapshotVersions>
+ <snapshotVersion>
+ <extension>pom</extension>
+ <value>1.0-20130501.155005-5</value>
+ <updated>20130501155005</updated>
+ </snapshotVersion>
+ <snapshotVersion>
+ <classifier>alpha</classifier>
+ <extension>jar</extension>
+ <value>1.0-20130501.154956-3</value>
+ <updated>20130501154956</updated>
+ </snapshotVersion>
+ <snapshotVersion>
+ <classifier>beta</classifier>
+ <extension>jar</extension>
+ <value>1.0-20130501.155005-5</value>
+ <updated>20130501155005</updated>
+ </snapshotVersion>
+ </snapshotVersions>
+ </versioning>
+</metadata>
@@ -0,0 +1 @@
+99d9bb8d5e12b1bf824604066f439bc1
@@ -0,0 +1 @@
+5bb5a4024fcd907d99da73c263a54ab02dd62d96
@@ -0,0 +1 @@
+f5c4ef7c78a8bd6c136ec3e6ab45cbfc
@@ -0,0 +1 @@
+e68f95d461e6b9228bd73f8c7d5452f12e6dbe68
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.sonatype</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+
+ <packaging>jar</packaging>
+
+ <name>release-remover-test</name>
+
+ <properties>
+ <classifier>alpha</classifier>
+ </properties>
+
+ <distributionManagement>
+ <!-- use the following if you're not using a snapshot version. -->
+ <repository>
+ <id>staging-nexus</id>
+ <name>RepositoryProxyRel</name>
+ <url>http://localhost:8081/nexus/content/repositories/releases/</url>
+ </repository>
+ <snapshotRepository>
+ <id>staging-nexus</id>
+ <name>RepositoryProxyRel</name>
+ <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.8.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit-dep</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!-- Have to set source level to at least Java5, we use annotations (Nexus requries 1.6) -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <!--<configuration>-->
+ <!--<skip>true</skip>-->
+ <!--</configuration>-->
+ </plugin>
+
+ <!-- NEXUS-5094 Purging snapshot task should take into account classifier -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>${classifier}</classifier>
+ </configuration>
+ </plugin>
+
+ <!--<plugin>-->
+ <!--<groupId>org.sonatype.plugins</groupId>-->
+ <!--<artifactId>nexus-staging-maven-plugin</artifactId>-->
+ <!--<version>1.4.4</version>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<goals>-->
+ <!--<goal>deploy</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+ <!--<serverId>staging-nexus</serverId>-->
+ <!--<nexusUrl>http://localhost:8081/nexus/</nexusUrl>-->
+
+ <!--&lt;!&ndash; explicit matching using the staging profile id &ndash;&gt;-->
+ <!--<stagingProfileId>12f36b985ec40644</stagingProfileId>-->
+
+ <!--</configuration>-->
+ <!--</plugin>-->
+ </plugins>
+ </build>
+
+</project>
@@ -0,0 +1 @@
+c84ba04ce87a11fb89f8aae1008ac478
@@ -0,0 +1 @@
+49350cf225c3eed4381a797b33d30f5ca74b07d0
@@ -0,0 +1 @@
+f5c4ef7c78a8bd6c136ec3e6ab45cbfc
@@ -0,0 +1 @@
+e68f95d461e6b9228bd73f8c7d5452f12e6dbe68
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.sonatype</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+
+ <packaging>jar</packaging>
+
+ <name>release-remover-test</name>
+
+ <properties>
+ <classifier>alpha</classifier>
+ </properties>
+
+ <distributionManagement>
+ <!-- use the following if you're not using a snapshot version. -->
+ <repository>
+ <id>staging-nexus</id>
+ <name>RepositoryProxyRel</name>
+ <url>http://localhost:8081/nexus/content/repositories/releases/</url>
+ </repository>
+ <snapshotRepository>
+ <id>staging-nexus</id>
+ <name>RepositoryProxyRel</name>
+ <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.8.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.5.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit-dep</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!-- Have to set source level to at least Java5, we use annotations (Nexus requries 1.6) -->
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <!--<configuration>-->
+ <!--<skip>true</skip>-->
+ <!--</configuration>-->
+ </plugin>
+
+ <!-- NEXUS-5094 Purging snapshot task should take into account classifier -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>${classifier}</classifier>
+ </configuration>
+ </plugin>
+
+ <!--<plugin>-->
+ <!--<groupId>org.sonatype.plugins</groupId>-->
+ <!--<artifactId>nexus-staging-maven-plugin</artifactId>-->
+ <!--<version>1.4.4</version>-->
+ <!--<executions>-->
+ <!--<execution>-->
+ <!--<goals>-->
+ <!--<goal>deploy</goal>-->
+ <!--</goals>-->
+ <!--</execution>-->
+ <!--</executions>-->
+ <!--<configuration>-->
+ <!--<serverId>staging-nexus</serverId>-->
+ <!--<nexusUrl>http://localhost:8081/nexus/</nexusUrl>-->
+
+ <!--&lt;!&ndash; explicit matching using the staging profile id &ndash;&gt;-->
+ <!--<stagingProfileId>12f36b985ec40644</stagingProfileId>-->
+
+ <!--</configuration>-->
+ <!--</plugin>-->
+ </plugins>
+ </build>
+
+</project>
@@ -0,0 +1 @@
+c84ba04ce87a11fb89f8aae1008ac478
@@ -0,0 +1 @@
+49350cf225c3eed4381a797b33d30f5ca74b07d0
@@ -0,0 +1 @@
+f5c4ef7c78a8bd6c136ec3e6ab45cbfc
@@ -0,0 +1 @@
+e68f95d461e6b9228bd73f8c7d5452f12e6dbe68
Oops, something went wrong.

0 comments on commit 1418fc8

Please sign in to comment.