Phaneendra Manda
Committed by Gerrit Code Review

Pcep TLVs UT updated for common review comments

Change-Id: Icf51f79e9cadd1ce4bdd5b2b67a1ad1095cc8ab8
Showing 24 changed files with 63 additions and 55 deletions
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
......@@ -155,9 +155,9 @@ public class MPLSProtocolMaskTlv implements PcepValueType {
if (obj instanceof MPLSProtocolMaskTlv) {
MPLSProtocolMaskTlv other = (MPLSProtocolMaskTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.bLFlag, other.bLFlag) && Objects.equals(this.bRFlag, other.bRFlag);
} else {
return Objects.equals(this.rawValue, other.rawValue);
} else {
return Objects.equals(this.bLFlag, other.bLFlag) && Objects.equals(this.bRFlag, other.bRFlag);
}
}
return false;
......
......@@ -174,10 +174,10 @@ public class NodeFlagBitsTlv implements PcepValueType {
if (obj instanceof NodeFlagBitsTlv) {
NodeFlagBitsTlv other = (NodeFlagBitsTlv) obj;
if (isRawValueSet) {
return Objects.equals(this.rawValue, other.rawValue);
} else {
return Objects.equals(this.bOFlag, other.bOFlag) && Objects.equals(this.bTFlag, other.bTFlag)
&& Objects.equals(this.bEFlag, other.bEFlag) && Objects.equals(this.bBFlag, other.bBFlag);
} else {
return Objects.equals(this.rawValue, other.rawValue);
}
}
return false;
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......
/*
* 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.
......@@ -15,13 +15,13 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.LinkNameTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the LinkNameTlv.
* Equality test for LinkNameTlv.
*/
public class LinkNameTlvTest {
private final byte[] rawValue1 = new byte[] {0x01, 0x00};
......@@ -30,13 +30,12 @@ public class LinkNameTlvTest {
private final LinkNameTlv tlv1 = new LinkNameTlv(rawValue1, (short) rawValue1.length);
private final LinkNameTlv sameAsTlv1 = LinkNameTlv.of(tlv1.getValue(), tlv1.getLength());
private final LinkNameTlv tlv2 = new LinkNameTlv(rawValue2, (short) 0);
private final LinkNameTlv sameAsTlv2 = new LinkNameTlv(rawValue2, (short) rawValue2.length);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2, sameAsTlv2)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/* * Copyright 2014 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.onosproject.pcepio; import com.google.common.testing.EqualsTester; import org.junit.Test;import org.onosproject.pcepio.types.LinkProtectionTypeTlv; /** * Test of the LinkProtectionTypeTlv. */public class LinkProtectionTypeTlvTest { private final byte rawValue1 = 0x0A; private final byte rawValue2 = 0x0A; private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); @Test public void basics() { new EqualsTester() .addEqualityGroup(tlv1, tlv2) .testEquals(); }}
\ No newline at end of file
/* * 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.onosproject.pcepio; import org.junit.Test;import org.onosproject.pcepio.types.LinkProtectionTypeTlv; import com.google.common.testing.EqualsTester; /** * Test of the LinkProtectionTypeTlv. */public class LinkProtectionTypeTlvTest { private final byte rawValue1 = 0x0A; private final byte rawValue2 = 0x0B; private final LinkProtectionTypeTlv tlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv sameAsTlv1 = new LinkProtectionTypeTlv(rawValue1); private final LinkProtectionTypeTlv tlv2 = new LinkProtectionTypeTlv(rawValue2, (byte) 0); @Test public void basics() { new EqualsTester() .addEqualityGroup(tlv1, sameAsTlv1) .addEqualityGroup(tlv2) .testEquals(); }}
\ No newline at end of file
......
/*
* 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.
......@@ -15,25 +15,27 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.MPLSProtocolMaskTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the MPLSProtocolMaskTlv.
*/
public class MPLSProtocolMaskTlvTest {
private final byte rawValue1 = 0x0A;
private final byte rawValue2 = 0x0A;
private final byte rawValue2 = 0x0B;
private final MPLSProtocolMaskTlv tlv1 = new MPLSProtocolMaskTlv(rawValue1);
private final MPLSProtocolMaskTlv sameAsTlv1 = new MPLSProtocolMaskTlv(rawValue1);
private final MPLSProtocolMaskTlv tlv2 = MPLSProtocolMaskTlv.of(rawValue2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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,15 +25,17 @@ import com.google.common.testing.EqualsTester;
*/
public class MaximumLinkBandwidthTlvTest {
private final int rawValue1 = 0x0A;
private final int rawValue2 = 0x0A;
private final int rawValue2 = 0x0B;
private final MaximumLinkBandwidthTlv tlv1 = new MaximumLinkBandwidthTlv(rawValue1);
private final MaximumLinkBandwidthTlv sameAsTlv1 = new MaximumLinkBandwidthTlv(rawValue1);
private final MaximumLinkBandwidthTlv tlv2 = MaximumLinkBandwidthTlv.of(rawValue2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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,15 +25,17 @@ import com.google.common.testing.EqualsTester;
*/
public class MaximumReservableLinkBandwidthTlvTest {
private final int rawValue1 = 0x0A;
private final int rawValue2 = 0x0A;
private final int rawValue2 = 0x0B;
private final MaximumReservableLinkBandwidthTlv tlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1);
private final MaximumReservableLinkBandwidthTlv sameAsTlv1 = new MaximumReservableLinkBandwidthTlv(rawValue1);
private final MaximumReservableLinkBandwidthTlv tlv2 = MaximumReservableLinkBandwidthTlv.of(rawValue2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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.
......@@ -15,24 +15,27 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.NodeFlagBitsTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the NodeFlagBitsTlv.
*/
public class NodeFlagBitsTlvTest {
private final byte rawValue1 = 0x0A;
private final byte rawValue2 = 0x0B;
private final NodeFlagBitsTlv tlv1 = new NodeFlagBitsTlv(rawValue1);
private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(tlv1.getbyte());
private final NodeFlagBitsTlv sameAsTlv1 = new NodeFlagBitsTlv(rawValue1);
private final NodeFlagBitsTlv tlv2 = NodeFlagBitsTlv.of(rawValue2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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.
......@@ -15,11 +15,11 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.NodeNameTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the NodeNameTlv.
*/
......@@ -30,13 +30,12 @@ public class NodeNameTlvTest {
private final NodeNameTlv tlv1 = new NodeNameTlv(rawValue1, (short) rawValue1.length);
private final NodeNameTlv sameAsTlv1 = NodeNameTlv.of(tlv1.getValue(), tlv1.getLength());
private final NodeNameTlv tlv2 = new NodeNameTlv(rawValue2, (short) 0);
private final NodeNameTlv sameAsTlv2 = new NodeNameTlv(rawValue2, (short) rawValue2.length);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2, sameAsTlv2)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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.
......
/*
* 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.
......@@ -15,11 +15,11 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.OpaqueLinkAttributeTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the OpaqueLinkAttributeTlv.
*/
......@@ -30,13 +30,12 @@ public class OpaqueLinkAttributeTlvTest {
private final OpaqueLinkAttributeTlv tlv1 = new OpaqueLinkAttributeTlv(rawValue1, (short) rawValue1.length);
private final OpaqueLinkAttributeTlv sameAsTlv1 = OpaqueLinkAttributeTlv.of(tlv1.getValue(), tlv1.getLength());
private final OpaqueLinkAttributeTlv tlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) 0);
private final OpaqueLinkAttributeTlv sameAsTlv2 = new OpaqueLinkAttributeTlv(rawValue2, (short) rawValue2.length);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2, sameAsTlv2)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......
/*
* 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.
......@@ -15,25 +15,27 @@
*/
package org.onosproject.pcepio;
import com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.PceccCapabilityTlv;
import com.google.common.testing.EqualsTester;
/**
* Test of the PceccCapabilityTlv.
*/
public class PceccCapabilityTlvTest {
private final int rawValue1 = 0x0A;
private final int rawValue2 = 0x0A;
private final int rawValue2 = 0x0B;
private final PceccCapabilityTlv tlv1 = new PceccCapabilityTlv(rawValue1);
private final PceccCapabilityTlv sameAsTlv1 = new PceccCapabilityTlv(rawValue1);
private final PceccCapabilityTlv tlv2 = PceccCapabilityTlv.of(rawValue2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......