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%2FBarrierInputMessageFactoryTest.java;h=37b6d6761f90cd14aba443946310e4d433c5cbc7;hb=221d25d81c123970bcc912f0a6329a9aa45fb5f7;hp=b65beb215627983103599f75f7a95a854d8d3e5b;hpb=afc334c31f95ca7b3851b7345f00e64888a984f1;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/BarrierInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/BarrierInputMessageFactoryTest.java index b65beb21..37b6d676 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/BarrierInputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/BarrierInputMessageFactoryTest.java @@ -4,10 +4,9 @@ package org.opendaylight.openflowjava.protocol.impl.serialization.factories; import io.netty.buffer.ByteBuf; import io.netty.buffer.UnpooledByteBufAllocator; -import org.junit.Assert; import org.junit.Test; -import org.opendaylight.openflowjava.protocol.impl.core.OFFrameDecoder; import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest; +import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder; @@ -21,22 +20,19 @@ public class BarrierInputMessageFactoryTest { /** * Testing of {@link BarrierInputMessageFactory} for correct translation from POJO + * @throws Exception */ @Test - public void test() { + public void test() throws Exception { BarrierInputBuilder bib = new BarrierInputBuilder(); - bib.setVersion(HelloMessageFactoryTest.VERSION_YET_SUPPORTED); - bib.setXid(16909060L); + BufferHelper.setupHeader(bib); BarrierInput bi = bib.build(); ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); BarrierInputMessageFactory bimf = BarrierInputMessageFactory.getInstance(); bimf.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, bi); - Assert.assertTrue(out.readByte() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED); - Assert.assertTrue(out.readByte() == BARRIER_REQUEST_MESSAGE_CODE_TYPE); - Assert.assertTrue(out.readUnsignedShort() == OFFrameDecoder.LENGTH_OF_HEADER); - Assert.assertTrue(out.readUnsignedInt() == 16909060L); + BufferHelper.checkHeaderV13(out, BARRIER_REQUEST_MESSAGE_CODE_TYPE, 8); } }