Mercurial > hg > Database > Alice
changeset 590:301baf61faf1 dispose
add compress test
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 09 Feb 2016 21:19:14 +0900 |
parents | cc14a7d3c46d |
children | 25fe2f78ac40 |
files | src/main/java/alice/test/codesegment/local/compress/StartTestCompress.java src/main/java/alice/test/codesegment/local/compress/TestCompress.java src/main/java/alice/test/codesegment/local/compress/TestLocalCompress.java |
diffstat | 3 files changed, 75 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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. + } +}
--- /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); + + } +}
--- /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(); + } +}