Mahesh Poojary S | f1bbd36 | 2016-02-25 18:19:59 +0530 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.pcepio.types; |
| 17 | |
| 18 | import com.google.common.testing.EqualsTester; |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import java.util.LinkedList; |
| 22 | import java.util.List; |
| 23 | |
| 24 | /** |
| 25 | * Test case for TE Node Attribute tlv. |
| 26 | */ |
| 27 | public class NodeAttributesTlvTest { |
| 28 | |
| 29 | private final NodeFlagBitsSubTlv nodeFlagBitsTlv1 = new NodeFlagBitsSubTlv((byte) 10); |
| 30 | private final IPv4RouterIdOfLocalNodeSubTlv iPv4TERouterIdOfLocalNodeTlv1 = new |
| 31 | IPv4RouterIdOfLocalNodeSubTlv(0x01010101); |
| 32 | |
| 33 | private final NodeFlagBitsSubTlv nodeFlagBitsTlv2 = new NodeFlagBitsSubTlv((byte) 20); |
| 34 | private final IPv4RouterIdOfLocalNodeSubTlv iPv4TERouterIdOfLocalNodeTlv2 = new |
| 35 | IPv4RouterIdOfLocalNodeSubTlv(0x02020202); |
| 36 | |
| 37 | private final List<PcepValueType> llNodeAttributesSubTLV1 = new LinkedList<>(); |
| 38 | private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1); |
| 39 | private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1); |
| 40 | |
| 41 | private final List<PcepValueType> llNodeAttributesSubTLV2 = new LinkedList<>(); |
| 42 | |
| 43 | private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2); |
| 44 | private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2); |
| 45 | |
| 46 | private final NodeAttributesTlv tlv1 = NodeAttributesTlv.of(llNodeAttributesSubTLV1); |
| 47 | private final NodeAttributesTlv sameAsTlv1 = NodeAttributesTlv.of(llNodeAttributesSubTLV1); |
| 48 | private final NodeAttributesTlv tlv2 = NodeAttributesTlv.of(llNodeAttributesSubTLV2); |
| 49 | |
| 50 | @Test |
| 51 | public void basics() { |
| 52 | new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals(); |
| 53 | } |
| 54 | |
| 55 | } |