diff options
author | Olivier Lamy <olamy@apache.org> | 2014-03-26 02:41:06 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-03-26 02:41:06 +0000 |
commit | 122145013ef5d19d2c8b955c7f9008ed4b2ed879 (patch) | |
tree | b277dad0a24ed0b4012444b82311a46ba452fcc9 /archiva-modules | |
parent | 509e72be48c2930dfc2b3b6656d80d3503c7fdf7 (diff) | |
download | archiva-122145013ef5d19d2c8b955c7f9008ed4b2ed879.tar.gz archiva-122145013ef5d19d2c8b955c7f9008ed4b2ed879.zip |
should return null if no facets found
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
3 files changed, 16 insertions, 7 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java index 4734a2a71..06add9a0f 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java @@ -743,14 +743,14 @@ public abstract class AbstractMetadataRepositoryTest throws Exception { List<String> facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID ); - assertTrue( facets.isEmpty() ); - assertNull( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ); + assertThat( facets ).isNotNull().isEmpty(); + assertThat( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull(); repository.removeMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ); facets = repository.getMetadataFacets( TEST_REPO_ID, TEST_FACET_ID ); - assertTrue( facets.isEmpty() ); - assertNull( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ); + assertThat( facets ).isNotNull().isEmpty(); + assertThat( repository.getMetadataFacet( TEST_REPO_ID, TEST_FACET_ID, TEST_NAME ) ).isNull(); } @Test 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 6e4794432..08a1a7c4a 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 @@ -1300,7 +1300,8 @@ public class CassandraMetadataRepository addInsertion( dependencyMutator, keyDependency, cfDependency, "version", dependency.getVersion() ); - } dependencyMutator.execute(); + } + dependencyMutator.execute(); } protected void removeDependencies( String projectVersionMetadataKey ) @@ -1334,7 +1335,8 @@ public class CassandraMetadataRepository for ( Row<String, String, String> row : result.get() ) { - ColumnFamilyResult<String, String> columnFamilyResult = this.dependencyTemplate.queryColumns( row.getKey() ); + ColumnFamilyResult<String, String> columnFamilyResult = + this.dependencyTemplate.queryColumns( row.getKey() ); Dependency dependency = new Dependency(); dependency.setClassifier( columnFamilyResult.getString( "classifier" ) ); @@ -1595,7 +1597,12 @@ public class CassandraMetadataRepository .execute(); MetadataFacet metadataFacet = metadataFacetFactory.createMetadataFacet( repositoryId, name ); - Map<String, String> map = new HashMap<String, String>( result.get().getCount() ); + int size = result.get().getCount(); + if ( size < 1 ) + { + return null; + } + Map<String, String> map = new HashMap<String, String>( size ); for ( Row<String, String, String> row : result.get() ) { ColumnSlice<String, String> columnSlice = row.getColumnSlice(); 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 e43f5afce..89ac59886 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 @@ -80,8 +80,10 @@ public class CassandraMetadataRepositoryTest { cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), cassandraArchivaManager.getProjectFamilyName() ); + cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), cassandraArchivaManager.getNamespaceFamilyName() ); + cassandraArchivaManager.getCluster().truncate( cassandraArchivaManager.getKeyspace().getKeyspaceName(), cassandraArchivaManager.getRepositoryFamilyName() ); |