Renamed packages to org.opendaylight.openflowjava.protocol.impl.*
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / ExperimenterMessageFactoryTest.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;\r
3 \r
4 import io.netty.buffer.ByteBuf;\r
5 \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
11 \r
12 /**\r
13  * @author michal.polkorab\r
14  *\r
15  */\r
16 public class ExperimenterMessageFactoryTest {\r
17 \r
18     /**\r
19      * Testing {@link ExperimenterMessageFactory} for correct translation into POJO\r
20      */\r
21     @Test\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
26 \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
31     }\r
32 \r
33 }\r