]> source.dussan.org Git - archiva.git/commitdiff
fix remove artifact
authorOlivier Lamy <olamy@apache.org>
Mon, 24 Mar 2014 03:17:49 +0000 (03:17 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 24 Mar 2014 03:17:49 +0000 (03:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1580720 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java

index 20f8f9664c298668096f0b1cd2b9bb2c72ead64a..ffec0fd5faf51470c1028c4fcbb5550d8d3596a2 100644 (file)
@@ -1238,8 +1238,8 @@ public abstract class AbstractMetadataRepositoryTest
 
         Assertions.assertThat( versions ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "2.0" );
 
-        assertTrue(
-            repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ).isEmpty() );
+        Assertions.assertThat( repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
+                                                        TEST_PROJECT_VERSION )).isNotNull().isEmpty();
 
         Assertions.assertThat( repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT,
                                                         TEST_PROJECT_VERSION_2_0 ) ).isNotEmpty().hasSize( 1 );
index fd2eed9369802769c7c8ededd1dc9f3edeeb0c16..31e99150ef61b56dc4d9a93f0003041a74298694 100644 (file)
@@ -1841,25 +1841,23 @@ public class CassandraMetadataRepository
                                 final String version, final String id )
         throws MetadataRepositoryException
     {
-/*        logger.debug( "removeArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
+        logger.debug( "removeArtifact repositoryId: '{}', namespace: '{}', project: '{}', version: '{}', id: '{}'",
                       repositoryId, namespace, project, version, id );
         String key =
             new ArtifactMetadataModel.KeyBuilder().withRepositoryId( repositoryId ).withNamespace( namespace ).withId(
                 id ).withProjectVersion( version ).withProject( project ).build();
 
-        ArtifactMetadataModel artifactMetadataModel = new ArtifactMetadataModel();
-        artifactMetadataModel.setArtifactMetadataModelId( key );
 
-        getArtifactMetadataModelEntityManager().remove( artifactMetadataModel );
+        Keyspace keyspace = cassandraArchivaManager.getKeyspace();
+
+        this.artifactMetadataTemplate.deleteRow( key );
 
         key =
             new ProjectVersionMetadataModel.KeyBuilder().withId( version ).withRepository( repositoryId ).withNamespace(
                 namespace ).withProjectId( project ).build();
 
-        ProjectVersionMetadataModel projectVersionMetadataModel = new ProjectVersionMetadataModel();
-        projectVersionMetadataModel.setRowId( key );
+        this.projectVersionMetadataModelTemplate.deleteRow( key );
 
-        getProjectVersionMetadataModelEntityManager().remove( projectVersionMetadataModel );*/
     }
 
     @Override
@@ -1919,9 +1917,6 @@ public class CassandraMetadataRepository
         Keyspace keyspace = cassandraArchivaManager.getKeyspace();
         StringSerializer ss = StringSerializer.get();
 
-        // cql cannot run or in queries so running twice the query
-
-
         RangeSlicesQuery<String, String, String> query = HFactory //
             .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
             .setColumnFamily( cassandraArchivaManager.getArtifactMetadataModelFamilyName() ) //