diff src/test/alice/jungle/core/operations/NetworkPutAttributeOperationTest.java @ 74:19e278488b42

Added NetworkPutAttributeOperation
author one
date Tue, 15 Oct 2013 14:38:46 +0900
parents
children 0055d917c796
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/alice/jungle/core/operations/NetworkPutAttributeOperationTest.java	Tue Oct 15 14:38:46 2013 +0900
@@ -0,0 +1,28 @@
+package test.alice.jungle.core.operations;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.msgpack.MessagePack;
+import org.msgpack.type.Value;
+
+import alice.jungle.operations.NetworkAppendChildAtOperation;
+import alice.jungle.operations.NetworkPutAttributeOperation;
+import junit.framework.TestCase;
+
+public class NetworkPutAttributeOperationTest extends TestCase {
+	
+	public void testMsgpackConvert() throws IOException {
+		ByteBuffer value = ByteBuffer.allocate(16);
+		value.put( "fuga".getBytes());
+		NetworkPutAttributeOperation op = new NetworkPutAttributeOperation("hoge", value);
+		MessagePack msgpack = new MessagePack();
+		Value v = msgpack.unconvert(op);
+		NetworkPutAttributeOperation mOp = msgpack.convert(v, NetworkPutAttributeOperation.class);
+//		NodeOperation mOp = msgpack.convert(v, NodeOperation.class);
+		assertEquals(op.getCommand(), mOp.getCommand());
+		System.out.println(new String(op.getValue().array()));
+		assert((new String(op.getValue().array())).equals(new String(mOp.getValue().array())));
+	}
+
+}