X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2Flegacy%2Fsharded%2Fadapter%2FShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java;h=828690992006ef88c0bb356b3f0d9588ebec5468;hb=c717ea8fc42cad3f1f802bdfab5e4990d86913dd;hp=177786626b77056bb43c773e4ed84b3046afc59a;hpb=cf2cc1b770f6d1b5fc04e5b8e4081f306853b909;p=controller.git diff --git a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java index 177786626b..8286909920 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java +++ b/opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransactionTest.java @@ -9,14 +9,15 @@ package org.opendaylight.controller.md.sal.dom.broker.impl.legacy.sharded.adapter; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import com.google.common.base.Optional; import com.google.common.util.concurrent.Futures; +import org.gaul.modernizer_maven_annotations.SuppressModernizer; import org.junit.Before; import org.junit.Test; import org.mockito.Matchers; @@ -35,6 +36,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; +@Deprecated public class ShardedDOMDataBrokerDelegatingReadWriteTransactionTest { @Mock @@ -51,7 +53,8 @@ public class ShardedDOMDataBrokerDelegatingReadWriteTransactionTest { doNothing().when(writeTx).put(any(), any(), any()); doNothing().when(writeTx).merge(any(), any(), any()); doNothing().when(writeTx).delete(any(), any()); - rwTx = new ShardedDOMDataBrokerDelegatingReadWriteTransaction("TEST-TX", TestModel.createTestContext(), readTx, writeTx); + rwTx = new ShardedDOMDataBrokerDelegatingReadWriteTransaction("TEST-TX", TestModel.createTestContext(), readTx, + writeTx); } @Test(expected = IllegalStateException.class) @@ -65,46 +68,44 @@ public class ShardedDOMDataBrokerDelegatingReadWriteTransactionTest { } @Test + @SuppressModernizer public void testReadWriteOperations() throws Exception { - doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(readTx) - .read(any(), any()); - rwTx.put(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH, - testNodeWithOuter(1, 2, 3)); + doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(readTx).read(any(), any()); + rwTx.put(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH, testNodeWithOuter(1, 2, 3)); verify(writeTx).put(eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(TestModel.TEST_PATH), - Matchers.eq(testNodeWithOuter(1, 2, 3))); + Matchers.eq(testNodeWithOuter(1, 2, 3))); verify(readTx).read(eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(TestModel.TEST_PATH)); assertEquals(testNodeWithOuter(1, 2, 3), - rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet().get()); + rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet().get()); - rwTx.merge(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH, - testNodeWithOuter(4, 5, 6)); + rwTx.merge(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH, testNodeWithOuter(4, 5, 6)); assertEquals(testNodeWithOuter(1, 2, 3, 4, 5, 6), - rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet().get()); + rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet().get()); rwTx.delete(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH); verify(writeTx).delete(eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(TestModel.TEST_PATH)); - assertEquals(Optional.absent(), - rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet()); + assertEquals(Optional.absent(), rwTx.read(LogicalDatastoreType.OPERATIONAL, TestModel.TEST_PATH).checkedGet()); } - private DataContainerChild outerNode(int... ids) { + private static DataContainerChild outerNode(final int... ids) { CollectionNodeBuilder outer = ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME); - for(int id: ids) { + for (int id : ids) { outer.addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, id)); } return outer.build(); } - private NormalizedNode testNodeWithOuter(int... ids) { + private static NormalizedNode testNodeWithOuter(final int... ids) { return testNodeWithOuter(outerNode(ids)); } - private NormalizedNode testNodeWithOuter(DataContainerChild outer) { - return ImmutableContainerNodeBuilder.create().withNodeIdentifier( - new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(outer).build(); + private static NormalizedNode testNodeWithOuter(final DataContainerChild outer) { + return ImmutableContainerNodeBuilder.create() + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(outer) + .build(); } } \ No newline at end of file