1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
\r
2 package org.opendaylight.openflowjava.protocol.impl.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.openflowjava.protocol.impl.deserialization.factories.ExperimenterMessageFactory;
\r
9 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
\r
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessage;
\r
13 * @author michal.polkorab
\r
16 public class ExperimenterMessageFactoryTest {
\r
19 * Testing {@link ExperimenterMessageFactory} for correct translation into POJO
\r
22 public void test() {
\r
23 byte[] data = new byte[]{0x01, 0x02, 0x03, 0x04, 0x01, 0x02, 0x03, 0x04};
\r
24 ByteBuf bb = BufferHelper.buildBuffer(data);
\r
25 ExperimenterMessage builtByFactory = ExperimenterMessageFactory.getInstance().bufferToMessage(bb, HelloMessageFactoryTest.VERSION_YET_SUPPORTED);
\r
27 Assert.assertTrue(builtByFactory.getVersion() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED);
\r
28 Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);
\r
29 Assert.assertEquals(builtByFactory.getExperimenter().longValue(), 16909060L);
\r
30 Assert.assertEquals(builtByFactory.getExpType().longValue(), 16909060L);
\r