dsbenchmark: final parameters
[controller.git] / benchmark / dsbenchmark / src / main / java / org / opendaylight / dsbenchmark / txchain / TxchainDomDelete.java
index 63e9934bd96829ae24c736653f735260d7da0561..8e32897a042986f2e00fbe54ffab5f1cd79d2fcd 100644 (file)
@@ -8,6 +8,8 @@
 
 package org.opendaylight.dsbenchmark.txchain;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
@@ -27,23 +29,20 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-
 public class TxchainDomDelete extends DatastoreAbstractWriter implements TransactionChainListener {
     private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
     private final DOMDataBroker domDataBroker;
 
-    public TxchainDomDelete(DOMDataBroker domDataBroker, int outerListElem, int innerListElem,
-            long writesPerTx, DataStore dataStore) {
+    public TxchainDomDelete(final DOMDataBroker domDataBroker, final int outerListElem, final int innerListElem,
+            final long writesPerTx, final DataStore dataStore) {
         super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
         this.domDataBroker = domDataBroker;
-        LOG.info("Created TxchainDomDelete");
+        LOG.debug("Created TxchainDomDelete");
     }
 
     @Override
     public void createList() {
-        LOG.info("TxchainDomDelete: creating data in the data store");
+        LOG.debug("TxchainDomDelete: creating data in the data store");
 
         // Dump the whole list into the data store in a single transaction
         // with <outerListElem> PUTs on the transaction
@@ -59,18 +58,19 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
 
     @Override
     public void executeList() {
-        int txSubmitted = 0;
-        int writeCnt = 0;
+        final LogicalDatastoreType dsType = getDataStoreType();
+        final org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
+        final YangInstanceIdentifier pid =
+                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+        final DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
 
-        org.opendaylight.yangtools.yang.common.QName olId = QName.create(OuterList.QNAME, "id");
-        DOMTransactionChain chain = domDataBroker.createTransactionChain(this);
         DOMDataWriteTransaction tx = chain.newWriteOnlyTransaction();
+        int txSubmitted = 0;
+        int writeCnt = 0;
 
-        YangInstanceIdentifier pid =
-                YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
         for (int l = 0; l < outerListElem; l++) {
             YangInstanceIdentifier yid = pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, olId, l));
-            tx.delete(LogicalDatastoreType.CONFIGURATION, yid);
+            tx.delete(dsType, yid);
 
             writeCnt++;
 
@@ -100,27 +100,27 @@ public class TxchainDomDelete extends DatastoreAbstractWriter implements Transac
             txSubmitted++;
             tx.submit().checkedGet();
             txOk++;
-        } catch (TransactionCommitFailedException e) {
+        } catch (final TransactionCommitFailedException e) {
             LOG.error("Transaction failed", e);
             txError++;
         }
         try {
             chain.close();
-        } catch (IllegalStateException e) {
+        } catch (final IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
-        LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
     }
 
     @Override
-    public void onTransactionChainFailed(TransactionChain<?, ?> chain,
-            AsyncTransaction<?, ?> transaction, Throwable cause) {
+    public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
+            final AsyncTransaction<?, ?> transaction, final Throwable cause) {
         LOG.error("Broken chain {} in TxchainDomDelete, transaction {}, cause {}",
                 chain, transaction.getIdentifier(), cause);
     }
 
     @Override
-    public void onTransactionChainSuccessful(TransactionChain<?, ?> chain) {
-        LOG.info("TxchainDomDelete closed successfully, chain {}", chain);
+    public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
+        LOG.debug("TxchainDomDelete closed successfully, chain {}", chain);
     }
 }