checkStyleViolationSeverity=error implemented for mdsal-dom-broker
[mdsal.git] / dom / mdsal-dom-broker / src / test / java / org / opendaylight / mdsal / dom / broker / ShardedDOMDataTreeTest.java
index 528234f56e3f715b311c7d7cd7ada943ee3dfc85..35611e94a6ce9e94b21d5b899754ed669ea31fcf 100644 (file)
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import junit.framework.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
@@ -93,7 +92,7 @@ public class ShardedDOMDataTreeTest {
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
 
-        rootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1, 1);
+        rootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
         rootShard.onGlobalContextUpdated(schemaContext);
 
         final ShardedDOMDataTree dataTree = new ShardedDOMDataTree();
@@ -114,18 +113,20 @@ public class ShardedDOMDataTreeTest {
     public void testShardRegistrationClose() throws Exception {
         rootShardReg.close();
 
-        final InMemoryDOMDataTreeShard newRootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1, 1);
+        final InMemoryDOMDataTreeShard newRootShard = InMemoryDOMDataTreeShard.create(ROOT_ID, executor, 1);
         newRootShard.onGlobalContextUpdated(schemaContext);
         final DOMDataTreeProducer shardRegProducer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
 
-        ListenerRegistration<InMemoryDOMDataTreeShard> newRootShardReg =
+        final ListenerRegistration<InMemoryDOMDataTreeShard> newRootShardReg =
                 dataTreeService.registerDataTreeShard(ROOT_ID, rootShard, shardRegProducer);
         shardRegProducer.close();
 
-        final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1, 1);
+        final InMemoryDOMDataTreeShard innerShard = InMemoryDOMDataTreeShard.create(INNER_CONTAINER_ID, executor, 1);
         innerShard.onGlobalContextUpdated(schemaContext);
-        final DOMDataTreeProducer shardRegProducer2 = dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
-        ListenerRegistration<InMemoryDOMDataTreeShard> innerShardReg = dataTreeService.registerDataTreeShard(INNER_CONTAINER_ID, innerShard, shardRegProducer2);
+        final DOMDataTreeProducer shardRegProducer2 =
+                dataTreeService.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
+        ListenerRegistration<InMemoryDOMDataTreeShard> innerShardReg =
+                dataTreeService.registerDataTreeShard(INNER_CONTAINER_ID, innerShard, shardRegProducer2);
 
         innerShardReg.close();
         // try to register the shard again
@@ -147,7 +148,8 @@ public class ShardedDOMDataTreeTest {
         final DOMDataTreeListener mockedDataTreeListener = Mockito.mock(DOMDataTreeListener.class);
         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
 
-        dataTreeService.registerListener(mockedDataTreeListener, Collections.singletonList(INNER_CONTAINER_ID), true, Collections.emptyList());
+        dataTreeService.registerListener(mockedDataTreeListener, Collections.singletonList(INNER_CONTAINER_ID),
+                true, Collections.emptyList());
 
         final DOMDataTreeProducer producer = dataTreeService.createProducer(Collections.singletonList(ROOT_ID));
         DOMDataTreeCursorAwareTransaction tx = producer.createTransaction(false);
@@ -174,12 +176,15 @@ public class ShardedDOMDataTreeTest {
         cursor.close();
         tx.submit().checkedGet();
 
-        verify(mockedDataTreeListener, timeout(1000).times(3)).onDataTreeChanged(captorForChanges.capture(), captorForSubtrees.capture());
+        verify(mockedDataTreeListener, timeout(1000).times(3)).onDataTreeChanged(captorForChanges.capture(),
+                captorForSubtrees.capture());
         final List<Collection<DataTreeCandidate>> capturedValue = captorForChanges.getAllValues();
         assertTrue(capturedValue.size() == 3);
 
-        final ContainerNode capturedChange = (ContainerNode) capturedValue.get(1).iterator().next().getRootNode().getDataAfter().get();
-        final ContainerNode innerContainerVerify = (ContainerNode) crossShardContainer.getChild(TestModel.INNER_CONTAINER_PATH.getLastPathArgument()).get();
+        final ContainerNode capturedChange =
+                (ContainerNode) capturedValue.get(1).iterator().next().getRootNode().getDataAfter().get();
+        final ContainerNode innerContainerVerify = (ContainerNode) crossShardContainer.getChild(
+                TestModel.INNER_CONTAINER_PATH.getLastPathArgument()).get();
         assertEquals(innerContainerVerify, capturedChange);
 
         verifyNoMoreInteractions(mockedDataTreeListener);
@@ -204,7 +209,8 @@ public class ShardedDOMDataTreeTest {
 
         assertTrue(rootTx.cancel());
 
-        final DOMDataTreeProducer innerContainerProducer = rootProducer.createProducer(Collections.singletonList(INNER_CONTAINER_ID));
+        final DOMDataTreeProducer innerContainerProducer = rootProducer.createProducer(
+                Collections.singletonList(INNER_CONTAINER_ID));
 
         rootTx = rootProducer.createTransaction(false);
         try {
@@ -240,9 +246,11 @@ public class ShardedDOMDataTreeTest {
 
     private ContainerNode createCrossShardContainer() {
         final LeafNode<String> shardedValue1 =
-                ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(TestModel.SHARDED_VALUE_1)).withValue("sharded value 1").build();
+                ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(
+                        TestModel.SHARDED_VALUE_1)).withValue("sharded value 1").build();
         final LeafNode<String> shardedValue2 =
-                ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(TestModel.SHARDED_VALUE_2)).withValue("sharded value 2").build();
+                ImmutableLeafNodeBuilder.<String>create().withNodeIdentifier(new NodeIdentifier(
+                        TestModel.SHARDED_VALUE_2)).withValue("sharded value 2").build();
 
 
         final ContainerNode lowerShardContainer = ImmutableContainerNodeBuilder.create()