Repository: gora Updated Branches: refs/heads/master b26691806 -> 460f9f5b0
Add support to retrieve partitions in aerospike module Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/460f9f5b Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/460f9f5b Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/460f9f5b Branch: refs/heads/master Commit: 460f9f5b0f30b4ddd5d568ea4c381779e9dcf6f3 Parents: b266918 Author: nishadi <ndime...@gmail.com> Authored: Sun Aug 13 19:47:51 2017 +0530 Committer: nishadi <ndime...@gmail.com> Committed: Sun Aug 13 19:47:51 2017 +0530 ---------------------------------------------------------------------- .../gora/aerospike/store/AerospikeStore.java | 15 +++- .../aerospike/store/TestAerospikeStore.java | 85 +++++++++----------- 2 files changed, 53 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/460f9f5b/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java ---------------------------------------------------------------------- diff --git a/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java b/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java index 6775167..0d5e23f 100644 --- a/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java +++ b/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java @@ -45,6 +45,7 @@ import org.apache.gora.persistency.impl.PersistentBase; import org.apache.gora.query.PartitionQuery; import org.apache.gora.query.Query; import org.apache.gora.query.Result; +import org.apache.gora.query.impl.PartitionQueryImpl; import org.apache.gora.store.impl.DataStoreBase; import org.apache.gora.util.AvroUtils; import org.slf4j.Logger; @@ -322,11 +323,21 @@ public class AerospikeStore<K, T extends PersistentBase> extends DataStoreBase<K } /** - * The functionality is not supported as query key ranges are not supported + * {@inheritDoc} + * As the Aerospike does not support query key ranges as at the moment, only the single partition + * is retrieved with this method. + * + * @param query the query to execute. + * @return the list of partitions, one partion at the list as at the moment */ @Override public List<PartitionQuery<K, T>> getPartitions(Query<K, T> query) throws IOException { - return null; + List<PartitionQuery<K, T>> partitions = new ArrayList<>(); + PartitionQueryImpl<K, T> partitionQuery = new PartitionQueryImpl<>( + query); + partitionQuery.setConf(getConf()); + partitions.add(partitionQuery); + return partitions; } @Override http://git-wip-us.apache.org/repos/asf/gora/blob/460f9f5b/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java ---------------------------------------------------------------------- diff --git a/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java b/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java index c1b4e2d..df85258 100644 --- a/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java +++ b/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java @@ -61,27 +61,6 @@ public class TestAerospikeStore extends DataStoreTestBase { } @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testTruncateSchema() throws Exception { - super.testTruncateSchema(); - } - - @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testDeleteSchema() throws Exception { - super.testDeleteSchema(); - } - - @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testSchemaExists() throws Exception { - super.testSchemaExists(); - } - - @Test @Override public void testQuery() throws Exception { // Clearing the test data in the database @@ -94,27 +73,6 @@ public class TestAerospikeStore extends DataStoreTestBase { } @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryStartKey() throws Exception { - super.testQueryStartKey(); - } - - @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryEndKey() throws Exception { - super.testQueryEndKey(); - } - - @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryKeyRange() throws Exception { - super.testQueryKeyRange(); - } - - @Test @Override public void testDelete() throws Exception { // Clearing the test data in the database @@ -156,11 +114,48 @@ public class TestAerospikeStore extends DataStoreTestBase { webPageStore.truncateSchema(); } + // Unsupported functionality due to the limitations in Aerospike java client + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testTruncateSchema() throws Exception { + super.testTruncateSchema(); + } + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testDeleteSchema() throws Exception { + super.testDeleteSchema(); + } + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testSchemaExists() throws Exception { + super.testSchemaExists(); + } + + @Test + @Ignore("Query key ranges based on primary key is not supported via the java client") + @Override + public void testQueryStartKey() throws Exception { + super.testQueryStartKey(); + } + @Test - @Ignore("Functionality is to be implemented in the next iteration") + @Ignore("Query key ranges based on primary key is not supported via the java client") + @Override + public void testQueryEndKey() throws Exception { + super.testQueryEndKey(); + } + + @Test + @Ignore("Query key ranges based on primary key is not supported via the java client") @Override - public void testGetPartitions() throws Exception { - super.testGetPartitions(); + public void testQueryKeyRange() throws Exception { + super.testQueryKeyRange(); } @Test