diff options
author | Carlos Sanchez <csanchez@maestrodev.com> | 2014-11-05 20:11:08 +0100 |
---|---|---|
committer | Carlos Sanchez <carlos@apache.org> | 2014-12-01 16:48:13 +0100 |
commit | e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa (patch) | |
tree | 6477dd5905f983cc3f4cd83580795ab8a7be9ef8 /archiva-modules/plugins/metadata-store-cassandra | |
parent | d9473241c956359325aa10bdbff4e39be284c559 (diff) | |
download | archiva-e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa.tar.gz archiva-e4da1fa6f5a56bbf63bae1de7d1b7dd0ae0375aa.zip |
[MRM-1390] Add REST methods to search JCR store for generic metadata and properties
Added REST methods:
artifactsByProjectVersionMetadata/{key}/{value}
artifactsByMetadata/{key}/{value}
artifactsByProperty/{key}/{value}
searchArtifacts/{text}
searchArtifacts/{key}/{text}
In JCR implementation When searching into any property (key = nil) we can't do exact searchs
Diffstat (limited to 'archiva-modules/plugins/metadata-store-cassandra')
3 files changed, 141 insertions, 6 deletions
diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml index 6a8072c87..83a6b1710 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml +++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml @@ -131,6 +131,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>generic-metadata-support</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <scope>test</scope> 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 f58b429b9..779c19f1c 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 @@ -21,6 +21,7 @@ package org.apache.archiva.metadata.repository.cassandra; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; + import me.prettyprint.cassandra.serializers.LongSerializer; import me.prettyprint.cassandra.serializers.StringSerializer; import me.prettyprint.cassandra.service.template.ColumnFamilyResult; @@ -37,6 +38,7 @@ import me.prettyprint.hector.api.mutation.MutationResult; import me.prettyprint.hector.api.mutation.Mutator; import me.prettyprint.hector.api.query.QueryResult; import me.prettyprint.hector.api.query.RangeSlicesQuery; + import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.CiManagement; @@ -67,6 +69,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.persistence.PersistenceException; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -1823,6 +1826,26 @@ public class CassandraMetadataRepository return artifactMetadataMap.values(); } + @Override + public List<ArtifactMetadata> getArtifactsByProjectVersionMetadata( String key, String value, String repositoryId ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException( "not yet implemented in Cassandra backend" ); + } + + @Override + public List<ArtifactMetadata> getArtifactsByMetadata( String key, String value, String repositoryId ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException( "not yet implemented in Cassandra backend" ); + } + + @Override + public List<ArtifactMetadata> getArtifactsByProperty( String key, String value, String repositoryId ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException( "getArtifactsByProperty not yet implemented in Cassandra backend" ); + } @Override public void removeArtifact( final String repositoryId, final String namespace, final String project, @@ -2174,4 +2197,18 @@ public class CassandraMetadataRepository { return ModelMapperHolder.MODEL_MAPPER; } + + @Override + public List<ArtifactMetadata> searchArtifacts( String text, String repositoryId, boolean exact ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException( "searchArtifacts not yet implemented in Cassandra backend" ); + } + + @Override + public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException( "searchArtifacts not yet implemented in Cassandra backend" ); + } } 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 c26a660e8..97b3718f7 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,21 +19,19 @@ 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.Ignore; 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; @@ -44,8 +42,6 @@ import static org.assertj.core.api.Assertions.assertThat; public class CassandraMetadataRepositoryTest extends AbstractMetadataRepositoryTest { - private Logger logger = LoggerFactory.getLogger( getClass() ); - @Inject @Named(value = "archivaEntityManagerFactory#cassandra") CassandraArchivaManager cassandraArchivaManager; @@ -73,6 +69,103 @@ public class CassandraMetadataRepositoryTest clearReposAndNamespace( cassandraArchivaManager ); } + @Override + @Ignore + public void testGetArtifactsByProjectVersionMetadata() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testGetArtifactsByProjectVersionMetadataNoRepository() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testGetArtifactsByProjectVersionMetadataAllRepositories() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testGetArtifactsByMetadataAllRepositories() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testGetArtifactsByPropertySingleResult() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsByKey() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsByKeyExact() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsFullText() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsFullTextExact() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsByFacetKeyAllRepos() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsByFacetKey() + throws Exception + { + // TODO not implemented + } + + @Override + @Ignore + public void testSearchArtifactsFullTextByFacet() + throws Exception + { + // TODO not implemented + } + + /** * ensure all dependant tables are cleaned up (mailinglist, license, dependencies) * |