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
|
69
|
14 public void testMsgpackConvert() throws IOException {
|
68
|
15 NetworkNodePath path = new NetworkNodePath();
|
|
16 path = path.add(1).add(2).add(3);
|
|
17 MessagePack msgpack = new MessagePack();
|
|
18 Value value = msgpack.unconvert(path);
|
|
19 NetworkNodePath mPath = msgpack.convert(value, NetworkNodePath.class);
|
|
20 assertEquals(path.size(), mPath.size());
|
|
21 Iterator<Integer> iter1 = path.iterator();
|
|
22 Iterator<Integer> iter2 = mPath.iterator();
|
|
23 while(iter1.hasNext() & iter2.hasNext()) {
|
|
24 int i1 = iter1.next();
|
|
25 int i2 = iter2.next();
|
|
26 assertEquals(i1, i2);
|
|
27 }
|
|
28 }
|
70
|
29
|
|
30
|
|
31
|
68
|
32 }
|