changeset 597:f5322e53bbf6 dispose

add TestCompressReceive
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Wed, 10 Feb 2016 20:32:25 +0900
parents 2b8e6b8b5d20
children 35f83005271e
files src/main/java/alice/test/codesegment/remote/compress/StartTestCompress.java src/main/java/alice/test/codesegment/remote/compress/TestCompress.java src/main/java/alice/test/codesegment/remote/compress/TestCompressReceive.java src/main/java/alice/test/codesegment/remote/compress/TestLocalCompress.java src/main/java/alice/test/codesegment/remote/compress/TestRemoteCompress.java src/main/java/alice/test/codesegment/remote/compress/TestRemoteCompressReceive.java
diffstat 6 files changed, 72 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/alice/test/codesegment/remote/compress/StartTestCompress.java	Wed Feb 10 20:04:22 2016 +0900
+++ b/src/main/java/alice/test/codesegment/remote/compress/StartTestCompress.java	Wed Feb 10 20:32:25 2016 +0900
@@ -14,7 +14,6 @@
 public class StartTestCompress extends CodeSegment{
     @Override
     public void run() {
-        System.out.println("run StartCodeSegment");
 
         Path path = Paths.get("./AliceText.txt");
         byte[] data = new byte[1024*100];
@@ -25,11 +24,12 @@
             e.printStackTrace();
         }
 
+        System.out.println("datasize:" + data.length);
+
         TestCompress cs = new TestCompress(100);
 
-        long time = System.currentTimeMillis();
-        ods.put("local", "time", time);
-        ods.put("remote", "data", data);
+        ods.put("local", "time", 0);
+        ods.put("compressedremote", "data", data);
     }
 
 }
--- a/src/main/java/alice/test/codesegment/remote/compress/TestCompress.java	Wed Feb 10 20:04:22 2016 +0900
+++ b/src/main/java/alice/test/codesegment/remote/compress/TestCompress.java	Wed Feb 10 20:32:25 2016 +0900
@@ -22,7 +22,10 @@
     @Override
     public void run() {
 
-        if (num == 0) {
+        if (num == 100){
+            long time = System.currentTimeMillis();
+            ods.update("time", time);
+        } else if (num == 0) {
             long time = System.currentTimeMillis();
 
             System.out.println("time: " + (time - info2.asClass(long.class)));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/codesegment/remote/compress/TestCompressReceive.java	Wed Feb 10 20:32:25 2016 +0900
@@ -0,0 +1,30 @@
+package alice.test.codesegment.remote.compress;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class TestCompressReceive extends CodeSegment {
+    // create input datasegment arg1
+    Receiver info = ids.create(CommandType.TAKE);
+    int num;
+
+    public TestCompressReceive(int num){
+        this.num = num;
+        info.setKey("data");
+    }
+
+    @Override
+    public void run() {
+
+        ods.flip("remote", "data", info);
+
+        if (num == 0) {
+            System.exit(0);
+            return;
+        }
+
+        TestCompressReceive cs = new TestCompressReceive(--num);
+
+    }
+}
\ No newline at end of file
--- a/src/main/java/alice/test/codesegment/remote/compress/TestLocalCompress.java	Wed Feb 10 20:04:22 2016 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-package alice.test.codesegment.remote.compress;
-import alice.daemon.AliceDaemon;
-import alice.daemon.Config;
-import alice.datasegment.DataSegment;
-import alice.test.codesegment.remote.RemoteStartCodeSegment;
-import alice.test.codesegment.remote.TestRemoteConfig;
-
-/**
- * Created by e125769 on 2/9/16.
- */
-public class TestLocalCompress {
-    public static void main(String args[]) {
-        TestRemoteConfig conf = new TestRemoteConfig(args);
-        new AliceDaemon(conf).listen();
-        DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort);
-        new StartTestCompress().execute();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/codesegment/remote/compress/TestRemoteCompress.java	Wed Feb 10 20:32:25 2016 +0900
@@ -0,0 +1,18 @@
+package alice.test.codesegment.remote.compress;
+import alice.daemon.AliceDaemon;
+import alice.daemon.Config;
+import alice.datasegment.DataSegment;
+import alice.test.codesegment.remote.RemoteStartCodeSegment;
+import alice.test.codesegment.remote.TestRemoteConfig;
+
+/**
+ * Created by e125769 on 2/9/16.
+ */
+public class TestRemoteCompress {
+    public static void main(String args[]) {
+        TestRemoteConfig conf = new TestRemoteConfig(args);
+        new AliceDaemon(conf).listen();
+        DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort);
+        new StartTestCompress().execute();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/codesegment/remote/compress/TestRemoteCompressReceive.java	Wed Feb 10 20:32:25 2016 +0900
@@ -0,0 +1,16 @@
+package alice.test.codesegment.remote.compress;
+import alice.daemon.AliceDaemon;
+import alice.datasegment.DataSegment;
+import alice.test.codesegment.remote.TestRemoteConfig;
+
+/**
+ * Created by e125769 on 2/9/16.
+ */
+public class TestRemoteCompressReceive {
+    public static void main(String args[]) {
+        TestRemoteConfig conf = new TestRemoteConfig(args);
+        new AliceDaemon(conf).listen();
+        DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort);
+        new TestCompressReceive(100);
+    }
+}