blob: 46634c7cbae6ba2f9f55736e656a9afd89f44a91 [file] [log] [blame]
Thomas Vachuskabf916ea2015-05-20 18:24:34 -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.incubator.net.tunnel;
jcc4a20a5f2015-04-30 15:43:39 +080017
18import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
19
20import org.junit.Test;
21import org.onlab.packet.IpAddress;
22import org.onosproject.core.ApplicationId;
23import org.onosproject.core.DefaultApplicationId;
24
25import com.google.common.testing.EqualsTester;
26
27/**
28 * Test of order model entity.
29 */
30public class TunnelSubscriptionTest {
31 /**
32 * Checks that the Order class is immutable.
33 */
34 @Test
35 public void testImmutability() {
36 assertThatClassIsImmutable(TunnelSubscription.class);
37 }
38
39 /**
40 * Checks the operation of equals(), hashCode() and toString() methods.
41 */
42 @Test
43 public void testEquality() {
44 TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(23423));
45 TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress.valueOf(32421));
46 ApplicationId appId = new DefaultApplicationId(243, "test");
47 ApplicationId appId2 = new DefaultApplicationId(2431, "test1");
48 TunnelId tunnelId = TunnelId.valueOf(41654654);
49 TunnelSubscription p1 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN,
50 null);
51 TunnelSubscription p2 = new TunnelSubscription(appId, src, dst, tunnelId, Tunnel.Type.VXLAN,
52 null);
53 TunnelSubscription p3 = new TunnelSubscription(appId2, src, dst, tunnelId, Tunnel.Type.VXLAN,
54 null);
55 new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
56 .testEquals();
57 }
58}