mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
fb2d2afe08
commit
24de9b28fb
|
@ -67,11 +67,11 @@ public abstract class AbstractMetadataRepositoryTest
|
|||
|
||||
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";
|
||||
|
||||
|
|
|
@ -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,9 +1961,9 @@ public class CassandraMetadataRepository
|
|||
for ( Row<String, String, String> row : result.get() )
|
||||
{
|
||||
this.artifactMetadataTemplate.deleteRow( row.getKey() );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ArtifactMetadata> getArtifacts( final String repoId, final String namespace,
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue