Mercurial > hg > Members > tatsuki > Alice
changeset 368:f38cafa457c9 multicast
add MulticastDataSegment Test
author | sugi |
---|---|
date | Sat, 17 May 2014 21:37:17 +0900 |
parents | 514af34ca062 |
children | 0c24894db37e |
files | src/test/java/alice/daemon/MulticastIncrement.java src/test/java/alice/daemon/MulticastStartCodeSegment.java src/test/java/alice/daemon/UdpTest.java |
diffstat | 3 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/alice/daemon/MulticastIncrement.java Sat May 17 21:37:17 2014 +0900 @@ -0,0 +1,23 @@ +package alice.daemon; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class MulticastIncrement extends CodeSegment { + + public Receiver num = ids.create(CommandType.TAKE); + + @Override + public void run() { + int num = this.num.asInteger(); + System.out.println("[CodeSegment] " + num++); + if (num == 10) System.exit(0); + MulticastIncrement cs = new MulticastIncrement(); + cs.num.setKey("num"); + + ods.put("multicast", "num", num); + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/alice/daemon/MulticastStartCodeSegment.java Sat May 17 21:37:17 2014 +0900 @@ -0,0 +1,15 @@ +package alice.daemon; + +import alice.codesegment.CodeSegment; + +public class MulticastStartCodeSegment extends CodeSegment { + + @Override + public void run() { + MulticastIncrement cs = new MulticastIncrement(); + cs.num.setKey("num"); + + ods.put("multicast", "num", 0); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/alice/daemon/UdpTest.java Sat May 17 21:37:17 2014 +0900 @@ -0,0 +1,12 @@ +package alice.daemon; + +import alice.datasegment.DataSegment; + +public class UdpTest { + public static void main(String[] args){ + Config conf = new Config(args); + DataSegment.connectMulticast("multicast",conf.MCSTADDR, conf.localPort, conf.nis); + new MulticastStartCodeSegment().execute(); + } + +}