X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=benchmark%2Fdsbenchmark%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fdsbenchmark%2FDsbenchmarkProvider.java;h=91c53ccf919eb2d15dcf81d56e4b63ef558021e2;hp=229eddfa0c75d64cad49e3b443b93627c1b7a6c4;hb=793318ca32e9180614b68625eebb7dad902bf120;hpb=3aec565ce7dcee05e500a4334436847e5a1c33c2 diff --git a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java index 229eddfa0c..91c53ccf91 100644 --- a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java +++ b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/DsbenchmarkProvider.java @@ -8,14 +8,10 @@ package org.opendaylight.dsbenchmark; import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import java.util.Collections; -import java.util.concurrent.Future; +import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.dsbenchmark.listener.DsbenchmarkListenerProvider; import org.opendaylight.dsbenchmark.simpletx.SimpletxBaDelete; import org.opendaylight.dsbenchmark.simpletx.SimpletxBaRead; @@ -29,6 +25,13 @@ import org.opendaylight.dsbenchmark.txchain.TxchainBaWrite; import org.opendaylight.dsbenchmark.txchain.TxchainDomDelete; import org.opendaylight.dsbenchmark.txchain.TxchainDomRead; import org.opendaylight.dsbenchmark.txchain.TxchainDomWrite; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.CleanupStoreOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.DsbenchmarkService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestOutput; @@ -90,14 +93,14 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable { } @Override - public Future> cleanupStore() { + public ListenableFuture> cleanupStore(final CleanupStoreInput input) { cleanupTestStore(); LOG.debug("Data Store cleaned up"); - return Futures.immediateFuture(RpcResultBuilder.success().build()); + return Futures.immediateFuture(RpcResultBuilder.success(new CleanupStoreOutputBuilder().build()).build()); } @Override - public Future> startTest(final StartTestInput input) { + public ListenableFuture> startTest(final StartTestInput input) { LOG.info("Starting the data store benchmark test, input: {}", input); // Check if there is a test in progress @@ -172,8 +175,8 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable { tx.put(LogicalDatastoreType.OPERATIONAL, TEST_STATUS_IID, status); try { - tx.submit().checkedGet(); - } catch (final TransactionCommitFailedException e) { + tx.commit().get(); + } catch (final InterruptedException | ExecutionException e) { throw new IllegalStateException(e); } @@ -188,9 +191,9 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable { WriteTransaction tx = simpleTxDataBroker.newWriteOnlyTransaction(); tx.put(LogicalDatastoreType.CONFIGURATION, TEST_EXEC_IID, data); try { - tx.submit().checkedGet(); + tx.commit().get(); LOG.debug("DataStore config test data cleaned up"); - } catch (final TransactionCommitFailedException e) { + } catch (final InterruptedException | ExecutionException e) { LOG.info("Failed to cleanup DataStore configtest data"); throw new IllegalStateException(e); } @@ -198,9 +201,9 @@ public class DsbenchmarkProvider implements DsbenchmarkService, AutoCloseable { tx = simpleTxDataBroker.newWriteOnlyTransaction(); tx.put(LogicalDatastoreType.OPERATIONAL, TEST_EXEC_IID, data); try { - tx.submit().checkedGet(); + tx.commit().get(); LOG.debug("DataStore operational test data cleaned up"); - } catch (final TransactionCommitFailedException e) { + } catch (final InterruptedException | ExecutionException e) { LOG.info("Failed to cleanup DataStore operational test data"); throw new IllegalStateException(e); }