Mercurial > hg > Database > Alice
changeset 136:bb023f060f2f working
add different version test
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/alpha/FishPoint.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,36 @@ +package alice.test.codesegment.remote.alpha; + +import org.msgpack.annotation.Message; + +@Message +public class FishPoint { + // public fields are serialized. + public float x = 0.0f; + public float y = 0.0f; + public String vector = "light"; + + public FishPoint(){} + + public FishPoint(float x,float y){ + this.x = x; + this.y = y; + } + + public void setXY(float x,float y){ + this.x = x; + this.y = y; + } + + public float getX(){ + return this.x; + } + + public float getY(){ + return this.y; + } + + public String getVector(){ + return this.vector; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/alpha/RemoteIncrement.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.codesegment.remote.alpha; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class RemoteIncrement extends CodeSegment { + + public Receiver data = ids.create(CommandType.TAKE); + + public RemoteIncrement(int index){ + this.data.setKey("remote", "num", index); + } + + @Override + public void run() { + System.out.println(data.val); + FishPoint fp = this.data.asClass(FishPoint.class); + fp.setXY(fp.x+1.0f, fp.getY()+1.0f); + new RemoteIncrement(this.data.index); + ods.put("local", "num", fp); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/alpha/RemoteStartCodeSegment.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,13 @@ +package alice.test.codesegment.remote.alpha; + +import alice.codesegment.CodeSegment; + +public class RemoteStartCodeSegment extends CodeSegment { + + @Override + public void run() { + new RemoteIncrement(0); + //ods.put("local", "num", new FishPoint()); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/alpha/TestRemoteAlice.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,17 @@ +package alice.test.codesegment.remote.alpha; + +import alice.daemon.AliceDaemon; +import alice.datasegment.DataSegment; + +public class TestRemoteAlice { + + public static void main(String[] args) { + TestRemoteConfig conf = new TestRemoteConfig(args); + + new AliceDaemon(conf).listen(); + DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort); + + new RemoteStartCodeSegment().execute(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/alpha/TestRemoteConfig.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.codesegment.remote.alpha; + +import alice.daemon.Config; + +public class TestRemoteConfig extends Config { + + public String hostname; + public int connectPort = 10000; + public String key; + + public TestRemoteConfig(String[] args) { + super(args); + for (int i = 0; i< args.length; i++) { + if ("-h".equals(args[i])) { + hostname = args[++i]; + } else if ("-cp".equals(args[i])) { + connectPort = Integer.parseInt(args[++i]); + } else if ("-key".equals(args[i])) { + key = args[++i]; + } + } + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/beta/FishPoint.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,55 @@ +package alice.test.codesegment.remote.beta; + +import org.msgpack.annotation.Message; +import org.msgpack.annotation.Optional; + +@Message +public class FishPoint { + // public fields are serialized. + public float x = 0.0f; + public float y = 0.0f; + public String vector = "light"; + @Optional public float z = 0.0f; + + + public FishPoint(){} + + public FishPoint(float x,float y){ + this.x = x; + this.y = y; + } + + public FishPoint(float x,float y,float z){ + this.x = x; + this.y = y; + this.z = z; + } + + public void setXY(float x,float y){ + this.x = x; + this.y = y; + } + + public void setXYZ(float x,float y,float z){ + this.x = x; + this.y = y; + this.z = z; + } + + public float getX(){ + return this.x; + } + + public float getY(){ + return this.y; + } + + public float getZ(){ + return this.z; + } + + public String getVector(){ + return this.vector; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/beta/RemoteIncrement.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,23 @@ +package alice.test.codesegment.remote.beta; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class RemoteIncrement extends CodeSegment { + + public Receiver data = ids.create(CommandType.TAKE); + + public RemoteIncrement(int index){ + this.data.setKey("remote", "num", index); + } + + @Override + public void run() { + System.out.println(data.val); + FishPoint fp = this.data.asClass(FishPoint.class); + fp.setXYZ(fp.getX()+1.0f, fp.getY()+1.0f, fp.getZ()+1.0f); + new RemoteIncrement(this.data.index); + ods.put("local", "num", fp); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/beta/RemoteStartCodeSegment.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,13 @@ +package alice.test.codesegment.remote.beta; + +import alice.codesegment.CodeSegment; + +public class RemoteStartCodeSegment extends CodeSegment { + + @Override + public void run() { + new RemoteIncrement(0); + ods.put("local", "num", new FishPoint(0.0f, 0.0f, 0.0f)); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/beta/TestRemoteAlice.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,17 @@ +package alice.test.codesegment.remote.beta; + +import alice.daemon.AliceDaemon; +import alice.datasegment.DataSegment; + +public class TestRemoteAlice { + + public static void main(String[] args) { + TestRemoteConfig conf = new TestRemoteConfig(args); + + new AliceDaemon(conf).listen(); + DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort); + + new RemoteStartCodeSegment().execute(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/codesegment/remote/beta/TestRemoteConfig.java Sun Aug 19 21:31:21 2012 +0900 @@ -0,0 +1,24 @@ +package alice.test.codesegment.remote.beta; + +import alice.daemon.Config; + +public class TestRemoteConfig extends Config { + + public String hostname; + public int connectPort = 10000; + public String key; + + public TestRemoteConfig(String[] args) { + super(args); + for (int i = 0; i< args.length; i++) { + if ("-h".equals(args[i])) { + hostname = args[++i]; + } else if ("-cp".equals(args[i])) { + connectPort = Integer.parseInt(args[++i]); + } else if ("-key".equals(args[i])) { + key = args[++i]; + } + } + } + +}
--- a/src/alice/test/topology/share/CheckMyName.java Thu Aug 16 19:57:10 2012 +0900 +++ b/src/alice/test/topology/share/CheckMyName.java Sun Aug 19 21:31:21 2012 +0900 @@ -58,7 +58,7 @@ ods.update("local", key, new FishPoint(-0.1f,-0.1f)); new CheckLocalIndex(key,1); - for (int i = 0;i < 3 ; i++){ + for (int i = 0;i < 1 ; i++){ key = "fish"+i; if (num == 0) new AutoIncrement(key,0); ods.update("local", key, new FishPoint(0.2f*i,0.2f*i));