blob: 3508d2c0f25ac039e03fe4ee44254e7240a4e39b [file] [log] [blame]
alshabibab984662014-12-04 18:56:18 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
alshabibab984662014-12-04 18:56:18 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.store.link.impl;
Yuta HIGUCHI34a01f22014-11-04 15:58:20 -080017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import static org.onosproject.net.DeviceId.deviceId;
Yuta HIGUCHI34a01f22014-11-04 15:58:20 -080019
20import org.junit.Test;
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.LinkKey;
24import org.onosproject.net.PortNumber;
25import org.onosproject.net.provider.ProviderId;
Yuta HIGUCHI34a01f22014-11-04 15:58:20 -080026import com.google.common.testing.EqualsTester;
27
28public class LinkFragmentIdTest {
29
30 private static final ProviderId PID = new ProviderId("of", "foo");
31 private static final ProviderId PIDA = new ProviderId("of", "bar", true);
32
33 private static final DeviceId DID1 = deviceId("of:foo");
34 private static final DeviceId DID2 = deviceId("of:bar");
35
36 private static final PortNumber P1 = PortNumber.portNumber(1);
37 private static final PortNumber P2 = PortNumber.portNumber(2);
38 private static final PortNumber P3 = PortNumber.portNumber(3);
39
40 private static final ConnectPoint CP1 = new ConnectPoint(DID1, P1);
41 private static final ConnectPoint CP2 = new ConnectPoint(DID2, P2);
42
43 private static final ConnectPoint CP3 = new ConnectPoint(DID1, P2);
44 private static final ConnectPoint CP4 = new ConnectPoint(DID2, P3);
45
46 private static final LinkKey L1 = LinkKey.linkKey(CP1, CP2);
47 private static final LinkKey L2 = LinkKey.linkKey(CP3, CP4);
48
49 @Test
50 public void testEquals() {
51 new EqualsTester()
52 .addEqualityGroup(new LinkFragmentId(L1, PID),
53 new LinkFragmentId(L1, PID))
54 .addEqualityGroup(new LinkFragmentId(L2, PID),
55 new LinkFragmentId(L2, PID))
56 .addEqualityGroup(new LinkFragmentId(L1, PIDA),
57 new LinkFragmentId(L1, PIDA))
58 .addEqualityGroup(new LinkFragmentId(L2, PIDA),
59 new LinkFragmentId(L2, PIDA))
60 .testEquals();
61 }
62
63}