package org.opendaylight.controller.cluster.datastore;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.timeout;
import org.opendaylight.controller.cluster.datastore.modification.WriteModification;
import org.opendaylight.controller.cluster.datastore.shardstrategy.DefaultShardStrategy;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransaction;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
+import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
+import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
+import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransaction;
+import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import scala.concurrent.Promise;
DOMStoreWriteTransaction writeTx1 = txChainProxy.newWriteOnlyTransaction();
- NormalizedNode<?, ?> writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+ NormalizedNode writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
writeTx1.write(TestModel.TEST_PATH, writeNode1);
writeTx1.ready();
expectBatchedModifications(txActorRef2, 1);
- final NormalizedNode<?, ?> writeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);
+ final NormalizedNode writeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);
final DOMStoreWriteTransaction writeTx2 = txChainProxy.newWriteOnlyTransaction();
final AtomicReference<Exception> caughtEx = new AtomicReference<>();
final CountDownLatch write2Complete = new CountDownLatch(1);
- new Thread() {
- @Override
- public void run() {
- try {
- writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
- } catch (Exception e) {
- caughtEx.set(e);
- } finally {
- write2Complete.countDown();
- }
+ new Thread(() -> {
+ try {
+ writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
+ } catch (Exception e) {
+ caughtEx.set(e);
+ } finally {
+ write2Complete.countDown();
}
- }.start();
+ }).start();
- assertEquals("Tx 2 write should've completed", true, write2Complete.await(5, TimeUnit.SECONDS));
+ assertTrue("Tx 2 write should've completed", write2Complete.await(5, TimeUnit.SECONDS));
if (caughtEx.get() != null) {
throw caughtEx.get();
DOMStoreWriteTransaction writeTx1 = txChainProxy.newReadWriteTransaction();
- NormalizedNode<?, ?> writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+ NormalizedNode writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
writeTx1.write(TestModel.TEST_PATH, writeNode1);
writeTx1.ready();
expectBatchedModifications(txActorRef2, 1);
- final NormalizedNode<?, ?> writeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);
+ final NormalizedNode writeNode2 = ImmutableNodes.containerNode(TestModel.OUTER_LIST_QNAME);
final DOMStoreWriteTransaction writeTx2 = txChainProxy.newReadWriteTransaction();
final AtomicReference<Exception> caughtEx = new AtomicReference<>();
final CountDownLatch write2Complete = new CountDownLatch(1);
- new Thread() {
- @Override
- public void run() {
- try {
- writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
- } catch (Exception e) {
- caughtEx.set(e);
- } finally {
- write2Complete.countDown();
- }
+ new Thread(() -> {
+ try {
+ writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
+ } catch (Exception e) {
+ caughtEx.set(e);
+ } finally {
+ write2Complete.countDown();
}
- }.start();
+ }).start();
- assertEquals("Tx 2 write should've completed", true, write2Complete.await(5, TimeUnit.SECONDS));
+ assertTrue("Tx 2 write should've completed", write2Complete.await(5, TimeUnit.SECONDS));
if (caughtEx.get() != null) {
throw caughtEx.get();
DOMStoreWriteTransaction writeTx1 = txChainProxy.newWriteOnlyTransaction();
- NormalizedNode<?, ?> writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+ NormalizedNode writeNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
writeTx1.write(TestModel.TEST_PATH, writeNode1);
txChainProxy.newWriteOnlyTransaction();