51
|
1 package christie.test.topology.localTestTopology;
|
|
2
|
|
3
|
|
4 import christie.codegear.CodeGearManager;
|
|
5 import christie.codegear.StartCodeGear;
|
|
6 import christie.topology.manager.StartTopologyManager;
|
|
7 import christie.topology.manager.TopologyManagerConfig;
|
|
8 import christie.topology.node.StartTopologyNode;
|
|
9 import christie.topology.node.TopologyNodeConfig;
|
|
10
|
|
11 import java.util.LinkedList;
|
|
12
|
69
|
13 public class StartLocalTestTopology extends StartCodeGear{
|
51
|
14
|
|
15
|
69
|
16 public StartLocalTestTopology(CodeGearManager cgm) {
|
51
|
17 super(cgm);
|
|
18 }
|
|
19
|
|
20 public static void main(String[] args) {
|
|
21 LinkedList<LocalTestTopologyConfig> configs = new LinkedList<LocalTestTopologyConfig>();
|
|
22 configs.add(new LocalTestTopologyConfig(args, 10001, "node0"));
|
|
23 configs.add(new LocalTestTopologyConfig(args, 10002, "node1"));
|
|
24 configs.add(new LocalTestTopologyConfig(args, 10003, "node2"));
|
79
|
25 String[] managerArg = {"--localPort", String.valueOf(10000), "--confFile", "scripts/ring.dot", "--showTime"};
|
|
26 TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(managerArg);
|
|
27 CodeGearManager topologyManagerCGM = createCGM(topologyManagerConfig.localPort);
|
69
|
28 new StartTopologyManager(topologyManagerCGM, topologyManagerConfig);
|
51
|
29
|
|
30 for (LocalTestTopologyConfig conf: configs ) {
|
79
|
31 CodeGearManager nodeCGM = createCGM(conf.localPort);
|
|
32 String[] nodeArg = {"--localKey",conf.key,
|
|
33 "--managerPort", String.valueOf(topologyManagerConfig.localPort),
|
|
34 "--managerHost", "localhost"};
|
|
35 TopologyNodeConfig cs = new TopologyNodeConfig(nodeArg);
|
51
|
36
|
|
37 new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf));
|
|
38 }
|
69
|
39 topologyManagerCGM.setup(new StartLTCodeGear());
|
51
|
40 }
|
|
41
|
|
42 }
|