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%2FTransactionChainProxyTest.java;h=ce0547c3883d19a12c01b8d9a9ce355770aead3b;hb=9f19da6634f18ab4d55ca1def76566ca63416ff0;hp=93145bdd6d86360070dce5102dbd968c6ebc0629;hpb=945a63ae76181f7cda4b052fa8fcdf115da4cf2d;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java index 93145bdd6d..ce0547c388 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java @@ -10,12 +10,14 @@ package org.opendaylight.controller.cluster.datastore; +import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.doReturn; - +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.Mockito; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; @@ -24,8 +26,8 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class TransactionChainProxyTest { - ActorContext actorContext = Mockito.mock(ActorContext.class); - SchemaContext schemaContext = Mockito.mock(SchemaContext.class); + ActorContext actorContext = mock(ActorContext.class); + SchemaContext schemaContext = mock(SchemaContext.class); @Before public void setUp() { @@ -57,8 +59,20 @@ public class TransactionChainProxyTest { } - @Test(expected=UnsupportedOperationException.class) + @Test public void testClose() throws Exception { - new TransactionChainProxy(actorContext).close(); + ActorContext context = mock(ActorContext.class); + + new TransactionChainProxy(context).close(); + + verify(context, times(1)).broadcast(anyObject()); + } + + @Test + public void testTransactionChainsHaveUniqueId(){ + TransactionChainProxy one = new TransactionChainProxy(mock(ActorContext.class)); + TransactionChainProxy two = new TransactionChainProxy(mock(ActorContext.class)); + + Assert.assertNotEquals(one.getTransactionChainId(), two.getTransactionChainId()); } }