From: Moiz Raja Date: Wed, 13 Aug 2014 23:24:36 +0000 (-0700) Subject: Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation X-Git-Tag: release/helium~192^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=206d37a9d8ac56b38e754da6ed3d09a60f1fea56 Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation This commit also cleans up the usage of ForwardedBackwardsCompatibleDataBroker from DataBrokerTestCustomizer Change-Id: Icfb078eb54f7dae6c436ff41e7c1657b0cf4175f Signed-off-by: Moiz Raja --- diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java index f91e356b8e..2ec1c43c9b 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java @@ -1,5 +1,6 @@ package org.opendaylight.controller.md.sal.binding.impl.test; +import com.google.common.util.concurrent.MoreExecutors; import org.junit.Test; import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompatibleDataBroker; import org.opendaylight.controller.md.sal.binding.test.AbstractSchemaAwareTest; @@ -39,10 +40,17 @@ public class ForwardedBackwardsCompatibleDataBrokerTest extends testCustomizer = createDataBrokerTestCustomizer(); domBroker = testCustomizer.createDOMDataBroker(); - dataBroker = testCustomizer.createBackwardsCompatibleDataBroker(); + dataBroker = createBackwardsCompatibleDataBroker(); testCustomizer.updateSchema(context); } + public ForwardedBackwardsCompatibleDataBroker createBackwardsCompatibleDataBroker() { + return new ForwardedBackwardsCompatibleDataBroker(domBroker, testCustomizer.getBindingToNormalized(), testCustomizer.getSchemaService(), MoreExecutors + .sameThreadExecutor()); + } + + + /** * The purpose of this test is to exercise the backwards compatible broker @@ -53,7 +61,7 @@ public class ForwardedBackwardsCompatibleDataBrokerTest extends * @see org.opendaylight.controller.md.sal.binding.impl.AbstractReadWriteTransaction#ensureParentsByMerge(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier, org.opendaylight.yangtools.yang.binding.InstanceIdentifier) */ @Test - public void test() throws InterruptedException, ExecutionException { + public void testEnsureParentsByMerge() throws InterruptedException, ExecutionException { DataModificationTransaction writeTx = dataBroker.beginTransaction(); diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java index ca04f99ba2..c869b1dbd3 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java @@ -10,12 +10,9 @@ package org.opendaylight.controller.md.sal.binding.test; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; - import javassist.ClassPool; - import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.controller.md.sal.binding.impl.ForwardedBackwardsCompatibleDataBroker; import org.opendaylight.controller.md.sal.binding.impl.ForwardedBindingDataBroker; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; @@ -84,11 +81,11 @@ public class DataBrokerTestCustomizer { return new ForwardedBindingDataBroker(getDOMDataBroker(), bindingToNormalized, schemaService ); } - public ForwardedBackwardsCompatibleDataBroker createBackwardsCompatibleDataBroker() { - return new ForwardedBackwardsCompatibleDataBroker(getDOMDataBroker(), bindingToNormalized, getSchemaService(), MoreExecutors.sameThreadExecutor()); + public BindingToNormalizedNodeCodec getBindingToNormalized() { + return bindingToNormalized; } - private SchemaService getSchemaService() { + public SchemaService getSchemaService() { return schemaService; } diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java index 9b70f0c4d7..05ca61a353 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java @@ -49,8 +49,17 @@ public interface DOMDataReadTransaction extends AsyncReadTransaction * + * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read} + * will succeed. It is possible that the data resides in a data store on a remote node and, if that + * node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if + * the data is deleted in between the calls to exists and read + * + * @param store + * Logical data store from which read should occur. * @param path * Path which uniquely identifies subtree which client want to * check existence of diff --git a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java index 719a6f0499..306891189a 100644 --- a/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java +++ b/opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java @@ -36,7 +36,13 @@ public interface DOMStoreReadTransaction extends DOMStoreTransaction { CheckedFuture>, ReadFailedException> read(YangInstanceIdentifier path); /** - * Checks if data is available in the logical data store located at provided path + * Checks if data is available in the logical data store located at provided path. + *

+ * + * Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read} + * will succeed. It is possible that the data resides in a data store on a remote node and, if that + * node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if + * the data is deleted in between the calls to exists and read * * @param path * Path which uniquely identifies subtree which client want to