From 1f42a01fb0238c1fd7fabcb485bb8adf475f6e2c Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Sun, 23 Nov 2014 20:40:55 +0100 Subject: [PATCH] Remove duplicated cleanup in tests --- .../CassandraMetadataRepositoryTest.java | 6 +++--- .../cassandra/RepositoriesNamespaceTest.java | 17 +++-------------- 2 files changed, 6 insertions(+), 17 deletions(-) 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 57bd33d5f..c26a660e8 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 @@ -70,7 +70,7 @@ public class CassandraMetadataRepositoryTest this.cmr = new CassandraMetadataRepository( factories, null, cassandraArchivaManager ); this.repository = this.cmr; - clearReposAndNamespace(); + clearReposAndNamespace( cassandraArchivaManager ); } /** @@ -109,11 +109,11 @@ public class CassandraMetadataRepositoryTest public void shutdown() throws Exception { - clearReposAndNamespace(); + clearReposAndNamespace( cassandraArchivaManager ); super.tearDown(); } - protected void clearReposAndNamespace() + static void clearReposAndNamespace( CassandraArchivaManager cassandraArchivaManager ) throws Exception { cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java index 547d3e863..3a999c0fb 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/RepositoriesNamespaceTest.java @@ -61,14 +61,14 @@ public class RepositoriesNamespaceTest { cassandraArchivaManager.start(); } - clearReposAndNamespace(); + CassandraMetadataRepositoryTest.clearReposAndNamespace( cassandraArchivaManager ); } @After public void shutdown() throws Exception { - clearReposAndNamespace(); + CassandraMetadataRepositoryTest.clearReposAndNamespace( cassandraArchivaManager ); cassandraArchivaManager.shutdown(); } @@ -136,18 +136,7 @@ public class RepositoriesNamespaceTest } finally { - clearReposAndNamespace(); + CassandraMetadataRepositoryTest.clearReposAndNamespace( cassandraArchivaManager ); } } - - protected void clearReposAndNamespace() - throws Exception - { - cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), - "project" ); - cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), - "namespace" ); - cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), - "repository" ); - } } -- 2.39.5