diff options
author | Olivier Lamy <olamy@apache.org> | 2012-06-26 17:24:37 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-06-26 17:24:37 +0000 |
commit | 035a4704d59ca76443b18865dc6ccb52e98b045f (patch) | |
tree | 4321e683ef13c3857ba35ed857c38c9b56d8b75d /archiva-modules/metadata/metadata-repository-api/src | |
parent | d4caedfafb1f824a85171cab3a4f3b0abd96bc4b (diff) | |
download | archiva-035a4704d59ca76443b18865dc6ccb52e98b045f.tar.gz archiva-035a4704d59ca76443b18865dc6ccb52e98b045f.zip |
add unit for deletion of timestamped snapshot
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1354118 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/metadata/metadata-repository-api/src')
-rw-r--r-- | archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java index 2fc5c977e..2d3c9fe99 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java @@ -33,7 +33,6 @@ import org.apache.archiva.metadata.model.ProjectMetadata; import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.model.Scm; import org.fest.assertions.Assertions; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.slf4j.Logger; @@ -1141,6 +1140,49 @@ public abstract class AbstractMetadataRepositoryTest repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ).isEmpty() ); } + @Test + public void deleteSnapshotVersion() + throws Exception + { + ArtifactMetadata artifactOne = createArtifact(); + artifactOne.setVersion( "2.0-20120618.214127-1" ); + artifactOne.setProjectVersion( "2.0-SNAPSHOT" ); + artifactOne.addFacet( new TestMetadataFacet( "value" ) ); + artifactOne.setId( TEST_PROJECT + "-" + "2.0-20120618.214127-1" + "." + "jar" ); + + repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactOne ); + + ArtifactMetadata artifactTwo = createArtifact(); + artifactTwo.setVersion( "2.0-20120618.214135-2" ); + artifactTwo.setProjectVersion( "2.0-SNAPSHOT" ); + artifactTwo.addFacet( new TestMetadataFacet( "value" ) ); + artifactTwo.setId( TEST_PROJECT + "-" + "2.0-20120618.214135-2" + "." + "jar" ); + + repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT", artifactTwo ); + + Collection<ArtifactMetadata> artifactMetadatas = + repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" ); + + Assertions.assertThat( artifactMetadatas ).isNotNull().isNotEmpty().hasSize( 2 ); + + log.info( "artifactMetadatas: {}", artifactMetadatas ); + + //assertEquals( Collections.singletonList( artifact ), new ArrayList<ArtifactMetadata>( + // repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" ) ) ); + + repository.removeArtifact( artifactOne, "2.0-SNAPSHOT" ); + + artifactMetadatas = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" ); + + Assertions.assertThat( artifactMetadatas ).isNotNull().isNotEmpty().hasSize( 1 ); + + repository.removeArtifact( artifactTwo, "2.0-SNAPSHOT" ); + + artifactMetadatas = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, "2.0-SNAPSHOT" ); + + Assertions.assertThat( artifactMetadatas ).isNotNull().isEmpty(); + } + private static ProjectMetadata createProject() { return createProject( TEST_NAMESPACE ); |