archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1581705 - in /archiva/trunk/archiva-modules: metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/ plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/ plugins/me...
Date Wed, 26 Mar 2014 06:29:56 GMT
Author: olamy
Date: Wed Mar 26 06:29:55 2014
New Revision: 1581705

URL: http://svn.apache.org/r1581705
Log:
add a test to ensure dependant are cleanup up

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

Modified: archiva/trunk/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java?rev=1581705&r1=1581704&r2=1581705&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
(original)
+++ archiva/trunk/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
Wed Mar 26 06:29:55 2014
@@ -67,11 +67,11 @@ public abstract class AbstractMetadataRe
 
     protected static final String TEST_REPO_ID = "test";
 
-    private static final String TEST_PROJECT = "projectId";
+    protected static final String TEST_PROJECT = "projectId";
 
-    private static final String TEST_NAMESPACE = "namespace";
+    protected static final String TEST_NAMESPACE = "namespace";
 
-    private static final String TEST_PROJECT_VERSION = "1.0";
+    protected static final String TEST_PROJECT_VERSION = "1.0";
 
     private static final String TEST_PROJECT_VERSION_2_0 = "2.0";
 

Modified: archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java?rev=1581705&r1=1581704&r2=1581705&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
(original)
+++ archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
Wed Mar 26 06:29:55 2014
@@ -1941,6 +1941,9 @@ public class CassandraMetadataRepository
         for ( Row<String, String, String> row : result.get().getList() )
         {
             this.projectVersionMetadataTemplate.deleteRow( row.getKey() );
+            removeMailingList( row.getKey() );
+            removeLicenses( row.getKey() );
+            removeDependencies( row.getKey() );
         }
 
         RangeSlicesQuery<String, String, String> query = HFactory //
@@ -1958,8 +1961,8 @@ public class CassandraMetadataRepository
         for ( Row<String, String, String> row : result.get() )
         {
             this.artifactMetadataTemplate.deleteRow( row.getKey() );
-        }
 
+        }
     }
 
     @Override

Modified: archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java?rev=1581705&r1=1581704&r2=1581705&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
(original)
+++ archiva/trunk/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
Wed Mar 26 06:29:55 2014
@@ -19,19 +19,25 @@ package org.apache.archiva.metadata.repo
  * under the License.
  */
 
+import org.apache.archiva.metadata.model.MailingList;
 import org.apache.archiva.metadata.model.MetadataFacetFactory;
 import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest;
+import org.apache.archiva.metadata.repository.cassandra.model.ProjectVersionMetadataModel;
 import org.apache.commons.io.FileUtils;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.inject.Inject;
 import javax.inject.Named;
 import java.io.File;
+import java.util.List;
 import java.util.Map;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /**
  * @author Olivier Lamy
  */
@@ -66,6 +72,37 @@ public class CassandraMetadataRepository
         clearReposAndNamespace();
     }
 
+    /**
+     * ensure all dependant tables are cleaned up (mailinglist, license, dependencies)
+     *
+     * @throws Exception
+     */
+    @Test
+    public void clean_dependant_tables()
+        throws Exception
+    {
+
+        super.testUpdateProjectVersionMetadataWithAllElements();
+
+        String key = new ProjectVersionMetadataModel.KeyBuilder().withRepository( TEST_REPO_ID
) //
+            .withNamespace( TEST_NAMESPACE ) //
+            .withProjectId( TEST_PROJECT ) //
+            .withProjectVersion( TEST_PROJECT_VERSION ) //
+            .withId( TEST_PROJECT_VERSION ) //
+            .build();
+
+        this.cmr.removeProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION
);
+
+        assertThat(
+            repository.getProjectVersion( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION
) ).isNull();
+
+        assertThat( cmr.getMailingLists( key ) ).isNotNull().isEmpty();
+
+        assertThat( cmr.getLicenses( key ) ).isNotNull().isEmpty();
+
+        assertThat( cmr.getDependencies( key ) ).isNotNull().isEmpty();
+    }
+
 
     @After
     public void shutdown()



Mime
View raw message