Mercurial > hg > Members > nobuyasu > jungle-network
diff src/jungle/test/codesegment/practice/TestCodeSegment.java @ 13:f3c0a65c3f12
TestCodeSegment use asClass
author | one |
---|---|
date | Thu, 27 Jun 2013 21:02:58 +0900 |
parents | c9ff68c4d82f |
children |
line wrap: on
line diff
--- a/src/jungle/test/codesegment/practice/TestCodeSegment.java Wed Jun 26 19:03:19 2013 +0900 +++ b/src/jungle/test/codesegment/practice/TestCodeSegment.java Thu Jun 27 21:02:58 2013 +0900 @@ -12,6 +12,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.DefaultTreeOperationLog; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.logger.TreeOperationLog; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; @@ -24,6 +25,7 @@ import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; +import alice.test.topology.aquarium.FishPoint; import org.msgpack.MessagePack; import org.msgpack.type.Value; @@ -36,6 +38,7 @@ Receiver arg1 = ids.create(CommandType.PEEK); public TestCodeSegment() { + arg1.setKey("log"); jungle.createNewTree("tree"); } @@ -44,13 +47,11 @@ System.out.println("type = " + arg1.type); System.out.println("index = " + arg1.index); System.out.println("data = " + arg1.getVal()); - System.out.println(((Value)arg1.getVal()).getType()); + System.out.println(arg1.getVal().getType()); - MessagePack msgpack = new MessagePack(); - Value logContainerValue = (Value) arg1.getVal(); + DefaultTreeOperationLogContainer convertedLogContainer = arg1.asClass(DefaultTreeOperationLogContainer.class); TreeOperationLog convertedLog = null; try { - DefaultTreeOperationLogContainer convertedLogContainer = msgpack.convert(logContainerValue, DefaultTreeOperationLogContainer.class); convertedLog = convertedLogContainer.convert(); } catch (IOException e) { e.printStackTrace();