Cleanup DOMStoreReadTransaction/DOMDataReadTransaction exists API documentation 37/9937/7
authorMoiz Raja <moraja@cisco.com>
Wed, 13 Aug 2014 23:24:36 +0000 (16:24 -0700)
committerMoiz Raja <moraja@cisco.com>
Wed, 27 Aug 2014 12:46:14 +0000 (05:46 -0700)
This commit also cleans up the usage of ForwardedBackwardsCompatibleDataBroker from DataBrokerTestCustomizer

Change-Id: Icfb078eb54f7dae6c436ff41e7c1657b0cf4175f
Signed-off-by: Moiz Raja <moraja@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedBackwardsCompatibleDataBrokerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/test/DataBrokerTestCustomizer.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataReadTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreReadTransaction.java

index f91e356..2ec1c43 100644 (file)
@@ -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();
 
index ca04f99..c869b1d 100644 (file)
@@ -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;
     }
 
index 9b70f0c..05ca61a 100644 (file)
@@ -49,8 +49,17 @@ public interface DOMDataReadTransaction extends AsyncReadTransaction<YangInstanc
             LogicalDatastoreType store, 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.
+     * <p>
      *
+     * 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 <code>exists</code> and <code>read</code>
+     *
+     * @param store
+     *            Logical data store from which read should occur.
      * @param path
      *            Path which uniquely identifies subtree which client want to
      *            check existence of
index 719a6f0..3068911 100644 (file)
@@ -36,7 +36,13 @@ public interface DOMStoreReadTransaction extends DOMStoreTransaction {
     CheckedFuture<Optional<NormalizedNode<?,?>>, 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.
+     * <p>
+     *
+     * 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 <code>exists</code> and <code>read</code>
      *
      * @param path
      *            Path which uniquely identifies subtree which client want to

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.