Yuta HIGUCHI

LinkFragmentIdTest

Change-Id: Iaa462b142d3cb65be4715f38a1b8188c273dd395
1 +package org.onlab.onos.store.link.impl;
2 +
3 +import static org.onlab.onos.net.DeviceId.deviceId;
4 +
5 +import org.junit.Test;
6 +import org.onlab.onos.net.ConnectPoint;
7 +import org.onlab.onos.net.DeviceId;
8 +import org.onlab.onos.net.LinkKey;
9 +import org.onlab.onos.net.PortNumber;
10 +import org.onlab.onos.net.provider.ProviderId;
11 +import com.google.common.testing.EqualsTester;
12 +
13 +public class LinkFragmentIdTest {
14 +
15 + private static final ProviderId PID = new ProviderId("of", "foo");
16 + private static final ProviderId PIDA = new ProviderId("of", "bar", true);
17 +
18 + private static final DeviceId DID1 = deviceId("of:foo");
19 + private static final DeviceId DID2 = deviceId("of:bar");
20 +
21 + private static final PortNumber P1 = PortNumber.portNumber(1);
22 + private static final PortNumber P2 = PortNumber.portNumber(2);
23 + private static final PortNumber P3 = PortNumber.portNumber(3);
24 +
25 + private static final ConnectPoint CP1 = new ConnectPoint(DID1, P1);
26 + private static final ConnectPoint CP2 = new ConnectPoint(DID2, P2);
27 +
28 + private static final ConnectPoint CP3 = new ConnectPoint(DID1, P2);
29 + private static final ConnectPoint CP4 = new ConnectPoint(DID2, P3);
30 +
31 + private static final LinkKey L1 = LinkKey.linkKey(CP1, CP2);
32 + private static final LinkKey L2 = LinkKey.linkKey(CP3, CP4);
33 +
34 + @Test
35 + public void testEquals() {
36 + new EqualsTester()
37 + .addEqualityGroup(new LinkFragmentId(L1, PID),
38 + new LinkFragmentId(L1, PID))
39 + .addEqualityGroup(new LinkFragmentId(L2, PID),
40 + new LinkFragmentId(L2, PID))
41 + .addEqualityGroup(new LinkFragmentId(L1, PIDA),
42 + new LinkFragmentId(L1, PIDA))
43 + .addEqualityGroup(new LinkFragmentId(L2, PIDA),
44 + new LinkFragmentId(L2, PIDA))
45 + .testEquals();
46 + }
47 +
48 +}