1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.openflow.lib.deserialization.factories;
\r
4 import io.netty.buffer.ByteBuf;
\r
6 import org.junit.Assert;
\r
7 import org.junit.Test;
\r
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
\r
9 import org.openflow.deserialization.factories.HelloMessageFactory;
\r
10 import org.openflow.lib.util.BufferHelper;
\r
13 * @author michal.polkorab
\r
16 public class HelloMessageFactoryTest {
\r
18 /** Number of currently supported version / codec */
\r
19 public static final short VERSION_YET_SUPPORTED = 0x04;
\r
20 /** Index of Xid in OpenFlow 1.3 header */
\r
21 public static final byte INDEX_OF_XID_IN_HEADER = 4;
\r
24 * Testing {@link HelloMessageFactory} for correct translation into POJO
\r
27 public void test() {
\r
28 ByteBuf bb = BufferHelper.buildBuffer(new byte[0]);
\r
29 HelloMessage builtByFactory = HelloMessageFactory.getInstance().bufferToMessage(bb, VERSION_YET_SUPPORTED);
\r
31 Assert.assertTrue(builtByFactory.getVersion() == VERSION_YET_SUPPORTED);
\r
32 Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);
\r