This commit also cleans up the usage of ForwardedBackwardsCompatibleDataBroker from DataBrokerTestCustomizer
Change-Id: Icfb078eb54f7dae6c436ff41e7c1657b0cf4175f
Signed-off-by: Moiz Raja <moraja@cisco.com>
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;
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
* @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();
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;
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;
}
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
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