Bug 2260: Reduce overhead of unused TransactionProxy instances
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / TransactionProxyTest.java
index 6573308c12100914badbedc5d0296b90e096a2b7..abfe7eae22a15b69fd4dc1c71df46befe5059e31 100644 (file)
@@ -1071,6 +1071,17 @@ public class TransactionProxyTest {
         verifyCohortFutures(proxy, IllegalArgumentException.class);
     }
 
+    @Test
+    public void testUnusedTransaction() throws Exception {
+        TransactionProxy transactionProxy = new TransactionProxy(mockActorContext, READ_WRITE);
+
+        DOMStoreThreePhaseCommitCohort ready = transactionProxy.ready();
+
+        assertEquals("canCommit", true, ready.canCommit().get());
+        ready.preCommit().get();
+        ready.commit().get();
+    }
+
     @Test
     public void testGetIdentifier() {
         setupActorContextWithInitialCreateTransaction(getSystem(), READ_ONLY);