Bug 8885: Fix DistributedShardedDOMDataTree initialization
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / sharding / DistributedShardFrontendTest.java
index febc929db5d4ec17768e8253ece1a8f7fd84b5ba..b71095808468428e295cd1a155095b466529dba8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -29,6 +29,8 @@ import org.opendaylight.controller.cluster.databroker.actors.dds.ClientLocalHist
 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
 import org.opendaylight.controller.cluster.databroker.actors.dds.DataStoreClient;
 import org.opendaylight.controller.cluster.datastore.DistributedDataStore;
+import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
+import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
@@ -108,9 +110,13 @@ public class DistributedShardFrontendTest {
     public void testClientTransaction() throws Exception {
 
         final DistributedDataStore distributedDataStore = mock(DistributedDataStore.class);
+        final ActorContext context = mock(ActorContext.class);
+        doReturn(context).when(distributedDataStore).getActorContext();
+        doReturn(SchemaContextHelper.full()).when(context).getSchemaContext();
+
         final DistributedShardFrontend rootShard = new DistributedShardFrontend(distributedDataStore, client, ROOT);
 
-        try (final DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT))) {
+        try (DOMDataTreeProducer producer = shardedDOMDataTree.createProducer(Collections.singletonList(ROOT))) {
             shardedDOMDataTree.registerDataTreeShard(ROOT, rootShard, producer);
         }
 
@@ -136,7 +142,7 @@ public class DistributedShardFrontendTest {
 
         final DistributedShardFrontend outerListShard = new DistributedShardFrontend(
                 distributedDataStore, outerListClient, OUTER_LIST_ID);
-        try (final DOMDataTreeProducer producer =
+        try (DOMDataTreeProducer producer =
                      shardedDOMDataTree.createProducer(Collections.singletonList(OUTER_LIST_ID))) {
             shardedDOMDataTree.registerDataTreeShard(OUTER_LIST_ID, outerListShard, producer);
         }
@@ -207,6 +213,4 @@ public class DistributedShardFrontendTest {
 
         return testContainer;
     }
-
-
-}
\ No newline at end of file
+}