gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djkevi...@apache.org
Subject [22/32] gora git commit: Add persistent base dirty check
Date Thu, 27 Jul 2017 18:45:48 GMT
Add persistent base dirty check


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/390a4358
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/390a4358
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/390a4358

Branch: refs/heads/master
Commit: 390a4358394c91b08ac7903d69689a62cc8c0fc8
Parents: c485f5b
Author: nishadi <ndimeshi@gmail.com>
Authored: Sat Jul 22 08:13:40 2017 +0530
Committer: nishadi <ndimeshi@gmail.com>
Committed: Sat Jul 22 08:13:40 2017 +0530

----------------------------------------------------------------------
 .../apache/gora/aerospike/store/AerospikeStore.java   | 11 ++++++++++-
 .../gora/aerospike/store/TestAerospikeStore.java      | 14 --------------
 2 files changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/390a4358/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 dfa8ed9..56f2bdb 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
@@ -177,7 +177,14 @@ public class AerospikeStore<K, T extends PersistentBase> extends
DataStoreBase<K
     Key recordKey = getAerospikeKey(key);
 
     List<Field> fields = persistent.getSchema().getFields();
+
+    if (aerospikeClient.exists(null, recordKey)) {
+      this.delete(key);
+    }
     for (int i = 0; i < fields.size(); i++) {
+      if (!persistent.isDirty(i)) {
+        continue;
+      }
       Object persistentValue = persistent.get(i);
       if (persistentValue != null) {
         String mappingBinName = aerospikeParameters.getAerospikeMapping().getBinMapping()
@@ -269,7 +276,7 @@ public class AerospikeStore<K, T extends PersistentBase> extends
DataStoreBase<K
     }
 
     // Query execution for key ranges
-    // ToDo: Implement for other scenarios
+    // ToDo: Implement Query execution for key ranges
     else if (query.getStartKey() != null && query.getEndKey() != null) {
 //      Key startKey = null, endKey = null;
 //      if (query.getStartKey() != null) {
@@ -335,6 +342,7 @@ public class AerospikeStore<K, T extends PersistentBase> extends
DataStoreBase<K
     stmt.setSetName(set);
     return stmt;
   }
+
   /**
    * Method to close aerospike client connections to database server nodes
    */
@@ -424,6 +432,7 @@ public class AerospikeStore<K, T extends PersistentBase> extends
DataStoreBase<K
     for (String field : fields) {
       setPersistentField(field, record, persistent);
     }
+    persistent.setDirty();
     return persistent;
   }
 

http://git-wip-us.apache.org/repos/asf/gora/blob/390a4358/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 d88ea1a..9e38e4d 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
@@ -76,20 +76,6 @@ public class TestAerospikeStore extends DataStoreTestBase {
   }
 
   @Test
-  @Ignore("Functionality is to be implemented in the next iteration")
-  @Override
-  public void testUpdate() throws Exception {
-    super.testUpdate();
-  }
-
-  @Test
-  @Ignore("Functionality is to be implemented in the next iteration")
-  @Override
-  public void testEmptyUpdate() throws Exception {
-    super.testEmptyUpdate();
-  }
-
-  @Test
   @Override
   public void testQuery() throws Exception {
     // Clearing the test data in the database


Mime
View raw message