1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
4 import static org.junit.Assert.*;
5 import junit.framework.Assert;
6 import io.netty.buffer.ByteBuf;
7 import io.netty.buffer.UnpooledByteBufAllocator;
10 import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;
11 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInput;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder;
17 * @author timotej.kubas
18 * @author michal.polkorab
20 public class GetQueueConfigInputMessageFactoryTest {
22 private static final byte GET_QUEUE_CONFIG_INPUT_MESSAGE_CODE_TYPE = 22;
23 private static final byte PADDING_IN_QUEUE_CONFIG_INPUT_MESSAGE = 4;
26 public void testWithElements() throws Exception {
27 GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
28 BufferHelper.setupHeader(builder);
29 builder.setPort(new PortNumber(0x00010203L));
30 GetQueueConfigInput message = builder.build();
32 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
33 GetQueueConfigInputMessageFactory factory = GetQueueConfigInputMessageFactory.getInstance();
34 factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);
36 BufferHelper.checkHeaderV13(out, GET_QUEUE_CONFIG_INPUT_MESSAGE_CODE_TYPE, 16);
37 Assert.assertEquals("Wrong port", 0x00010203, out.readUnsignedInt());
38 out.skipBytes(PADDING_IN_QUEUE_CONFIG_INPUT_MESSAGE);