68
|
1 package test.alice.jungle.datasegment;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.util.Iterator;
|
|
5
|
|
6 import org.msgpack.MessagePack;
|
|
7 import org.msgpack.type.Value;
|
|
8
|
|
9 import alice.jungle.operations.NetworkNodePath;
|
|
10 import junit.framework.TestCase;
|
|
11
|
|
12 public class NetworkNodePathTest extends TestCase {
|
|
13
|
|
14
|
|
15 public void testMsgConvert() throws IOException {
|
|
16 NetworkNodePath path = new NetworkNodePath();
|
|
17 path = path.add(1).add(2).add(3);
|
|
18 MessagePack msgpack = new MessagePack();
|
|
19 Value value = msgpack.unconvert(path);
|
|
20 NetworkNodePath mPath = msgpack.convert(value, NetworkNodePath.class);
|
|
21 for (Integer i : mPath) {
|
|
22 System.out.println(i);
|
|
23 }
|
|
24 assertEquals(path.size(), mPath.size());
|
|
25 Iterator<Integer> iter1 = path.iterator();
|
|
26 Iterator<Integer> iter2 = mPath.iterator();
|
|
27 while(iter1.hasNext() & iter2.hasNext()) {
|
|
28 int i1 = iter1.next();
|
|
29 int i2 = iter2.next();
|
|
30 assertEquals(i1, i2);
|
|
31 }
|
|
32 }
|
|
33 }
|