Bug 8116 - Make DistributedShardChangePublisher agnostic to data tree change events...
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / sharding / DistributedShardedDOMDataTreeTest.java
index 33a8e59935fed6917a34b36bd7a3bfcdbc30e52c..6cf7e7bb23d99b0fce061a7ef4aadd34d609c83b 100644 (file)
@@ -41,7 +41,6 @@ import java.util.concurrent.CompletionStage;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Captor;
@@ -154,14 +153,14 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest {
         InMemorySnapshotStore.clear();
     }
 
-    private void initEmptyDatastores() {
+    private void initEmptyDatastores() throws Exception {
         leaderTestKit = new IntegrationTestKit(leaderSystem, leaderDatastoreContextBuilder);
 
-        leaderDistributedDataStore = (DistributedDataStore) leaderTestKit.setupDistributedDataStore(
+        leaderDistributedDataStore = leaderTestKit.setupDistributedDataStore(
                 "config", MODULE_SHARDS_CONFIG, "empty-modules.conf", true,
                 SchemaContextHelper.distributedShardedDOMDataTreeSchemaContext());
 
-        operDistributedDatastore = (DistributedDataStore) leaderTestKit.setupDistributedDataStore(
+        operDistributedDatastore = leaderTestKit.setupDistributedDataStore(
                 "operational", MODULE_SHARDS_CONFIG, "empty-modules.conf",true,
                 SchemaContextHelper.distributedShardedDOMDataTreeSchemaContext());
 
@@ -335,7 +334,6 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest {
     }
 
     // top level shard at TEST element, with subshards on each outer-list map entry
-    @Ignore("https://bugs.opendaylight.org/show_bug.cgi?id=8116")
     @Test
     public void testMultipleShardLevels() throws Exception {
         initEmptyDatastores();
@@ -397,8 +395,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest {
         leaderShardFactory.registerListener(mockedDataTreeListener, Collections.singletonList(TEST_ID),
                 true, Collections.emptyList());
 
-        // need 6 invocations, first initial thats from the parent shard, and then each individual subshard
-        verify(mockedDataTreeListener, timeout(20000).times(6)).onDataTreeChanged(captorForChanges.capture(),
+        verify(mockedDataTreeListener, timeout(35000).atLeast(2)).onDataTreeChanged(captorForChanges.capture(),
                 captorForSubtrees.capture());
         verifyNoMoreInteractions(mockedDataTreeListener);
         final List<Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>>> allSubtrees = captorForSubtrees.getAllValues();