changeset 120:7ca232bc1009

update build.gradle
author akahori
date Tue, 11 Dec 2018 15:43:45 +0900
parents 558daa2f106e
children 8949d0ecf1f6
files build.gradle scripts/local_test_run.sh src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java src/main/java/christie/test/topology/localTestTopology/StartTorqueTestTopology.java
diffstat 5 files changed, 90 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/build.gradle	Mon Dec 10 11:20:36 2018 +0900
+++ b/build.gradle	Tue Dec 11 15:43:45 2018 +0900
@@ -16,7 +16,9 @@
 dependencies {
     compile fileTree(dir: 'lib', include: '*.jar')
     testCompile('org.junit.jupiter:junit-jupiter-api:5.2.0')
-    compile group: 'org.msgpack', name: 'msgpack', version: '0.6.12'
+    compile group: 'org.msgpack', name: 'msgpack-core', version: '0.8.16'
+    compile group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version: '0.8.16'
+
 }
 
 jar {
@@ -26,4 +28,35 @@
     }
     from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
     archiveName = 'Christie.jar'
+}
+
+task christieStartTopologyManager(type: Jar) {
+    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
+    baseName = "ChristieStartTopologyManager"
+    manifest {
+        attributes 'Main-Class': 'christie.topology.manager.StartTopologyManager',
+                'Implementation-Title': 'StartTopologyManager',
+                'Implementation-Description': 'Quickstart',
+                'Implementation-Version': version,
+                'Assembly-Date': new java.util.Date().toString()
+
+    }
+    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+    with jar
+}
+
+
+task christieStartTorqueTestTopology(type: Jar) {
+    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
+    baseName = "ChristieStartTorqueTestTopology"
+    manifest {
+        attributes 'Main-Class': 'christie.test.topology.localTestTopology.StartTorqueTestTopology',
+                'Implementation-Title': 'christieStartTorqueTestTopology',
+                'Implementation-Description': 'Quickstart',
+                'Implementation-Version': version,
+                'Assembly-Date': new java.util.Date().toString()
+
+    }
+    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+    with jar
 }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/local_test_run.sh	Tue Dec 11 15:43:45 2018 +0900
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+if [ ! -d output ]; then
+    mkdir output
+fi
+
+max=$1
+count=$2
+jar_path=../build/libs/
+topo_jarname=ChristieStartTopologyManager-1.0.jar
+torquetest_jarname=ChristieStartTorqueTestTopology-1.0.jar
+
+mkdir -p Log
+
+ruby ./ring.rb $1 > Log/ring.dot
+#dot -Tpng ./topology/ring.dot > ./topology/ring.png
+#open ./topology/ring.png
+java -cp ${jar_path}${topo_jarname} --localPort 10000 --confFile Log/ring.dot &
+
+sleep 3
+
+cnt=0
+while [ $cnt -lt $max ]
+do
+   java -cp ${jar_path}${torquetest_jarname} --managerHost localhost --managerPort 10000 --localPort `expr 20000 + $cnt`&
+   cnt=`expr $cnt + 1`
+done
+wait
--- a/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java	Mon Dec 10 11:20:36 2018 +0900
+++ b/src/main/java/christie/test/topology/localTestTopology/LTRemoteIncrement.java	Tue Dec 11 15:43:45 2018 +0900
@@ -6,13 +6,12 @@
 import christie.codegear.CodeGearManager;
 import christie.topology.node.TopologyNodeConfig;
 
+import java.util.List;
+
 public class LTRemoteIncrement extends CodeGear {
     @Peek
     TopologyNodeConfig topologyNodeConfig;
 
-    @Peek
-    String nodeName;
-
     @Take
     int num;
 
@@ -22,10 +21,11 @@
 
     @Override
     protected void run(CodeGearManager cgm) {
-        System.out.println("node: " + nodeName + " num = " + num);
+        System.out.println("node: " + " num = " + num);
 
         if (num == 3) {
             getDGM(topologyNodeConfig.getManagerKey()).put("finish", "");
+            getLocalDGM().finish();
         } else {
             num++;
             getDGM("right").put("num", num);
--- a/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java	Mon Dec 10 11:20:36 2018 +0900
+++ b/src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java	Tue Dec 11 15:43:45 2018 +0900
@@ -16,9 +16,10 @@
     }
 
     public static void main(String[] args) {
+        /* Local Test */
         int managerPort = 10000;
         int nodeNum = 3;
-        String[] managerArg = {"--localPort", String.valueOf(managerPort), "--confFile", "scripts/ring.dot", "--showTime"};
+        String[] managerArg = {"--localPort", String.valueOf(managerPort), "--confFile", "scripts/ring.dot"};
         TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(managerArg);
         new StartTopologyManager(topologyManagerConfig);
 
@@ -32,6 +33,8 @@
             nodeCGM.getLocalDGM().put("num", 0);
 
         }
+
+
     }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/christie/test/topology/localTestTopology/StartTorqueTestTopology.java	Tue Dec 11 15:43:45 2018 +0900
@@ -0,0 +1,20 @@
+package christie.test.topology.localTestTopology;
+
+import christie.codegear.CodeGearManager;
+import christie.codegear.StartCodeGear;
+import christie.topology.node.StartTopologyNode;
+import christie.topology.node.TopologyNodeConfig;
+
+public class StartTorqueTestTopology extends StartCodeGear {
+
+    public StartTorqueTestTopology(CodeGearManager cgm) {
+        super(cgm);
+    }
+
+    public static void main(String[] args) {
+        /* Torque */
+        TopologyNodeConfig topologyNodeConfig = new TopologyNodeConfig(args);
+        StartTopologyNode startTopologyNode = new StartTopologyNode(topologyNodeConfig, new LTRemoteIncrement());
+        startTopologyNode.getLocalDGM().put("num", 0);
+    }
+}