changeset 69:251e306094d4

update localTestTopology
author akahori
date Sat, 01 Sep 2018 08:10:55 +0900
parents 37601b98f0da
children dcf906f7ff41
files src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java src/main/java/christie/test/topology/localTestTopology/LocalTestTopology.java src/main/java/christie/test/topology/localTestTopology/StartLTCodeGear.java src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java
diffstat 4 files changed, 65 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java	Sat Sep 01 08:10:15 2018 +0900
+++ b/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java	Sat Sep 01 08:10:55 2018 +0900
@@ -1,10 +1,11 @@
 package christie.test.topology.localTestTopology;
 
+import christie.annotation.Peek;
 import christie.annotation.Take;
 import christie.codegear.CodeGear;
 import christie.codegear.CodeGearManager;
 
-import java.util.List;
+import java.util.ArrayList;
 
 public class LTRemoteIncrement extends CodeGear {
 
@@ -12,8 +13,8 @@
 
     @Take
     int num;
-    @Take
-    List<String> _CLIST;
+    @Peek
+    ArrayList<String> _CLIST;
 
     public LTRemoteIncrement(LocalTestTopologyConfig conf) {
         this.conf = conf;
--- a/src/main/java/christie/test/topology/localTestTopology/LocalTestTopology.java	Sat Sep 01 08:10:15 2018 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-package christie.test.topology.localTestTopology;
-
-
-import christie.codegear.CodeGearManager;
-import christie.codegear.StartCodeGear;
-import christie.topology.manager.StartTopologyManager;
-import christie.topology.manager.TopologyManagerConfig;
-import christie.topology.node.StartTopologyNode;
-import christie.topology.node.TopologyNodeConfig;
-
-import java.util.LinkedList;
-
-public class LocalTestTopology extends StartCodeGear{
-
-
-    public LocalTestTopology(CodeGearManager cgm) {
-        super(cgm);
-    }
-
-    public static void main(String[] args) {
-        LinkedList<LocalTestTopologyConfig> configs = new LinkedList<LocalTestTopologyConfig>();
-        configs.add(new LocalTestTopologyConfig(args, 10001, "node0"));
-        configs.add(new LocalTestTopologyConfig(args, 10002, "node1"));
-        configs.add(new LocalTestTopologyConfig(args, 10003, "node2"));
-
-        TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(new String[]{"--confFile", "ring.dot", "--showTime"});
-
-        new StartTopologyManager(createCGM(10000), topologyManagerConfig);
-
-        for (LocalTestTopologyConfig conf: configs ) {
-            CodeGearManager nodeCGM = createCGM(conf.connectPort);
-            String[] csarg = {"--host","localhost","--localKey",conf.key };
-            TopologyNodeConfig cs  = new TopologyNodeConfig(csarg);
-
-            new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf));
-        }
-
-    }
-
-    @Override
-    protected void run(CodeGearManager cgm) {
-        cgm.getDGM("node1").put("num", 0);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/christie/test/topology/localTestTopology/StartLTCodeGear.java	Sat Sep 01 08:10:55 2018 +0900
@@ -0,0 +1,21 @@
+package christie.test.topology.localTestTopology;
+
+import christie.annotation.Peek;
+import christie.annotation.Take;
+import christie.codegear.CodeGear;
+import christie.codegear.CodeGearManager;
+
+public class StartLTCodeGear extends CodeGear{
+
+    @Take
+    boolean running;
+
+    @Override
+    protected void run(CodeGearManager cgm){
+        if(running) cgm.getDGM("node1").put("num", 0);
+        else {
+            cgm.setup(new StartLTCodeGear());
+            getLocalDGM().put("running", running);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java	Sat Sep 01 08:10:55 2018 +0900
@@ -0,0 +1,40 @@
+package christie.test.topology.localTestTopology;
+
+
+import christie.codegear.CodeGearManager;
+import christie.codegear.StartCodeGear;
+import christie.topology.manager.StartTopologyManager;
+import christie.topology.manager.TopologyManagerConfig;
+import christie.topology.node.StartTopologyNode;
+import christie.topology.node.TopologyNodeConfig;
+
+import java.util.LinkedList;
+
+public class StartLocalTestTopology extends StartCodeGear{
+
+
+    public StartLocalTestTopology(CodeGearManager cgm) {
+        super(cgm);
+    }
+
+    public static void main(String[] args) {
+        LinkedList<LocalTestTopologyConfig> configs = new LinkedList<LocalTestTopologyConfig>();
+        configs.add(new LocalTestTopologyConfig(args, 10001, "node0"));
+        configs.add(new LocalTestTopologyConfig(args, 10002, "node1"));
+        configs.add(new LocalTestTopologyConfig(args, 10003, "node2"));
+
+        TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(new String[]{"--confFile", "/Users/e155753/Specialized_subject/kono/hg/Alice/Alice/scripts/ring.dot", "--showTime"});
+        CodeGearManager topologyManagerCGM = createCGM(10000);
+        new StartTopologyManager(topologyManagerCGM, topologyManagerConfig);
+
+        for (LocalTestTopologyConfig conf: configs ) {
+            CodeGearManager nodeCGM = createCGM(conf.connectPort);
+            String[] csarg = {"--host","localhost","--localKey",conf.key };
+            TopologyNodeConfig cs  = new TopologyNodeConfig(csarg);
+
+            new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf));
+        }
+        topologyManagerCGM.setup(new StartLTCodeGear());
+    }
+
+}