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=93145bdd6d86360070dce5102dbd968c6ebc0629;hb=7a569e082e6be2fd081e8df16666d44e1fe9274a;hp=9b7039764f57ba56eb9469354446cad35a6b7537;hpb=ba063c294c8367da5917a6930dc79d00ee14c23e;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 9b7039764f..93145bdd6d 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,7 +10,10 @@ package org.opendaylight.controller.cluster.datastore; +import static org.mockito.Mockito.doReturn; + import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; @@ -23,30 +26,39 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class TransactionChainProxyTest { ActorContext actorContext = Mockito.mock(ActorContext.class); SchemaContext schemaContext = Mockito.mock(SchemaContext.class); + + @Before + public void setUp() { + doReturn(schemaContext).when(actorContext).getSchemaContext(); + } + + @SuppressWarnings("resource") @Test public void testNewReadOnlyTransaction() throws Exception { - DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadOnlyTransaction(); + DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newReadOnlyTransaction(); Assert.assertTrue(dst instanceof DOMStoreReadTransaction); } + @SuppressWarnings("resource") @Test public void testNewReadWriteTransaction() throws Exception { - DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newReadWriteTransaction(); + DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newReadWriteTransaction(); Assert.assertTrue(dst instanceof DOMStoreReadWriteTransaction); } + @SuppressWarnings("resource") @Test public void testNewWriteOnlyTransaction() throws Exception { - DOMStoreTransaction dst = new TransactionChainProxy(actorContext, schemaContext).newWriteOnlyTransaction(); + DOMStoreTransaction dst = new TransactionChainProxy(actorContext).newWriteOnlyTransaction(); Assert.assertTrue(dst instanceof DOMStoreWriteTransaction); } @Test(expected=UnsupportedOperationException.class) public void testClose() throws Exception { - new TransactionChainProxy(actorContext, schemaContext).close(); + new TransactionChainProxy(actorContext).close(); } }