# HG changeset patch # User one # Date 1381404393 -32400 # Node ID b0af3960917fffc8ed7e372532e1e8c6e3f9bb98 # Parent 89e39301ccaa061a4eecdefa9e9e5af54a0a7d3f Added NetworkNodePathTest diff -r 89e39301ccaa -r b0af3960917f .classpath --- a/.classpath Thu Oct 10 19:17:21 2013 +0900 +++ b/.classpath Thu Oct 10 20:26:33 2013 +0900 @@ -1,52 +1,50 @@ - - - + - - - - + + + + - - + + - + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - + + + + + + - - - + + + - diff -r 89e39301ccaa -r b0af3960917f .settings/org.eclipse.jdt.core.prefs --- a/.settings/org.eclipse.jdt.core.prefs Thu Oct 10 19:17:21 2013 +0900 +++ b/.settings/org.eclipse.jdt.core.prefs Thu Oct 10 20:26:33 2013 +0900 @@ -1,5 +1,12 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.6 diff -r 89e39301ccaa -r b0af3960917f pom.xml --- a/pom.xml Thu Oct 10 19:17:21 2013 +0900 +++ b/pom.xml Thu Oct 10 20:26:33 2013 +0900 @@ -52,11 +52,6 @@ - jungle - jungle-core - 0.0.1-SNAPSHOT - - com.github.stephenc.eaio-uuid uuid 3.3.0 @@ -66,5 +61,11 @@ functionaljava 3.1 + + + jungle + jungle-core + 0.0.1-SNAPSHOT + diff -r 89e39301ccaa -r b0af3960917f src/alice/jungle/operations/NetworkNodePath.java --- a/src/alice/jungle/operations/NetworkNodePath.java Thu Oct 10 19:17:21 2013 +0900 +++ b/src/alice/jungle/operations/NetworkNodePath.java Thu Oct 10 20:26:33 2013 +0900 @@ -1,8 +1,13 @@ package alice.jungle.operations; +import java.io.IOException; import java.util.Iterator; import java.util.LinkedList; +import org.msgpack.MessagePack; +import org.msgpack.annotation.Message; +import org.msgpack.type.Value; + import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Pair; @@ -11,6 +16,17 @@ { LinkedList path; + public static void main(String[] args) throws IOException { + NetworkNodePath path = new NetworkNodePath(); + path = path.add(1).add(2).add(3); + MessagePack msgpack = new MessagePack(); + Value value = msgpack.unconvert(path); + NetworkNodePath mPath = msgpack.convert(value, NetworkNodePath.class); + for (Integer i : mPath) { + System.out.println(i); + } + } + public NetworkNodePath() { path = new LinkedList(); } diff -r 89e39301ccaa -r b0af3960917f src/test/alice/jungle/datasegment/NetworkNodePathTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/alice/jungle/datasegment/NetworkNodePathTest.java Thu Oct 10 20:26:33 2013 +0900 @@ -0,0 +1,33 @@ +package test.alice.jungle.datasegment; + +import java.io.IOException; +import java.util.Iterator; + +import org.msgpack.MessagePack; +import org.msgpack.type.Value; + +import alice.jungle.operations.NetworkNodePath; +import junit.framework.TestCase; + +public class NetworkNodePathTest extends TestCase { + + + public void testMsgConvert() throws IOException { + NetworkNodePath path = new NetworkNodePath(); + path = path.add(1).add(2).add(3); + MessagePack msgpack = new MessagePack(); + Value value = msgpack.unconvert(path); + NetworkNodePath mPath = msgpack.convert(value, NetworkNodePath.class); + for (Integer i : mPath) { + System.out.println(i); + } + assertEquals(path.size(), mPath.size()); + Iterator iter1 = path.iterator(); + Iterator iter2 = mPath.iterator(); + while(iter1.hasNext() & iter2.hasNext()) { + int i1 = iter1.next(); + int i2 = iter2.next(); + assertEquals(i1, i2); + } + } +}