1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
5 import io.netty.buffer.UnpooledByteBufAllocator;
\r
7 import org.junit.Test;
\r
8 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;
\r
9 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
10 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
\r
15 * @author michal.polkorab
\r
18 public class BarrierInputMessageFactoryTest {
\r
20 private static final byte BARRIER_REQUEST_MESSAGE_CODE_TYPE = BarrierInputMessageFactory.MESSAGE_TYPE;
\r
23 * Testing of {@link BarrierInputMessageFactory} for correct translation from POJO
\r
24 * @throws Exception
\r
27 public void test() throws Exception {
\r
28 BarrierInputBuilder bib = new BarrierInputBuilder();
\r
29 BufferHelper.setupHeader(bib, EncodeConstants.OF13_VERSION_ID);
\r
30 BarrierInput bi = bib.build();
\r
32 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
\r
33 BarrierInputMessageFactory bimf = BarrierInputMessageFactory.getInstance();
\r
34 bimf.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, bi);
\r
36 BufferHelper.checkHeaderV13(out, BARRIER_REQUEST_MESSAGE_CODE_TYPE, 8);
\r