2 * Copyright (c) 2014 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.dummy.datastore;
11 import akka.actor.ActorSystem;
12 import com.typesafe.config.ConfigFactory;
13 import org.kohsuke.args4j.CmdLineParser;
14 import org.kohsuke.args4j.Option;
17 @Option(name="-member-name", usage="Sets the member name", required = true)
18 public String memberName;
20 @Option(name="-max-delay-millis", usage = "Sets the maximum delay that should be applied for any append entry. Only applies when cause-trouble is present.")
21 public int maxDelayInMillis = 500;
23 @Option(name="-cause-trouble", usage="If present turns on artificial failures")
24 public boolean causeTrouble = false;
26 @Option(name="-drop-replies", usage = "If present drops replies. Only applies when cause-trouble is present.")
27 public boolean dropReplies = false;
30 ActorSystem actorSystem = ActorSystem.create("opendaylight-cluster-data", ConfigFactory.load(memberName).getConfig("odl-cluster-data"));
32 Configuration configuration = new Configuration(maxDelayInMillis, dropReplies, causeTrouble);
34 actorSystem.actorOf(DummyShardManager.props(configuration, memberName, new String[] {"inventory", "default", "toaster", "topology"}, "operational"), "shardmanager-operational");
35 actorSystem.actorOf(DummyShardManager.props(configuration, memberName, new String[] {"inventory", "default", "toaster", "topology"}, "config"), "shardmanager-config");
39 public String toString() {
41 "memberName='" + memberName + '\'' +
42 ", maxDelayInMillis=" + maxDelayInMillis +
43 ", causeTrouble=" + causeTrouble +
44 ", dropReplies=" + dropReplies +
48 public static void main(String[] args){
49 Main bean = new Main();
50 CmdLineParser parser = new CmdLineParser(bean);
53 parser.parseArgument(args);
54 System.out.println(bean.toString());
57 System.err.println(e.getMessage());
58 parser.printUsage(System.err);