blob: 1e2101a90467bc45a5b5d1e0cfc1bf240342b7b0 [file] [log] [blame]
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -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.pcepio;
17
18import java.util.LinkedList;
19
20import org.junit.Test;
21import org.onosproject.pcepio.types.AdministrativeGroupTlv;
22import org.onosproject.pcepio.types.MaximumReservableLinkBandwidthTlv;
23import org.onosproject.pcepio.types.PcepValueType;
24import org.onosproject.pcepio.types.TELinkAttributesTlv;
25
26import com.google.common.testing.EqualsTester;
27
28/**
29 * Test case for TE Link Attribute Tlv.
30 */
31public class TELinkAttributesTlvTest {
32
33 private final AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10);
34 private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 =
35 new MaximumReservableLinkBandwidthTlv(20);
36
37 private final AdministrativeGroupTlv administrativeGroupTlv2 = new AdministrativeGroupTlv(20);
38 private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv2 =
39 new MaximumReservableLinkBandwidthTlv(30);
40
41 private final LinkedList<PcepValueType> llLinkAttributesSubTLV1 = new LinkedList<>();
42 private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1);
43 private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1);
44
45 private final LinkedList<PcepValueType> llLinkAttributesSubTLV2 = new LinkedList<>();
46
47 private final boolean c = llLinkAttributesSubTLV2.add(administrativeGroupTlv2);
48 private final boolean d = llLinkAttributesSubTLV2.add(maximumReservableLinkBandwidthTlv2);
49
50 private final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1);
51 private final TELinkAttributesTlv sameAsTlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1);
52 private final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLV2);
53
54 @Test
55 public void basics() {
56 new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
57 }
58
59}