Merge "Bug 1446: Add JMX stats for clustered data store"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / TransactionChainProxyTest.java
index 9b7039764f57ba56eb9469354446cad35a6b7537..93145bdd6d86360070dce5102dbd968c6ebc0629 100644 (file)
 
 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();
     }
 }