Pcep TLV UT updated for access modifiers and review comments

Change-Id: Id4ea96d638b3b78440b4af615fb02fb34621c008
diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java
index 3b4e0a2..046183b 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/IGPMetricTlvTest.java
@@ -1,5 +1,5 @@
 /*

- * Copyright 2014 Open Networking Laboratory

+ * Copyright 2015 Open Networking Laboratory

  *

  * Licensed under the Apache License, Version 2.0 (the "License");

  * you may not use this file except in compliance with the License.

@@ -24,8 +24,8 @@
  * Test of the IGPMetricTlv.

  */

 public class IGPMetricTlvTest {

-    private byte[] b1 = new byte[] {0x01, 0x02};

-    private byte[] b2 = new byte[] {0x01, 0x02};

+    private final byte[] b1 = new byte[] {0x01, 0x02};

+    private final byte[] b2 = new byte[] {0x01, 0x02};

     private final IGPMetricTlv tlv1 = IGPMetricTlv.of(b1, (short) 2);

     private final IGPMetricTlv sameAsTlv1 = IGPMetricTlv.of(b1, (short) 2);

     private final IGPMetricTlv tlv2 = IGPMetricTlv.of(b2, (short) 2);

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java
index 715339b..1e137b0 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/ISISAreaIdentifierTlvTest.java
@@ -1,5 +1,5 @@
 /*

- * Copyright 2014 Open Networking Laboratory

+ * Copyright 2015 Open Networking Laboratory

  *

  * Licensed under the Apache License, Version 2.0 (the "License");

  * you may not use this file except in compliance with the License.

@@ -25,8 +25,8 @@
  */

 public class ISISAreaIdentifierTlvTest {

 

-    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 };

-    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 };

+    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 };

+    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 };

 

     private final ISISAreaIdentifierTlv tlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);

     private final ISISAreaIdentifierTlv sameAsTlv1 = ISISAreaIdentifierTlv.of(b1, (short) 20);

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java
index 69be405..633cf37 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/PathSetupTypeTlvTest.java
@@ -15,23 +15,22 @@
  */

 package org.onosproject.pcepio;

 

-import com.google.common.testing.EqualsTester;

-

 import org.junit.Test;

 import org.onosproject.pcepio.types.PathSetupTypeTlv;

 

+import com.google.common.testing.EqualsTester;

+

 /**

  * Test of the PathSetupTypeTlv.

  */

 public class PathSetupTypeTlvTest {

-    final int rawValue1 = 0x0A;

-    final int rawValue2 = 0x0A;

 

-    final PathSetupTypeTlv tlv1 = new PathSetupTypeTlv(rawValue1);

-    final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(tlv1.getInt());

+    private final PathSetupTypeTlv tlv1 = PathSetupTypeTlv.of(0x0A);

+    private final PathSetupTypeTlv sameAsTlv1 = PathSetupTypeTlv.of(0x0A);

+    private final PathSetupTypeTlv tlv2 = PathSetupTypeTlv.of(0x0B);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();

     }

 }

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTLVTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTLVTest.java
index 43a9868..b2422ca 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTLVTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/RemoteTENodeDescriptorsTLVTest.java
@@ -30,24 +30,28 @@
  */

 public class RemoteTENodeDescriptorsTLVTest {

 

-    AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10);

-    BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20);;

-    LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs2 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLVs3 = new LinkedList<PcepValueType>();

+    private final AutonomousSystemTlv autonomousSystemTlv1 = new AutonomousSystemTlv(10);

+    private final BGPLSidentifierTlv bGPLSidentifierTlv1 = new BGPLSidentifierTlv(20);

 

-    boolean b = llRemoteTENodeDescriptorSubTLVs1.add(autonomousSystemTlv1);

+    private final AutonomousSystemTlv autonomousSystemTlv2 = new AutonomousSystemTlv(20);

+    private final BGPLSidentifierTlv bGPLSidentifierTlv2 = new BGPLSidentifierTlv(30);

 

-    boolean c = llRemoteTENodeDescriptorSubTLVs2.add(autonomousSystemTlv1);

-    boolean d = llRemoteTENodeDescriptorSubTLVs3.add(bGPLSidentifierTlv1);

+    private final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLV1 = new LinkedList<PcepValueType>();

+    private final boolean a = llRemoteTENodeDescriptorSubTLV1.add(autonomousSystemTlv1);

+    private final boolean b = llRemoteTENodeDescriptorSubTLV1.add(bGPLSidentifierTlv1);

 

-    final RemoteTENodeDescriptorsTLV tlv1 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs1);

-    final RemoteTENodeDescriptorsTLV tlv2 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs2);

-    final RemoteTENodeDescriptorsTLV tlv3 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLVs3);

