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
6 import junit.framework.Assert;
\r
8 import org.junit.Test;
\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.common.types.rev130731.PortNumber;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder;
\r
16 * @author michal.polkorab
\r
19 public class OF10QueueGetConfigInputMessageFactoryTest {
\r
22 * Testing of {@link OF10QueueGetConfigInputMessageFactory} for correct translation from POJO
\r
23 * @throws Exception
\r
26 public void test() throws Exception {
\r
27 GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
\r
28 BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
\r
29 builder.setPort(new PortNumber(6653L));
\r
30 GetQueueConfigInput message = builder.build();
\r
32 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
\r
33 OF10QueueGetConfigInputMessageFactory factory = OF10QueueGetConfigInputMessageFactory.getInstance();
\r
34 factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, message);
\r
36 BufferHelper.checkHeaderV10(out, (byte) 20, 12);
\r
37 Assert.assertEquals("Wrong port", 6653L, out.readUnsignedShort());
\r