aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/metadata-store-cassandra
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-26 06:29:55 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-26 06:29:55 +0000
commit24de9b28fb2843b80a35143f76d57373eab592e6 (patch)
treeab58cfde543ce22bb41ab38fa544d01687e1d1ab /archiva-modules/plugins/metadata-store-cassandra
parentfb2d2afe08d4e0d4bda15edca5f40920dc096b34 (diff)
downloadarchiva-24de9b28fb2843b80a35143f76d57373eab592e6.tar.gz
archiva-24de9b28fb2843b80a35143f76d57373eab592e6.zip
add a test to ensure dependant are cleanup up
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581705 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/metadata-store-cassandra')
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java5
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java37
2 files changed, 41 insertions, 1 deletions
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
index 143f49d85..e46675472 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
@@ -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
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
index 89ac59886..30d2049fd 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepositoryTest.java
@@ -19,19 +19,25 @@ package org.apache.archiva.metadata.repository.cassandra;
* 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 CassandraMetadataRepositoryTest
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()