FragmentId tests
Change-Id: I461fa68291563cd76f9020b7c71612b62963825c
Showing
2 changed files
with
79 additions
and
0 deletions
core/store/dist/src/test/java/org/onlab/onos/store/device/impl/peermsg/DeviceFragmentIdTest.java
0 → 100644
1 | +package org.onlab.onos.store.device.impl.peermsg; | ||
2 | + | ||
3 | +import static org.onlab.onos.net.DeviceId.deviceId; | ||
4 | + | ||
5 | +import org.junit.Test; | ||
6 | +import org.onlab.onos.net.DeviceId; | ||
7 | +import org.onlab.onos.net.provider.ProviderId; | ||
8 | + | ||
9 | +import com.google.common.testing.EqualsTester; | ||
10 | + | ||
11 | +public class DeviceFragmentIdTest { | ||
12 | + | ||
13 | + private static final ProviderId PID = new ProviderId("of", "foo"); | ||
14 | + private static final ProviderId PIDA = new ProviderId("of", "bar", true); | ||
15 | + private static final DeviceId DID1 = deviceId("of:foo"); | ||
16 | + private static final DeviceId DID2 = deviceId("of:bar"); | ||
17 | + | ||
18 | + @Test | ||
19 | + public final void testEquals() { | ||
20 | + | ||
21 | + new EqualsTester() | ||
22 | + .addEqualityGroup(new DeviceFragmentId(DID1, PID), | ||
23 | + new DeviceFragmentId(DID1, PID)) | ||
24 | + .addEqualityGroup(new DeviceFragmentId(DID2, PID), | ||
25 | + new DeviceFragmentId(DID2, PID)) | ||
26 | + .addEqualityGroup(new DeviceFragmentId(DID1, PIDA), | ||
27 | + new DeviceFragmentId(DID1, PIDA)) | ||
28 | + .addEqualityGroup(new DeviceFragmentId(DID2, PIDA), | ||
29 | + new DeviceFragmentId(DID2, PIDA)) | ||
30 | + .testEquals(); | ||
31 | + } | ||
32 | + | ||
33 | +} |
core/store/dist/src/test/java/org/onlab/onos/store/device/impl/peermsg/PortFragmentIdTest.java
0 → 100644
1 | +package org.onlab.onos.store.device.impl.peermsg; | ||
2 | + | ||
3 | +import static org.onlab.onos.net.DeviceId.deviceId; | ||
4 | + | ||
5 | +import org.junit.Test; | ||
6 | +import org.onlab.onos.net.DeviceId; | ||
7 | +import org.onlab.onos.net.PortNumber; | ||
8 | +import org.onlab.onos.net.provider.ProviderId; | ||
9 | + | ||
10 | +import com.google.common.testing.EqualsTester; | ||
11 | + | ||
12 | +public class PortFragmentIdTest { | ||
13 | + | ||
14 | + private static final ProviderId PID = new ProviderId("of", "foo"); | ||
15 | + private static final ProviderId PIDA = new ProviderId("of", "bar", true); | ||
16 | + | ||
17 | + private static final DeviceId DID1 = deviceId("of:foo"); | ||
18 | + private static final DeviceId DID2 = deviceId("of:bar"); | ||
19 | + | ||
20 | + private static final PortNumber PN1 = PortNumber.portNumber(1); | ||
21 | + private static final PortNumber PN2 = PortNumber.portNumber(2); | ||
22 | + | ||
23 | + @Test | ||
24 | + public final void testEquals() { | ||
25 | + new EqualsTester() | ||
26 | + .addEqualityGroup(new PortFragmentId(DID1, PID, PN1), | ||
27 | + new PortFragmentId(DID1, PID, PN1)) | ||
28 | + .addEqualityGroup(new PortFragmentId(DID2, PID, PN1), | ||
29 | + new PortFragmentId(DID2, PID, PN1)) | ||
30 | + .addEqualityGroup(new PortFragmentId(DID1, PIDA, PN1), | ||
31 | + new PortFragmentId(DID1, PIDA, PN1)) | ||
32 | + .addEqualityGroup(new PortFragmentId(DID2, PIDA, PN1), | ||
33 | + new PortFragmentId(DID2, PIDA, PN1)) | ||
34 | + | ||
35 | + .addEqualityGroup(new PortFragmentId(DID1, PID, PN2), | ||
36 | + new PortFragmentId(DID1, PID, PN2)) | ||
37 | + .addEqualityGroup(new PortFragmentId(DID2, PID, PN2), | ||
38 | + new PortFragmentId(DID2, PID, PN2)) | ||
39 | + .addEqualityGroup(new PortFragmentId(DID1, PIDA, PN2), | ||
40 | + new PortFragmentId(DID1, PIDA, PN2)) | ||
41 | + .addEqualityGroup(new PortFragmentId(DID2, PIDA, PN2), | ||
42 | + new PortFragmentId(DID2, PIDA, PN2)) | ||
43 | + .testEquals(); | ||
44 | + } | ||
45 | + | ||
46 | +} |
-
Please register or login to post a comment