BUG 1712 - Distributed DataStore does not work properly with Transaction Chains
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / utils / MockConfiguration.java
1 /*
2  * Copyright (c) 2014 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.utils;
10
11 import com.google.common.base.Optional;
12 import org.opendaylight.controller.cluster.datastore.Configuration;
13 import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategy;
14
15 import java.util.Arrays;
16 import java.util.Collections;
17 import java.util.List;
18 import java.util.Map;
19 import java.util.Set;
20
21 public class MockConfiguration implements Configuration{
22     @Override public List<String> getMemberShardNames(String memberName) {
23         return Arrays.asList("default");
24     }
25
26     @Override public Optional<String> getModuleNameFromNameSpace(
27         String nameSpace) {
28         return Optional.absent();
29     }
30
31     @Override
32     public Map<String, ShardStrategy> getModuleNameToShardStrategyMap() {
33         return Collections.EMPTY_MAP;
34     }
35
36     @Override public List<String> getShardNamesFromModuleName(
37         String moduleName) {
38         return Collections.EMPTY_LIST;
39     }
40
41     @Override public List<String> getMembersFromShardName(String shardName) {
42         if("default".equals(shardName)) {
43             return Arrays.asList("member-1", "member-2");
44         } else if("astronauts".equals(shardName)){
45             return Arrays.asList("member-2", "member-3");
46         }
47
48         return Collections.EMPTY_LIST;
49     }
50
51     @Override public Set<String> getAllShardNames() {
52         return Collections.emptySet();
53     }
54 }