blob: e3791328c56261c86407a5e40280c16df4f3151e [file] [log] [blame]
Thomas Vachuska58de4162015-09-10 16:15:33 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Thomas Vachuska58de4162015-09-10 16:15:33 -07003 *
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'Connor6de2e202015-05-21 14:30:41 -070016package org.onosproject.incubator.net.resource.label;
jccde3e92e2015-03-28 01:40:44 -070017
18import java.util.Collections;
19
20import org.junit.Test;
21import org.onosproject.event.AbstractEventTest;
22import org.onosproject.net.DeviceId;
23
24import com.google.common.collect.ImmutableSet;
25import com.google.common.testing.EqualsTester;
26
27/**
28 * Tests of the label resource request.
29 */
30public class LabelResourceRequestTest extends AbstractEventTest {
31
32 @Test
33 public void testEquality() {
34 DeviceId deviceId1 = DeviceId.deviceId("of:0001");
35 DeviceId deviceId2 = DeviceId.deviceId("of:0002");
36 long apply = 2;
37 ImmutableSet<LabelResource> releaseCollection = ImmutableSet
38 .copyOf(Collections.emptySet());
39 LabelResourceRequest h1 = new LabelResourceRequest(
40 deviceId1,
41 LabelResourceRequest.Type.APPLY,
42 apply, null);
43 LabelResourceRequest h2 = new LabelResourceRequest(
44 deviceId1,
45 LabelResourceRequest.Type.APPLY,
46 apply, null);
47 LabelResourceRequest h3 = new LabelResourceRequest(
48 deviceId2,
49 LabelResourceRequest.Type.RELEASE,
50 0, releaseCollection);
51 LabelResourceRequest h4 = new LabelResourceRequest(
52 deviceId2,
53 LabelResourceRequest.Type.RELEASE,
54 0, releaseCollection);
55
56 new EqualsTester().addEqualityGroup(h1, h2).addEqualityGroup(h3, h4)
57 .testEquals();
58 }
59}