Adding multiple data store capabilities to the Tx-Chain DOM writer 46/31246/3
authorJan Medved <jmedved@cisco.com>
Mon, 14 Dec 2015 05:49:52 +0000 (21:49 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 4 Jan 2016 08:42:33 +0000 (08:42 +0000)
Change-Id: I113ef591c9e2813f4cb32e793e85ff63f585c148
Signed-off-by: Jan Medved <jmedved@cisco.com>
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainDomWrite.java

index 902397c3b5a9776c5e8bcbe5df80bcb86f6a18e1..97d9222809c9c8dfc923e5e9014fbeb0e67df739 100644 (file)
@@ -56,6 +56,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
         int writeCnt = 0;
 
         DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
         int writeCnt = 0;
 
         DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
+        LogicalDatastoreType dsType = getDataStoreType();
         DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction();
 
         YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction();
 
         YangInstanceIdentifier pid = YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
@@ -63,9 +64,9 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
             YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
 
             if (oper == StartTestInput.Operation.PUT) {
             YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
 
             if (oper == StartTestInput.Operation.PUT) {
-                tx.put(LogicalDatastoreType.CONFIGURATION, yid, element);
+                tx.put(dsType, yid, element);
             } else {
             } else {
-                tx.merge(LogicalDatastoreType.CONFIGURATION, yid, element);
+                tx.merge(dsType, yid, element);
             }
 
             writeCnt++;
             }
 
             writeCnt++;
@@ -84,6 +85,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
                     }
                 });
                 tx = chain.newWriteOnlyTransaction();
                     }
                 });
                 tx = chain.newWriteOnlyTransaction();
+                dsType = getDataStoreType();
                 writeCnt = 0;
             }
         }
                 writeCnt = 0;
             }
         }
@@ -91,6 +93,7 @@ public class TxchainDomWrite extends DatastoreAbstractWriter implements Transact
         // *** Clean up and close the transaction chain ***
         // Submit the outstanding transaction even if it's empty and wait for it to finish
         // We need to empty the transaction chain before closing it
         // *** Clean up and close the transaction chain ***
         // Submit the outstanding transaction even if it's empty and wait for it to finish
         // We need to empty the transaction chain before closing it
+
         try {
             txSubmitted++;
             tx.submit().checkedGet();
         try {
             txSubmitted++;
             tx.submit().checkedGet();