2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore.identifiers;
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertThat;
14 import org.junit.Test;
16 public class TransactionChainIdentifierTest {
18 public void testToString(){
19 TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
21 String id = transactionChainIdentifier.toString();
23 assertEquals("member-1-chn-99", id);
27 public void testNewTransactionIdentifier(){
28 TransactionChainIdentifier transactionChainIdentifier = new TransactionChainIdentifier("member-1", 99);
30 TransactionIdentifier txId1 = transactionChainIdentifier.newTransactionIdentifier();
32 assertThat(txId1.toString(), startsWith("member-1-chn-99-txn-1-"));
34 TransactionIdentifier txId2 = transactionChainIdentifier.newTransactionIdentifier();
36 assertThat(txId2.toString(), startsWith("member-1-chn-99-txn-2-"));