X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FDOMBrokerPerformanceTest.java;h=2a7c8b6682cbdaf0a9f0a8ff7cd194a9f22c5c12;hp=2dec6f2e4d1bdf773001c66343c8cf1ad4549160;hb=3927509ec3ecfa32a51b725d2b7155d425f5b877;hpb=3d81e6fb622fb7d5b239a8697d51bcb6d96658db diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java index 2dec6f2e4d..2a7c8b6682 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java +++ b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMBrokerPerformanceTest.java @@ -4,12 +4,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION; import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL; - +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.Executors; - import org.junit.Before; import org.junit.Test; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; @@ -18,20 +22,13 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.md.sal.dom.store.impl.TestModel; import org.opendaylight.controller.sal.core.spi.data.DOMStore; -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; - public class DOMBrokerPerformanceTest { private static final Logger log = LoggerFactory.getLogger(DOMBrokerPerformanceTest.class); @@ -40,14 +37,14 @@ public class DOMBrokerPerformanceTest { return ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i); } - private static InstanceIdentifier outerListPath(final int i) { - return InstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)// + private static YangInstanceIdentifier outerListPath(final int i) { + return YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)// .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, i) // .build(); } private SchemaContext schemaContext; - private DOMDataBrokerImpl domBroker; + private AbstractDOMDataBroker domBroker; private static V measure(final String name, final Callable callable) throws Exception { // TODO Auto-generated method stub @@ -63,8 +60,8 @@ public class DOMBrokerPerformanceTest { @Before public void setupStore() { - InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.sameThreadExecutor()); - InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.sameThreadExecutor()); + InMemoryDOMDataStore operStore = new InMemoryDOMDataStore("OPER", MoreExecutors.newDirectExecutorService()); + InMemoryDOMDataStore configStore = new InMemoryDOMDataStore("CFG", MoreExecutors.newDirectExecutorService()); schemaContext = TestModel.createTestContext(); operStore.onGlobalContextUpdated(schemaContext); @@ -75,7 +72,7 @@ public class DOMBrokerPerformanceTest { .put(OPERATIONAL, operStore) // .build(); ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); - domBroker = new DOMDataBrokerImpl(stores, executor); + domBroker = new SerializedDOMDataBroker(stores, executor); } @Test @@ -141,11 +138,11 @@ public class DOMBrokerPerformanceTest { int i = 0; for (DOMDataReadWriteTransaction writeTx :transactions) { // Writes /test/outer-list/i in writeTx - InstanceIdentifier path = InstanceIdentifier.builder(outerListPath(i)) + YangInstanceIdentifier path = YangInstanceIdentifier.builder(outerListPath(i)) .node(TestModel.INNER_LIST_QNAME).build(); writeTx.put(OPERATIONAL, path, ImmutableNodes.mapNodeBuilder(TestModel.INNER_LIST_QNAME).build()); for (int j = 0; j < innerNum; j++) { - InstanceIdentifier innerPath = InstanceIdentifier.builder(path) + YangInstanceIdentifier innerPath = YangInstanceIdentifier.builder(path) .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, String.valueOf(j)) .build(); writeTx.put( @@ -205,7 +202,7 @@ public class DOMBrokerPerformanceTest { public Void call() throws Exception { for (int i = 0; i < txNum; i++) { for (int j = 0; j < innerNum; j++) { - InstanceIdentifier path = InstanceIdentifier + YangInstanceIdentifier path = YangInstanceIdentifier .builder(outerListPath(i)) // .node(TestModel.INNER_LIST_QNAME)