Fix clustering-test app rpcs to add new data ensuring parents 15/22015/2
authorMoiz Raja <moraja@cisco.com>
Fri, 5 Jun 2015 20:54:35 +0000 (13:54 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 6 Jun 2015 01:31:46 +0000 (01:31 +0000)
The add-person rpc needs to pass true for ensureParents when adding
a person into the datastore. This ensures that it can be called on
an empty model.

Similarly when the CarBought notification is received and we try to
add a car-person to the datastore we need to do it with ensureParents
so that the data can be added to an empty model.

Change-Id: I551038298d635ff6daed0f5dae49a6eda86a24cb
Signed-off-by: Moiz Raja <moraja@cisco.com>
(cherry picked from commit c154b24508a991092771901f0ee444e2c4ba096f)

opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java

index bbaf6becf4b10ceef502005578f1f4311d9ca2cb..a01a858e2a8000f4d515bda3f4002a497c0c07b0 100644 (file)
@@ -53,7 +53,7 @@ public class PeopleCarListener implements CarPurchaseListener {
 
 
     WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
-    tx.put(LogicalDatastoreType.CONFIGURATION, carPersonIId, carPerson);
+    tx.put(LogicalDatastoreType.CONFIGURATION, carPersonIId, carPerson, true);
 
     Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
       @Override
index ef666817e82c21c9b7941b9c3657c166b5502d61..6301188cc70b954645cb36c0d86de796c08421f6 100644 (file)
@@ -62,7 +62,7 @@ public class PeopleProvider implements PeopleService, AutoCloseable {
     final InstanceIdentifier personId = personIdBuilder.build();
     // Place entry in data store tree
     WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
-    tx.put(LogicalDatastoreType.CONFIGURATION, personId, person);
+    tx.put(LogicalDatastoreType.CONFIGURATION, personId, person, true);
 
     Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
       @Override