+    private final LinkedList<PcepValueType> llRemoteTENodeDescriptorSubTLV2 = new LinkedList<PcepValueType>();

+    private final boolean c = llRemoteTENodeDescriptorSubTLV2.add(autonomousSystemTlv2);

+    private final boolean d = llRemoteTENodeDescriptorSubTLV2.add(bGPLSidentifierTlv2);

+

+    private final RemoteTENodeDescriptorsTLV tlv1 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV1);

+    private final RemoteTENodeDescriptorsTLV sameAsTlv1 =

+            RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV1);

+    private final RemoteTENodeDescriptorsTLV tlv2 = RemoteTENodeDescriptorsTLV.of(llRemoteTENodeDescriptorSubTLV2);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();

     }

 

 }

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java
index ca07452..993ac90 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/RouterIDSubTlvTest.java
@@ -25,15 +25,15 @@
  */

 public class RouterIDSubTlvTest {

 

-    private byte[] value1 = {1, 2 };

-    private Short length1 = new Short((short) 2);

+    private final byte[] value1 = {1, 2 };

+    private final Short length1 = new Short((short) 2);

     private final RouterIDSubTlv tlv1 = RouterIDSubTlv.of(value1, length1);

 

-    private Short length2 = new Short((short) 2);

+    private final Short length2 = new Short((short) 2);

     private final RouterIDSubTlv tlv2 = RouterIDSubTlv.of(value1, length2);

 

-    private byte[] value3 = {1, 2, 3 };

-    private Short length3 = new Short((short) 3);

+    private final byte[] value3 = {1, 2, 3 };

+    private final Short length3 = new Short((short) 3);

     private final RouterIDSubTlv tlv3 = RouterIDSubTlv.of(value3, length3);

 

     @Test

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java
index 0343bb0..98e968d 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/SharedRiskLinkGroupTlvTest.java
@@ -25,20 +25,19 @@
  */

 public class SharedRiskLinkGroupTlvTest {

 

-    private int[] raw = {1 };

-    private Short hLength = new Short((short) 2);

+    private final int[] raw = {1 };

+    private final Short hLength = new Short((short) 2);

     private final SharedRiskLinkGroupTlv tlv1 = SharedRiskLinkGroupTlv.of(raw, hLength);

 

-    private Short hLength1 = new Short((short) 2);

-    private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw, hLength1);

+    private final SharedRiskLinkGroupTlv sameAsTlv1 = SharedRiskLinkGroupTlv.of(raw, hLength);

 

-    private int[] raw2 = {2 };

-    private Short hLength2 = new Short((short) 3);

-    private SharedRiskLinkGroupTlv tlv3 = SharedRiskLinkGroupTlv.of(raw2, hLength2);

+    private final int[] raw2 = {2 };

+    private final Short hLength2 = new Short((short) 3);

+    private final SharedRiskLinkGroupTlv tlv2 = SharedRiskLinkGroupTlv.of(raw2, hLength2);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();

     }

 

 }

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java
index 55d2851..a33462a 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkAttributesTlvTest.java
@@ -30,24 +30,30 @@
  */

 public class TELinkAttributesTlvTest {

 

-    AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10);

-    MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 = new MaximumReservableLinkBandwidthTlv(20);;

-    LinkedList<PcepValueType> llLinkAttributesSubTLVs = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llLinkAttributesSubTLVs2 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llLinkAttributesSubTLVs3 = new LinkedList<PcepValueType>();

+    private final AdministrativeGroupTlv administrativeGroupTlv1 = new AdministrativeGroupTlv(10);

+    private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv1 =

+            new MaximumReservableLinkBandwidthTlv(20);

 

-    boolean b = llLinkAttributesSubTLVs.add(administrativeGroupTlv1);

+    private final AdministrativeGroupTlv administrativeGroupTlv2 = new AdministrativeGroupTlv(20);

+    private final MaximumReservableLinkBandwidthTlv maximumReservableLinkBandwidthTlv2 =

+            new MaximumReservableLinkBandwidthTlv(30);

 

-    boolean c = llLinkAttributesSubTLVs2.add(administrativeGroupTlv1);

-    boolean d = llLinkAttributesSubTLVs3.add(maximumReservableLinkBandwidthTlv1);

+    private final LinkedList<PcepValueType> llLinkAttributesSubTLV1 = new LinkedList<PcepValueType>();

+    private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1);

+    private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1);

 

-    final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs);

-    final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs2);

-    final TELinkAttributesTlv tlv3 = TELinkAttributesTlv.of(llLinkAttributesSubTLVs3);

+    private final LinkedList<PcepValueType> llLinkAttributesSubTLV2 = new LinkedList<PcepValueType>();

+

+    private final boolean c = llLinkAttributesSubTLV2.add(administrativeGroupTlv2);

+    private final boolean d = llLinkAttributesSubTLV2.add(maximumReservableLinkBandwidthTlv2);

