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.util.BufferHelper;
\r
9 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
\r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInputBuilder;
\r
14 * @author michal.polkorab
\r
17 public class GetFeaturesInputMessageFactoryTest {
\r
19 private static final byte FEATURES_REQUEST_MESSAGE_CODE_TYPE = GetFeaturesInputMessageFactory.MESSAGE_TYPE;
\r
22 * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
\r
23 * @throws Exception
\r
26 public void testV13() throws Exception {
\r
27 GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
\r
28 BufferHelper.setupHeader(gfib, EncodeConstants.OF13_VERSION_ID);
\r
29 GetFeaturesInput gfi = gfib.build();
\r
31 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
\r
32 GetFeaturesInputMessageFactory gfimf = GetFeaturesInputMessageFactory.getInstance();
\r
33 gfimf.messageToBuffer(EncodeConstants.OF13_VERSION_ID, out, gfi);
\r
35 BufferHelper.checkHeaderV13(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);
\r
39 * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
\r
40 * @throws Exception
\r
43 public void testV10() throws Exception {
\r
44 GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
\r
45 BufferHelper.setupHeader(gfib, EncodeConstants.OF10_VERSION_ID);
\r
46 GetFeaturesInput gfi = gfib.build();
\r
48 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
\r
49 GetFeaturesInputMessageFactory gfimf = GetFeaturesInputMessageFactory.getInstance();
\r
50 gfimf.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, gfi);
\r
52 BufferHelper.checkHeaderV10(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);
\r