X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardTransactionTest.java;h=851fb0114b3a64c7d211a5c6375c14c41e715e69;hb=20156b149d56b1b14a06d344366b8e1af1c22fe8;hp=69dd706f37cb3bd8c1e7c75d91ec05e2b0fe1f13;hpb=014ab8770cfe40cf0ce1f2c88e0b0666429c760c;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index 69dd706f37..851fb0114b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -412,10 +412,10 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveCloseTransaction() throws Exception { + public void testReadWriteTxOnReceiveCloseTransaction() throws Exception { new JavaTestKit(getSystem()) {{ final ActorRef transaction = newTransactionActor(store.newReadWriteTransaction(), - "testCloseTransaction"); + "testReadWriteTxOnReceiveCloseTransaction"); watch(transaction); @@ -426,6 +426,35 @@ public class ShardTransactionTest extends AbstractActorTest { }}; } + @Test + public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception { + new JavaTestKit(getSystem()) {{ + final ActorRef transaction = newTransactionActor(store.newWriteOnlyTransaction(), + "testWriteTxOnReceiveCloseTransaction"); + + watch(transaction); + + transaction.tell(new CloseTransaction().toSerializable(), getRef()); + + expectMsgClass(duration("3 seconds"), CloseTransactionReply.SERIALIZABLE_CLASS); + expectTerminated(duration("3 seconds"), transaction); + }}; + } + + @Test + public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception { + new JavaTestKit(getSystem()) {{ + final ActorRef transaction = newTransactionActor(store.newReadOnlyTransaction(), + "testReadOnlyTxOnReceiveCloseTransaction"); + + watch(transaction); + + transaction.tell(new CloseTransaction().toSerializable(), getRef()); + + expectMsgClass(duration("3 seconds"), Terminated.class); + }}; + } + @Test(expected=UnknownMessageException.class) public void testNegativePerformingWriteOperationOnReadTransaction() throws Exception { final ActorRef shard = createShard();