+

+    private final TELinkAttributesTlv tlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1);

+    private final TELinkAttributesTlv sameAsTlv1 = TELinkAttributesTlv.of(llLinkAttributesSubTLV1);

+    private final TELinkAttributesTlv tlv2 = TELinkAttributesTlv.of(llLinkAttributesSubTLV2);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();

     }

 

 }

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTLVTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTLVTest.java
index 42d0c42..65cef70 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTLVTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TELinkDescriptorsTLVTest.java
@@ -29,23 +29,29 @@
  * Test case for TE link descriptors Tlv.

  */

 public class TELinkDescriptorsTLVTest {

-    LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new LinkLocalRemoteIdentifiersTlv(10, 10);

-    IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv((int) 0x01010101);

-    LinkedList<PcepValueType> llLinkDescriptorsSubTLVs1 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llLinkDescriptorsSubTLVs2 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llLinkDescriptorsSubTLVs3 = new LinkedList<PcepValueType>();

+    private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv1 = new

+            LinkLocalRemoteIdentifiersTlv(10, 10);

+    private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressTlv(0x01010101);

 

-    boolean b = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1);

-    boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv1);

-    boolean d = llLinkDescriptorsSubTLVs3.add(iPv4InterfaceAddressTlv1);

+    private final LinkLocalRemoteIdentifiersTlv linkLocalRemoteIdentifiersTlv2 = new

+            LinkLocalRemoteIdentifiersTlv(20, 20);

+    private final IPv4InterfaceAddressTlv iPv4InterfaceAddressTlv2 = new IPv4InterfaceAddressTlv(0x02020202);

 

-    final TELinkDescriptorsTLV tlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1);

-    final TELinkDescriptorsTLV tlv2 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs2);

-    final TELinkDescriptorsTLV tlv3 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs3);

+    private final LinkedList<PcepValueType> llLinkDescriptorsSubTLVs1 = new LinkedList<PcepValueType>();

+    private final boolean a = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1);

+    private final boolean b = llLinkDescriptorsSubTLVs1.add(iPv4InterfaceAddressTlv1);

+

+    private final LinkedList<PcepValueType> llLinkDescriptorsSubTLVs2 = new LinkedList<PcepValueType>();

+    private final boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv2);

+    private final boolean d = llLinkDescriptorsSubTLVs2.add(iPv4InterfaceAddressTlv2);

+

+    private final TELinkDescriptorsTLV tlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1);

+    private final TELinkDescriptorsTLV sameAstlv1 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs1);

+    private final TELinkDescriptorsTLV tlv2 = TELinkDescriptorsTLV.of(llLinkDescriptorsSubTLVs2);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals();

     }

 

 }

diff --git a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java
index a4e7fee..bf27a1c 100644
--- a/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java
+++ b/pcep/pcepio/src/test/java/org/onosproject/pcepio/TENodeAttributesTlvTest.java
@@ -30,24 +30,30 @@
  */

 public class TENodeAttributesTlvTest {

 

-    NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10);

-    IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new IPv4TERouterIdOfLocalNodeTlv((int) 0x01010101);;

-    LinkedList<PcepValueType> llNodeAttributesSubTLVs1 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llNodeAttributesSubTLVs2 = new LinkedList<PcepValueType>();

-    LinkedList<PcepValueType> llNodeAttributesSubTLVs3 = new LinkedList<PcepValueType>();

+    private final NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10);

+    private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new

+            IPv4TERouterIdOfLocalNodeTlv(0x01010101);

 

-    boolean b = llNodeAttributesSubTLVs1.add(nodeFlagBitsTlv1);

+    private final NodeFlagBitsTlv nodeFlagBitsTlv2 = new NodeFlagBitsTlv((byte) 20);

+    private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv2 = new

+            IPv4TERouterIdOfLocalNodeTlv(0x02020202);

 

-    boolean c = llNodeAttributesSubTLVs2.add(nodeFlagBitsTlv1);

-    boolean d = llNodeAttributesSubTLVs3.add(iPv4TERouterIdOfLocalNodeTlv1);

+    private final LinkedList<PcepValueType> llNodeAttributesSubTLV1 = new LinkedList<PcepValueType>();

+    private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1);

+    private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1);

 

-    final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs1);

-    final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs2);

-    final TENodeAttributesTlv tlv3 = TENodeAttributesTlv.of(llNodeAttributesSubTLVs3);

+    private final LinkedList<PcepValueType> llNodeAttributesSubTLV2 = new LinkedList<PcepValueType>();

+

+    private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2);

+    private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2);

+

+    private final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);

+    private final TENodeAttributesTlv sameAsTlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);

+    private final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLV2);

 

     @Test

     public void basics() {

-        new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();

+        new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();

     }

 

 }