blob: a9a8ed2c05a29ce3fba48089704f2a1d60f80f2f [file] [log] [blame]
Sho SHIMIZU4ecaeea2015-07-27 11:49:57 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
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 */
16package org.onosproject.net.newresource;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Test;
20import org.onlab.packet.VlanId;
Sho SHIMIZU4ecaeea2015-07-27 11:49:57 -070021import org.onosproject.net.DeviceId;
Sho SHIMIZU4ecaeea2015-07-27 11:49:57 -070022import org.onosproject.net.PortNumber;
23import org.onosproject.net.intent.IntentId;
24
25public class ResourceAllocationTest {
26
27 private static final DeviceId D1 = DeviceId.deviceId("of:001");
28 private static final DeviceId D2 = DeviceId.deviceId("of:002");
29 private static final PortNumber P1 = PortNumber.portNumber(1);
Sho SHIMIZU4ecaeea2015-07-27 11:49:57 -070030 private static final VlanId VLAN1 = VlanId.vlanId((short) 100);
31 private static final IntentId IID1 = IntentId.valueOf(30);
32
33 @Test
34 public void testEquals() {
Sho SHIMIZU8fa670a2016-01-14 11:17:18 -080035 ResourceAllocation alloc1 = new ResourceAllocation(Resource.discrete(D1, P1, VLAN1), IID1);
36 ResourceAllocation sameAsAlloc1 = new ResourceAllocation(Resource.discrete(D1, P1, VLAN1), IID1);
37 ResourceAllocation alloc2 = new ResourceAllocation(Resource.discrete(D2, P1, VLAN1), IID1);
Sho SHIMIZU4ecaeea2015-07-27 11:49:57 -070038
39 new EqualsTester()
40 .addEqualityGroup(alloc1, sameAsAlloc1)
41 .addEqualityGroup(alloc2)
42 .testEquals();
43 }
44}