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.CmdLineException;
14 import org.kohsuke.args4j.CmdLineParser;
15 import org.kohsuke.args4j.Option;
18 @Option(name = "-member-name", usage = "Sets the member name", required = true)
19 public String memberName;
21 @Option(name = "-max-delay-millis", usage = "Sets the maximum delay that should be applied for any append entry. "
22 + "Only applies when cause-trouble is present.")
23 public int maxDelayInMillis = 500;
25 @Option(name = "-cause-trouble", usage = "If present turns on artificial failures")
26 public boolean causeTrouble = false;
28 @Option(name = "-drop-replies", usage = "If present drops replies. Only applies when cause-trouble is present.")
29 public boolean dropReplies = false;
32 ActorSystem actorSystem = ActorSystem.create("opendaylight-cluster-data",
33 ConfigFactory.load(memberName).getConfig("odl-cluster-data"));
35 Configuration configuration = new Configuration(maxDelayInMillis, dropReplies, causeTrouble);
37 actorSystem.actorOf(DummyShardManager.props(configuration, memberName,
38 new String[] {"inventory", "default", "toaster", "topology"}, "operational"),
39 "shardmanager-operational");
40 actorSystem.actorOf(DummyShardManager.props(configuration, memberName,
41 new String[] {"inventory", "default", "toaster", "topology"}, "config"), "shardmanager-config");
45 public String toString() {
46 return "Main{" + "memberName='" + memberName + '\'' + ", maxDelayInMillis=" + maxDelayInMillis
47 + ", causeTrouble=" + causeTrouble + ", dropReplies=" + dropReplies + '}';
50 @SuppressWarnings("checkstyle:RegexpSingleLineJava")
51 public static void main(String[] args) {
52 Main bean = new Main();
53 CmdLineParser parser = new CmdLineParser(bean);
56 parser.parseArgument(args);
57 System.out.println(bean.toString());
59 } catch (CmdLineException e) {
60 System.err.println(e.getMessage());
61 parser.printUsage(System.err);