]> source.dussan.org Git - archiva.git/commitdiff
fix removeProject
authorOlivier Lamy <olamy@apache.org>
Thu, 20 Mar 2014 23:23:44 +0000 (23:23 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 20 Mar 2014 23:23:44 +0000 (23:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1579828 13f79535-47bb-0310-9956-ffa450edef68

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

index a08ae5a1099d6615d6fc58b7d42264b029bc213f..31751224cbf197e0927d2051d1ab47ead9e28aec 100644 (file)
@@ -98,7 +98,7 @@ public class CassandraMetadataRepository
             .createRangeSlicesQuery( keyspace, StringSerializer.get(), StringSerializer.get(),
                                      StringSerializer.get() ) //
             .setColumnFamily( cassandraArchivaManager.getRepositoryFamilyName() ) //
-            .setColumnNames(  "repositoryName" ) //
+            .setColumnNames( "repositoryName" ) //
             .addEqualsExpression( "repositoryName", repositoryId ) //
             .execute();
 
@@ -124,7 +124,8 @@ public class CassandraMetadataRepository
 
         }
 
-        return new Repository( result.get().getList().get( 0 ).getColumnSlice().getColumnByName( "repositoryName" ).getValue() );
+        return new Repository(
+            result.get().getList().get( 0 ).getColumnSlice().getColumnByName( "repositoryName" ).getValue() );
     }
 
 
@@ -569,6 +570,17 @@ public class CassandraMetadataRepository
         throws MetadataRepositoryException
     {
 
+        String key = new Project.KeyBuilder() //
+            .withProjectId( projectId ) //
+            .withNamespace( new Namespace( namespaceId, new Repository( repositoryId ) ) ) //
+            .build();
+
+        HFactory.createMutator( cassandraArchivaManager.getKeyspace(), new StringSerializer() ) //
+            .addDeletion( key, cassandraArchivaManager.getProjectFamilyName() ) //
+            .execute();
+
+        // TODO finish linked data to delete
+
 /*        // cleanup ArtifactMetadataModel
         final List<ArtifactMetadataModel> artifactMetadataModels = new ArrayList<ArtifactMetadataModel>();
 
index 403a9326eda7ca418b31ea1ef7233cb3324d57a9..1b1c21fbcfa3c8bea0a589c5592d794a41409239 100644 (file)
@@ -118,6 +118,10 @@ public class RepositoriesNamespaceTest
             Assertions.assertThat( cmr.getProjects( "release", "org" ) ).isNotEmpty().hasSize( 1 ).containsExactly(
                 "theproject" );
 
+            cmr.removeProject( "release", "org", "theproject" );
+
+            Assertions.assertThat( cmr.getProjects( "release", "org" ) ).isEmpty();
+
             cmr.removeRepository( "release" );
 
             r = cmr.getRepository( "release" );