2 * Copyright (c) 2014, 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.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.controller.cluster.access.concepts.MemberName;
16 public class ShardIdentifierTest {
19 public void testBasic() {
20 ShardIdentifier id = ShardIdentifier.create("inventory", MemberName.forName("member-1"), "config");
22 assertEquals("member-1-shard-inventory-config", id.toString());
26 public void testFromShardIdString() {
27 String shardIdStr = "member-1-shard-inventory-config";
29 ShardIdentifier id = ShardIdentifier.fromShardIdString(shardIdStr);
31 assertEquals("member-1", id.getMemberName().getName());
32 assertEquals("inventory", id.getShardName());
33 assertEquals("config", id.getType());