Ray Milkey
Committed by Gerrit Code Review

Move unit tests to a directory structure that follows the classes under test

Change-Id: Ibfa840e4aab4100125b4ead0f864f5ad1bea18b6
Showing 27 changed files with 101 additions and 177 deletions
/*
* Copyright 2014-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.bgp;
import org.junit.Test;
import org.onosproject.bgpio.types.IsIsNonPseudonode;
import com.google.common.testing.EqualsTester;
/**
* Test for IsIsNonPseudonode Tlv.
*/
public class IsIsNonPseudonodeTest {
private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59};
private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1);
private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1);
private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
/*
* Copyright 2014-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.bgp;
import org.junit.Test;
import org.onosproject.bgpio.types.OSPFNonPseudonode;
import com.google.common.testing.EqualsTester;
/**
* Test for OSPFNonPseudonode Tlv.
*/
public class OspfNonPseudonodeTest {
private final int value1 = 0x12121212;
private final int value2 = 0x12121211;
private final OSPFNonPseudonode tlv1 = OSPFNonPseudonode.of(value1);
private final OSPFNonPseudonode sameAsTlv1 = OSPFNonPseudonode.of(value1);
private final OSPFNonPseudonode tlv2 = OSPFNonPseudonode.of(value2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
......@@ -13,22 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPFactories;
import org.onosproject.bgpio.protocol.BGPKeepaliveMsg;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.types.BGPHeader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
/**
* Test case for BGP KEEPALIVE Message.
*/
......
......@@ -13,22 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPFactories;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPOpenMsg;
import org.onosproject.bgpio.types.BGPHeader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
/**
* Test cases for BGP Open Message.
*/
......
......@@ -13,22 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
package org.onosproject.bgpio.protocol;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.onosproject.bgpio.exceptions.BGPParseException;
import org.onosproject.bgpio.protocol.BGPFactories;
import org.onosproject.bgpio.protocol.BGPMessage;
import org.onosproject.bgpio.protocol.BGPMessageReader;
import org.onosproject.bgpio.protocol.BGPNotificationMsg;
import org.onosproject.bgpio.types.BGPHeader;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.core.Is.is;
/**
* Test for Notification message.
*/
......@@ -225,4 +221,4 @@ public class BgpNotificationMsgTest {
buf.readBytes(testNotificationMsg, 0, iReadLen);
assertThat(testNotificationMsg, is(notificationMsg));
}
}
\ No newline at end of file
}
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
import com.google.common.testing.EqualsTester;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.AreaIDTlv;
import com.google.common.testing.EqualsTester;
/**
* Test for AreaID Tlv.
......@@ -37,4 +36,42 @@ public class AreaIdTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
/**
* Test for OSPFNonPseudonode Tlv.
*/
public static class OspfNonPseudonodeTest {
private final int value1 = 0x12121212;
private final int value2 = 0x12121211;
private final OSPFNonPseudonode tlv1 = OSPFNonPseudonode.of(value1);
private final OSPFNonPseudonode sameAsTlv1 = OSPFNonPseudonode.of(value1);
private final OSPFNonPseudonode tlv2 = OSPFNonPseudonode.of(value2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
/**
* Test for IsIsNonPseudonode Tlv.
*/
public static class IsIsNonPseudonodeTest {
private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59};
private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1);
private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1);
private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, sameAsTlv1)
.addEqualityGroup(tlv2)
.testEquals();
}
}
}
......
......@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.onosproject.bgpio.types.As4Path;
import com.google.common.testing.EqualsTester;
......@@ -53,4 +52,4 @@ public class As4PathTest {
.addEqualityGroup(attr4)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.onosproject.bgpio.types.AsPath;
import com.google.common.testing.EqualsTester;
......@@ -53,4 +52,4 @@ public class AsPathTest {
.addEqualityGroup(attr4)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
import com.google.common.testing.EqualsTester;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.AutonomousSystemTlv;
import com.google.common.testing.EqualsTester;
/**
* Test for AutonomousSystem Tlv.
......@@ -37,4 +36,4 @@ public class AutonomousSystemTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.BGPLSIdentifierTlv;
import com.google.common.testing.EqualsTester;
......@@ -37,4 +36,4 @@ public class BGPLSIdentifierTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
import com.google.common.testing.EqualsTester;
......@@ -38,4 +37,4 @@ public class IPReachabilityInformationTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.types.IPv4AddressTlv;
import com.google.common.testing.EqualsTester;
......@@ -38,4 +37,4 @@ public class IPv4AddressTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.types.IPv6AddressTlv;
import com.google.common.testing.EqualsTester;
......@@ -38,4 +37,4 @@ public class IPv6AddressTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.IsIsPseudonode;
import com.google.common.testing.EqualsTester;
......@@ -37,4 +36,4 @@ public class IsIsPseudonodeTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.LinkLocalRemoteIdentifiersTlv;
import com.google.common.testing.EqualsTester;
......@@ -37,4 +36,4 @@ public class LinkLocalRemoteIdentifiersTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.types.NextHop;
import com.google.common.testing.EqualsTester;
......@@ -38,4 +37,4 @@ public class NextHopTest {
.addEqualityGroup(attr2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.Origin;
import com.google.common.testing.EqualsTester;
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onosproject.bgpio.types.OSPFPseudonode;
import com.google.common.testing.EqualsTester;
......@@ -40,4 +39,4 @@ public class OspfPseudonodeTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onosproject.bgpio.types.OSPFRouteTypeTlv;
import com.google.common.testing.EqualsTester;
......@@ -37,4 +36,4 @@ public class OspfRouteTypeTest {
.addEqualityGroup(tlv2)
.testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpAttrNodeFlagBitTlv;
import com.google.common.testing.EqualsTester;
......@@ -48,4 +47,4 @@ public class BgpAttrNodeFlagBitTlvTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.types.attr.BgpAttrRouterIdV6;
import com.google.common.testing.EqualsTester;
......@@ -47,4 +46,4 @@ public class BgpAttrRouterIdV6Test {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpLinkAttrIgpMetric;
import com.google.common.testing.EqualsTester;
......@@ -41,4 +40,4 @@ public class BgpLinkAttrIgpMetricTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpLinkAttrMplsProtocolMask;
import com.google.common.testing.EqualsTester;
......@@ -40,4 +39,4 @@ public class BgpLinkAttrMplsProtocolMaskTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpLinkAttrProtectionType;
import com.google.common.testing.EqualsTester;
......@@ -54,4 +53,4 @@ public class BgpLinkAttrProtectionTypeTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpPrefixAttrIgpFlags;
import com.google.common.testing.EqualsTester;
......@@ -51,4 +50,4 @@ public class BgpPrefixAttrIgpFlagsTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onosproject.bgpio.types.attr.BgpPrefixAttrMetric;
import com.google.common.testing.EqualsTester;
......@@ -37,4 +36,4 @@ public class BgpPrefixAttrMetricTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......
......@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.bgp;
package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
import org.onosproject.bgpio.types.attr.BgpPrefixAttrOspfFwdAddr;
import com.google.common.testing.EqualsTester;
......@@ -49,4 +48,4 @@ public class BgpPrefixAttrOspfFwdAddrTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
}
\ No newline at end of file
}
......