SureshBR
Committed by Gerrit Code Review

Pcep TLV UT updated for access modifiers and review comments

Change-Id: Id4ea96d638b3b78440b4af615fb02fb34621c008
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -24,8 +24,8 @@ import org.onosproject.pcepio.types.IGPMetricTlv; ...@@ -24,8 +24,8 @@ import org.onosproject.pcepio.types.IGPMetricTlv;
24 * Test of the IGPMetricTlv. 24 * Test of the IGPMetricTlv.
25 */ 25 */
26 public class IGPMetricTlvTest { 26 public class IGPMetricTlvTest {
27 - private byte[] b1 = new byte[] {0x01, 0x02}; 27 + private final byte[] b1 = new byte[] {0x01, 0x02};
28 - private byte[] b2 = new byte[] {0x01, 0x02}; 28 + private final byte[] b2 = new byte[] {0x01, 0x02};
29 private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2); 29 private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2);
30 private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2); 30 private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2);
31 private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2); 31 private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2);
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -25,8 +25,8 @@ import org.onosproject.pcepio.types.ISISAreaIdentifierTlv; ...@@ -25,8 +25,8 @@ import org.onosproject.pcepio.types.ISISAreaIdentifierTlv;
25 */ 25 */
26 public class ISISAreaIdentifierTlvTest { 26 public class ISISAreaIdentifierTlvTest {
27 27
28 - private byte[] b1 = new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; 28 + private final byte[] b1 = new byte[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
29 - private byte[] b2 = new byte[] {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }; 29 + private final byte[] b2 = new byte[] {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 };
30 30
31 private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); 31 private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);
32 private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20); 32 private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);
......
...@@ -15,23 +15,22 @@ ...@@ -15,23 +15,22 @@
15 */ 15 */
16 package org.onosproject.pcepio; 16 package org.onosproject.pcepio;
17 17
18 -import com.google.common.testing.EqualsTester;
19 -
20 import org.junit.Test; 18 import org.junit.Test;
21 import org.onosproject.pcepio.types.PathSetupTypeTlv; 19 import org.onosproject.pcepio.types.PathSetupTypeTlv;
22 20
21 +import com.google.common.testing.EqualsTester;
22 +
23 /** 23 /**
24 * Test of the PathSetupTypeTlv. 24 * Test of the PathSetupTypeTlv.
25 */ 25 */
26 public class PathSetupTypeTlvTest { 26 public class PathSetupTypeTlvTest {
27 - final int rawValue1 = 0x0A;
28 - final int rawValue2 = 0x0A;
29 27
30 - final PathSetupTypeTlv tlv1 = new PathSetupTypeTlv(rawValue1); 28 + private final PathSetupTypeTlv tlv1 = PathSetupTypeTlv.of(0x0A);
31 - final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(tlv1.getInt()); 29 + private final PathSetupTypeTlv sameAsTlv1 = PathSetupTypeTlv.of(0x0A);
30 + private final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(0x0B);
32 31
33 @Test 32 @Test
34 public void basics() { 33 public void basics() {
35 - new EqualsTester().addEqualityGroup(tlv1, tlv2).testEquals(); 34 + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
36 } 35 }
37 } 36 }
......
...@@ -30,24 +30,28 @@ import com.google.common.testing.EqualsTester; ...@@ -30,24 +30,28 @@ import com.google.common.testing.EqualsTester;
30 */ 30 */
31 public class RemoteTENodeDescriptorsTLVTest { 31 public class RemoteTENodeDescriptorsTLVTest {
32 32
33 - AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10); 33 + private final AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10);
34 - BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20);; 34 + private final BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20);
35 - LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>();
36 - LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs2 = new LinkedList<PcepValueType>();
37 - LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs3 = new LinkedList<PcepValueType>();
38 35
39 - boolean b = llRemoteTENodeDescriptorSubTLVs1.add(autonomousSystemTlv1); 36 + private final AutonomousSystemTlv autonomousSystemTlv2 = new AutonomousSystemTlv(20);
37 + private final BGPLSidentifierTlv bGPLSidentifierTlv2 = new BGPLSidentifierTlv(30);
40 38
41 - boolean c = llRemoteTENodeDescriptorSubTLVs2.add(autonomousSystemTlv1); 39 + private final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLV1 = new LinkedList<PcepValueType>();
42 - boolean d = llRemoteTENodeDescriptorSubTLVs3.add(bGPLSidentifierTlv1); 40 + private final boolean a = llRemoteTENodeDescriptorSubTLV1.add(autonomousSystemTlv1);
41 + private final boolean b = llRemoteTENodeDescriptorSubTLV1.add(bGPLSidentifierTlv1);
43 42
44 - final RemoteTENodeDescriptorsTLV tlv1 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs1); 43 + private final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLV2 = new LinkedList<PcepValueType>();
45 - final RemoteTENodeDescriptorsTLV tlv2 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs2); 44 + private final boolean c = llRemoteTENodeDescriptorSubTLV2.add(autonomousSystemTlv2);
46 - final RemoteTENodeDescriptorsTLV tlv3 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs3); 45 + private final boolean d = llRemoteTENodeDescriptorSubTLV2.add(bGPLSidentifierTlv2);
46 +
47 + private final RemoteTENodeDescriptorsTLV tlv1 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV1);
48 + private final RemoteTENodeDescriptorsTLV sameAsTlv1 =
49 + RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV1);
50 + private final RemoteTENodeDescriptorsTLV tlv2 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV2);
47 51
48 @Test 52 @Test
49 public void basics() { 53 public void basics() {
50 - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); 54 + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
51 } 55 }
52 56
53 } 57 }
......
...@@ -25,15 +25,15 @@ import com.google.common.testing.EqualsTester; ...@@ -25,15 +25,15 @@ import com.google.common.testing.EqualsTester;
25 */ 25 */
26 public class RouterIDSubTlvTest { 26 public class RouterIDSubTlvTest {
27 27
28 - private byte[] value1 = {1, 2 }; 28 + private final byte[] value1 = {1, 2 };
29 - private Short length1 = new Short((short) 2); 29 + private final Short length1 = new Short((short) 2);
30 private final RouterIDSubTlv tlv1 = RouterIDSubTlv.of(value1, length1); 30 private final RouterIDSubTlv tlv1 = RouterIDSubTlv.of(value1, length1);
31 31
32 - private Short length2 = new Short((short) 2); 32 + private final Short length2 = new Short((short) 2);
33 private final RouterIDSubTlv tlv2 = RouterIDSubTlv.of(value1, length2); 33 private final RouterIDSubTlv tlv2 = RouterIDSubTlv.of(value1, length2);
34 34
35 - private byte[] value3 = {1, 2, 3 }; 35 + private final byte[] value3 = {1, 2, 3 };
36 - private Short length3 = new Short((short) 3); 36 + private final Short length3 = new Short((short) 3);
37 private final RouterIDSubTlv tlv3 = RouterIDSubTlv.of(value3, length3); 37 private final RouterIDSubTlv tlv3 = RouterIDSubTlv.of(value3, length3);
38 38
39 @Test 39 @Test
......
...@@ -25,20 +25,19 @@ import com.google.common.testing.EqualsTester; ...@@ -25,20 +25,19 @@ import com.google.common.testing.EqualsTester;
25 */ 25 */
26 public class SharedRiskLinkGroupTlvTest { 26 public class SharedRiskLinkGroupTlvTest {
27 27
28 - private int[] raw = {1 }; 28 + private final int[] raw = {1 };
29 - private Short hLength = new Short((short) 2); 29 + private final Short hLength = new Short((short) 2);
30 private final SharedRiskLinkGroupTlv tlv1 = SharedRiskLinkGroupTlv.of(raw, hLength); 30 private final SharedRiskLinkGroupTlv tlv1 = SharedRiskLinkGroupTlv.of(raw, hLength);
31 31
32 - private Short hLength1 = new Short((short) 2); 32 + private final SharedRiskLinkGroupTlv sameAsTlv1 = SharedRiskLinkGroupTlv.of(raw, hLength);
33 - private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw, hLength1);
34 33
35 - private int[] raw2 = {2 }; 34 + private final int[] raw2 = {2 };
36 - private Short hLength2 = new Short((short) 3); 35 + private final Short hLength2 = new Short((short) 3);
37 - private SharedRiskLinkGroupTlv tlv3 = SharedRiskLinkGroupTlv.of(raw2, hLength2); 36 + private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw2, hLength2);
38 37
39 @Test 38 @Test
40 public void basics() { 39 public void basics() {
41 - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); 40 + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
42 } 41 }
43 42
44 } 43 }
......
...@@ -30,24 +30,30 @@ import com.google.common.testing.EqualsTester; ...@@ -30,24 +30,30 @@ import com.google.common.testing.EqualsTester;
30 */ 30 */
31 public class TELinkAttributesTlvTest { 31 public class TELinkAttributesTlvTest {
32 32
33 - AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10); 33 + private final AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10);
34 - MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 = new MaximumReservableLinkBandwidthTlv(20);; 34 + private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 =
35 - LinkedList<PcepValueType> llLinkAttributesSubTLVs = new LinkedList<PcepValueType>(); 35 + new MaximumReservableLinkBandwidthTlv(20);
36 - LinkedList<PcepValueType> llLinkAttributesSubTLVs2 = new LinkedList<PcepValueType>();
37 - LinkedList<PcepValueType> llLinkAttributesSubTLVs3 = new LinkedList<PcepValueType>();
38 36
39 - boolean b = llLinkAttributesSubTLVs.add(administrativeGroupTlv1); 37 + private final AdministrativeGroupTlv administrativeGroupTlv2 = new AdministrativeGroupTlv(20);
38 + private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv2 =
39 + new MaximumReservableLinkBandwidthTlv(30);
40 40
41 - boolean c = llLinkAttributesSubTLVs2.add(administrativeGroupTlv1); 41 + private final LinkedList<PcepValueType> llLinkAttributesSubTLV1 = new LinkedList<PcepValueType>();
42 - boolean d = llLinkAttributesSubTLVs3.add(maximumReservableLinkBandwidthTlv1); 42 + private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1);
43 + private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1);
43 44
44 - final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs); 45 + private final LinkedList<PcepValueType> llLinkAttributesSubTLV2 = new LinkedList<PcepValueType>();
45 - final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs2); 46 +
46 - final TELinkAttributesTlv tlv3 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs3); 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);
47 53
48 @Test 54 @Test
49 public void basics() { 55 public void basics() {
50 - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); 56 + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
51 } 57 }
52 58
53 } 59 }
......
...@@ -29,23 +29,29 @@ import com.google.common.testing.EqualsTester; ...@@ -29,23 +29,29 @@ import com.google.common.testing.EqualsTester;
29 * Test case for TE link descriptors Tlv. 29 * Test case for TE link descriptors Tlv.
30 */ 30 */
31 public class TELinkDescriptorsTLVTest { 31 public class TELinkDescriptorsTLVTest {
32 - LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new LinkLocalRemoteIdentifiersTlv(10, 10); 32 + private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new
33 - IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv((int) 0x01010101); 33 + LinkLocalRemoteIdentifiersTlv(10, 10);
34 - LinkedList<PcepValueType> llLinkDescriptorsSubTLVs1 = new LinkedList<PcepValueType>(); 34 + private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv(0x01010101);
35 - LinkedList<PcepValueType> llLinkDescriptorsSubTLVs2 = new LinkedList<PcepValueType>();
36 - LinkedList<PcepValueType> llLinkDescriptorsSubTLVs3 = new LinkedList<PcepValueType>();
37 35
38 - boolean b = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1); 36 + private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv2 = new
39 - boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv1); 37 + LinkLocalRemoteIdentifiersTlv(20, 20);
40 - boolean d = llLinkDescriptorsSubTLVs3.add(iPv4InterfaceAddressTlv1); 38 + private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv2 = new IPv4InterfaceAddressTlv(0x02020202);
41 39
42 - final TELinkDescriptorsTLV tlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1); 40 + private final LinkedList<PcepValueType> llLinkDescriptorsSubTLVs1 = new LinkedList<PcepValueType>();
43 - final TELinkDescriptorsTLV tlv2 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs2); 41 + private final boolean a = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1);
44 - final TELinkDescriptorsTLV tlv3 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs3); 42 + private final boolean b = llLinkDescriptorsSubTLVs1.add(iPv4InterfaceAddressTlv1);
43 +
44 + private final LinkedList<PcepValueType> llLinkDescriptorsSubTLVs2 = new LinkedList<PcepValueType>();
45 + private final boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv2);
46 + private final boolean d = llLinkDescriptorsSubTLVs2.add(iPv4InterfaceAddressTlv2);
47 +
48 + private final TELinkDescriptorsTLV tlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1);
49 + private final TELinkDescriptorsTLV sameAstlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1);
50 + private final TELinkDescriptorsTLV tlv2 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs2);
45 51
46 @Test 52 @Test
47 public void basics() { 53 public void basics() {
48 - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); 54 + new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals();
49 } 55 }
50 56
51 } 57 }
......
...@@ -30,24 +30,30 @@ import com.google.common.testing.EqualsTester; ...@@ -30,24 +30,30 @@ import com.google.common.testing.EqualsTester;
30 */ 30 */
31 public class TENodeAttributesTlvTest { 31 public class TENodeAttributesTlvTest {
32 32
33 - NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10); 33 + private final NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10);
34 - IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new IPv4TERouterIdOfLocalNodeTlv((int) 0x01010101);; 34 + private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new
35 - LinkedList<PcepValueType> llNodeAttributesSubTLVs1 = new LinkedList<PcepValueType>(); 35 + IPv4TERouterIdOfLocalNodeTlv(0x01010101);
36 - LinkedList<PcepValueType> llNodeAttributesSubTLVs2 = new LinkedList<PcepValueType>();
37 - LinkedList<PcepValueType> llNodeAttributesSubTLVs3 = new LinkedList<PcepValueType>();
38 36
39 - boolean b = llNodeAttributesSubTLVs1.add(nodeFlagBitsTlv1); 37 + private final NodeFlagBitsTlv nodeFlagBitsTlv2 = new NodeFlagBitsTlv((byte) 20);
38 + private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv2 = new
39 + IPv4TERouterIdOfLocalNodeTlv(0x02020202);
40 40
41 - boolean c = llNodeAttributesSubTLVs2.add(nodeFlagBitsTlv1); 41 + private final LinkedList<PcepValueType> llNodeAttributesSubTLV1 = new LinkedList<PcepValueType>();
42 - boolean d = llNodeAttributesSubTLVs3.add(iPv4TERouterIdOfLocalNodeTlv1); 42 + private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1);
43 + private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1);
43 44
44 - final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs1); 45 + private final LinkedList<PcepValueType> llNodeAttributesSubTLV2 = new LinkedList<PcepValueType>();
45 - final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs2); 46 +
46 - final TENodeAttributesTlv tlv3 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs3); 47 + private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2);
48 + private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2);
49 +
50 + private final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);
51 + private final TENodeAttributesTlv sameAsTlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);
52 + private final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLV2);
47 53
48 @Test 54 @Test
49 public void basics() { 55 public void basics() {
50 - new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); 56 + new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
51 } 57 }
52 58
53 } 59 }
......