# HG changeset patch # User Nozomi Teruya # Date 1455020354 -32400 # Node ID 301baf61faf1aafd332d37b1b6cb83c60acd6d25 # Parent cc14a7d3c46db37f2a0a3ab3c058d2c3408b25ea add compress test diff -r cc14a7d3c46d -r 301baf61faf1 src/main/java/alice/test/codesegment/local/compress/StartTestCompress.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/compress/StartTestCompress.java Tue Feb 09 21:19:14 2016 +0900 @@ -0,0 +1,23 @@ +package alice.test.codesegment.local.compress; + +import alice.codesegment.CodeSegment; + +import java.io.File; + +/** + * Created by e125769 on 2/9/16. + */ +public class StartTestCompress extends CodeSegment{ + @Override + public void run() { + System.out.println("run StartCodeSegment"); + File file = new File("AliceText.txt"); + + TestCompress cs = new TestCompress(100); + + long time = System.currentTimeMillis(); + ods.put("local", "time", time); + ods.put("compresslocal", "data", file); // bind string data to datasegment local.key1 + // this startup TestCodeSegment. + } +} diff -r cc14a7d3c46d -r 301baf61faf1 src/main/java/alice/test/codesegment/local/compress/TestCompress.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/compress/TestCompress.java Tue Feb 09 21:19:14 2016 +0900 @@ -0,0 +1,38 @@ +package alice.test.codesegment.local.compress; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; +import org.msgpack.type.Value; + +/** + * Created by e125769 on 2/9/16. + */ +public class TestCompress extends CodeSegment{ + // create input datasegment arg1 + Receiver info = ids.create(CommandType.TAKE); + Receiver info2 = ids.create(CommandType.PEEK); + int num; + + public TestCompress(int num){ + this.num = num; + info.setKey("data"); + info2.setKey("time"); + } + + @Override + public void run() { + + if (info.asInteger() == 0) { + long time = System.currentTimeMillis(); + + System.out.println("time: " + (time - info2.asClass(long.class))); + + return; + } + + TestCompress cs = new TestCompress(--num); + ods.flip("compresslocal", "data", info); + + } +} diff -r cc14a7d3c46d -r 301baf61faf1 src/main/java/alice/test/codesegment/local/compress/TestLocalCompress.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/codesegment/local/compress/TestLocalCompress.java Tue Feb 09 21:19:14 2016 +0900 @@ -0,0 +1,14 @@ +package alice.test.codesegment.local.compress; + +import alice.daemon.AliceDaemon; +import alice.daemon.Config; + +/** + * Created by e125769 on 2/9/16. + */ +public class TestLocalCompress { + public static void main(String args[]) { + new AliceDaemon(new Config(args)).listen(); // logger off + new StartTestCompress().execute(); + } +}