77
|
1 package test.alice.jungle.core.operations;
|
|
2
|
|
3 import java.io.IOException;
|
|
4
|
|
5 import org.msgpack.MessagePack;
|
|
6 import org.msgpack.type.Value;
|
|
7
|
|
8 import alice.jungle.operations.NetworkAppendChildAtOperation;
|
|
9 import alice.jungle.operations.NetworkNodePath;
|
|
10 import alice.jungle.operations.NetworkTreeOperation;
|
|
11 import junit.framework.TestCase;
|
|
12
|
|
13 public class NetworkTreeOperationTest extends TestCase {
|
|
14
|
|
15 public void testMsgpackConvert() throws IOException {
|
|
16 NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1);
|
|
17 NetworkNodePath path = new NetworkNodePath();
|
|
18 path.add(1).add(2);
|
|
19 NetworkTreeOperation treeOp = new NetworkTreeOperation(path, op);
|
|
20 MessagePack msgpack = new MessagePack();
|
|
21 Value v = msgpack.unconvert(treeOp);
|
|
22 NetworkTreeOperation mOp = msgpack.convert(v, NetworkTreeOperation.class);
|
|
23 assertNotNull(mOp.getNodePath());
|
|
24 assertEquals(op.getCommand(), mOp.getNodeOperation().getCommand());
|
|
25
|
|
26
|
|
27 }
|
|
28
|
|
29 }
|