X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fserialization%2Ffactories%2FHelloInputMessageFactoryTest.java;h=e2ea0f86b39a323502d223b42312ed61835d2fe2;hb=07de1ed897da9d7dc70c6d550f38c59339ed751e;hp=3a299a634ca9ce7afae863282bb79be3185f6e34;hpb=1adc52b6fedfc7ecdb03cb6cab5ae7da3bfb52e4;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java index 3a299a63..e2ea0f86 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java @@ -22,8 +22,8 @@ import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer; import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry; import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl; import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants; +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.HelloElementType; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder; @@ -55,23 +55,23 @@ public class HelloInputMessageFactoryTest { /** * Testing of {@link HelloInputMessageFactory} for correct translation from POJO - * @throws Exception + * @throws Exception */ @Test public void testWithoutElementsSet() throws Exception { HelloInputBuilder hib = new HelloInputBuilder(); BufferHelper.setupHeader(hib, EncodeConstants.OF13_VERSION_ID); HelloInput hi = hib.build(); - + ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); helloFactory.serialize(hi, out); - + BufferHelper.checkHeaderV13(out,(byte) 0, EncodeConstants.OFHEADER_SIZE); } - + /** * Testing of {@link HelloInputMessageFactory} for correct translation from POJO - * @throws Exception + * @throws Exception */ @Test public void testWith4BitVersionBitmap() throws Exception { @@ -81,21 +81,21 @@ public class HelloInputMessageFactoryTest { List expectedElement = createElement(lengthOfBitmap); builder.setElements(expectedElement); HelloInput message = builder.build(); - + ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); helloFactory.serialize(message, out); LOGGER.debug("bytebuf: " + ByteBufUtils.byteBufToHexString(out)); - + BufferHelper.checkHeaderV13(out, (byte) 0, 16); Elements element = readElement(out).get(0); Assert.assertEquals("Wrong element type", expectedElement.get(0).getType(), element.getType()); Elements comparation = createComparationElement(lengthOfBitmap).get(0); Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(), element.getVersionBitmap().toArray()); } - + /** * Testing of {@link HelloInputMessageFactory} for correct translation from POJO - * @throws Exception + * @throws Exception */ @Test public void testWith64BitVersionBitmap() throws Exception { @@ -105,18 +105,18 @@ public class HelloInputMessageFactoryTest { List expectedElement = createElement(lengthOfBitmap); builder.setElements(expectedElement); HelloInput message = builder.build(); - + ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); helloFactory.serialize(message, out); LOGGER.debug("bytebuf: " + ByteBufUtils.byteBufToHexString(out)); - + BufferHelper.checkHeaderV13(out, (byte) 0, 24); Elements element = readElement(out).get(0); Assert.assertEquals("Wrong element type", expectedElement.get(0).getType(), element.getType()); Elements comparation = createComparationElement(lengthOfBitmap).get(0); Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(), element.getVersionBitmap().toArray()); } - + private static List createElement(int lengthOfBitmap) { ElementsBuilder elementsBuilder = new ElementsBuilder(); List elementsList = new ArrayList<>(); @@ -129,7 +129,7 @@ public class HelloInputMessageFactoryTest { elementsList.add(elementsBuilder.build()); return elementsList; } - + private static List createComparationElement(int lengthOfBitmap) { ElementsBuilder elementsBuilder = new ElementsBuilder(); List elementsList = new ArrayList<>(); @@ -148,7 +148,7 @@ public class HelloInputMessageFactoryTest { elementsList.add(elementsBuilder.build()); return elementsList; } - + private static List readElement(ByteBuf input) { List elementsList = new ArrayList<>(); while (input.readableBytes() > 0) { @@ -171,7 +171,7 @@ public class HelloInputMessageFactoryTest { } return elementsList; } - + private static List readVersionBitmap(int[] input){ List versionBitmapList = new ArrayList<>(); for (int i = 0; i < input.length; i++) {