BUG-5626: Eliminate ShardIdentifier.Builder
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / identifiers / ChainedTransactionIdentifierTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.cluster.datastore.identifiers;
10
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.junit.Assert.assertThat;
13 import static org.junit.Assert.assertTrue;
14 import org.junit.Test;
15 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16
17 public class ChainedTransactionIdentifierTest {
18
19     @Test
20     public void testToString(){
21         TransactionChainIdentifier chainId = new TransactionChainIdentifier(MemberName.forName("member-1"), 99);
22         ChainedTransactionIdentifier chainedTransactionIdentifier = new ChainedTransactionIdentifier(chainId, 100);
23
24         String txnId = chainedTransactionIdentifier.toString();
25
26         assertTrue(txnId.contains("member-1"));
27         assertTrue(txnId.contains("100"));
28         assertTrue(txnId.contains("99"));
29
30         assertThat(txnId, startsWith("member-1-chn-99-txn-100-"));
31     }
32
33 }