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
|
|
13 public class LocalTestTopology extends StartCodeGear{
|
|
14
|
|
15
|
|
16 public LocalTestTopology(CodeGearManager cgm) {
|
|
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"));
|
|
25
|
|
26 TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(new String[]{"--confFile", "ring.dot", "--showTime"});
|
|
27
|
|
28 new StartTopologyManager(createCGM(10000), topologyManagerConfig);
|
|
29
|
|
30 for (LocalTestTopologyConfig conf: configs ) {
|
|
31 CodeGearManager nodeCGM = createCGM(conf.connectPort);
|
|
32 String[] csarg = {"--host","localhost","--localKey",conf.key };
|
|
33 TopologyNodeConfig cs = new TopologyNodeConfig(csarg);
|
|
34
|
|
35 new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf));
|
|
36 }
|
|
37
|
|
38 }
|
|
39
|
|
40 @Override
|
|
41 protected void run(CodeGearManager cgm) {
|
|
42 cgm.getDGM("node1").put("num", 0);
|
|
43 }
|
|
44 }
|