BUG 3340 : Improve logging
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / identifiers / TransactionChainIdentifierTest.java
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/TransactionChainIdentifierTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/identifiers/TransactionChainIdentifierTest.java
new file mode 100644 (file)
index 0000000..c91fe2b
--- /dev/null
@@ -0,0 +1,29 @@
+package org.opendaylight.controller.cluster.datastore.identifiers;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class TransactionChainIdentifierTest {
+    @Test
+    public void testToString(){
+        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
+
+        String id = transactionChainIdentifier.toString();
+
+        assertEquals("member-1-chn-99", id);
+    }
+
+    @Test
+    public void testNewTransactionIdentifier(){
+        TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
+
+        TransactionIdentifier txId1 = transactionChainIdentifier.newTransactionIdentifier();
+
+        assertEquals("member-1-chn-99-txn-1", txId1.toString());
+
+        TransactionIdentifier txId2 = transactionChainIdentifier.newTransactionIdentifier();
+
+        assertEquals("member-1-chn-99-txn-2", txId2.toString());
+    }
+
+}
\ No newline at end of file