Mercurial > hg > Database > Christie
changeset 102:7879076073ce
update Test send finish
author | akahori |
---|---|
date | Tue, 18 Sep 2018 10:04:26 +0900 |
parents | 6b33d49e9be7 |
children | 3ae54e59ed68 |
files | src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java src/main/java/christie/test/topology/treeTestTopology/ChildCodeGear.java src/main/java/christie/test/topology/treeTestTopology/ParentCodeGear.java src/main/java/christie/test/topology/treeTestTopology/StartTreeTestTopology.java |
diffstat | 5 files changed, 38 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Tue Sep 18 10:02:30 2018 +0900 +++ b/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java Tue Sep 18 10:04:26 2018 +0900 @@ -4,11 +4,13 @@ import christie.annotation.Take; import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; - -import java.util.ArrayList; +import christie.topology.node.TopologyNodeConfig; public class LTRemoteIncrement extends CodeGear { @Peek + TopologyNodeConfig topologyNodeConfig; + + @Peek String nodeName; @Take @@ -23,7 +25,7 @@ System.out.println("node: " + nodeName + " num = " + num); if (num == 3) { - System.out.println("finish"); + getDGM(topologyNodeConfig.getManagerKey()).put("finish", ""); } else { num++; getDGM("right").put("num", num);
--- a/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java Tue Sep 18 10:02:30 2018 +0900 +++ b/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java Tue Sep 18 10:04:26 2018 +0900 @@ -7,8 +7,6 @@ import christie.topology.manager.TopologyManagerConfig; import christie.topology.node.StartTopologyNode; import christie.topology.node.TopologyNodeConfig; -import java.util.LinkedList; - public class StartLocalTestTopology extends StartCodeGear{ @@ -26,7 +24,7 @@ for (int i = 1; i<=nodeNum; i++) { CodeGearManager nodeCGM = createCGM(managerPort + i); - String[] nodeArg = {"--managerPort", String.valueOf(topologyManagerConfig.localPort), + String[] nodeArg = {"--managerPort", String.valueOf(managerPort), "--managerHost", "localhost"}; TopologyNodeConfig cs = new TopologyNodeConfig(nodeArg);
--- a/src/main/java/christie/test/topology/treeTestTopology/ChildCodeGear.java Tue Sep 18 10:02:30 2018 +0900 +++ b/src/main/java/christie/test/topology/treeTestTopology/ChildCodeGear.java Tue Sep 18 10:04:26 2018 +0900 @@ -4,15 +4,24 @@ import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; +import java.util.List; + public class ChildCodeGear extends CodeGear { @Peek String nodeName; + @Peek + List<String> _CLIST; + @Override protected void run(CodeGearManager cgm) { - if(cgm.getDgmList().containsKey("parent")) + if(_CLIST.contains("parent")) { getDGM("parent").put("childNodeName", nodeName); - cgm.setup(new ParentCodeGear()); + }else{ + getLocalDGM().put("countNodeNum", 1); + cgm.setup(new ParentCodeGear()); + } + } }
--- a/src/main/java/christie/test/topology/treeTestTopology/ParentCodeGear.java Tue Sep 18 10:02:30 2018 +0900 +++ b/src/main/java/christie/test/topology/treeTestTopology/ParentCodeGear.java Tue Sep 18 10:04:26 2018 +0900 @@ -4,21 +4,33 @@ import christie.annotation.Take; import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; +import christie.topology.node.TopologyNodeConfig; public class ParentCodeGear extends CodeGear{ @Peek String nodeName; + @Peek + int maxNodeNum; + + @Peek + TopologyNodeConfig topologyNodeConfig; + + @Take + int countNodeNum; + @Take String childNodeName; - public ParentCodeGear(){ - } - - @Override protected void run(CodeGearManager cgm) { System.out.println(nodeName + " : " + childNodeName + " accept"); - cgm.setup(new ParentCodeGear()); + if(countNodeNum == maxNodeNum){ + getDGM(topologyNodeConfig.getManagerKey()).put("finish", ""); + }else{ + getLocalDGM().put("countNodeNum", countNodeNum + 1); + cgm.setup(new ParentCodeGear()); + } + } }
--- a/src/main/java/christie/test/topology/treeTestTopology/StartTreeTestTopology.java Tue Sep 18 10:02:30 2018 +0900 +++ b/src/main/java/christie/test/topology/treeTestTopology/StartTreeTestTopology.java Tue Sep 18 10:04:26 2018 +0900 @@ -20,17 +20,18 @@ int nodeNum = 3; String[] managerArg = {"--localPort", String.valueOf(topologyManagerPort), "--Topology", "tree"}; TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(managerArg); - CodeGearManager topologyManagerCGM = createCGM(topologyManagerConfig.localPort); - new StartTopologyManager(topologyManagerCGM, topologyManagerConfig); + new StartTopologyManager(topologyManagerConfig); for (int i = 0; i < nodeNum; i++) { CodeGearManager nodeCGM = createCGM(topologyNodePort + i); String[] nodeArg = { - "--managerPort", String.valueOf(topologyManagerConfig.localPort), + "--managerPort", String.valueOf(topologyManagerPort), "--managerHost", "localhost"}; TopologyNodeConfig cs = new TopologyNodeConfig(nodeArg); new StartTopologyNode(nodeCGM, cs, new ChildCodeGear()); + nodeCGM.getLocalDGM().put("maxNodeNum", topologyManagerConfig.hasChild); } + }