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.GetFeaturesOutput;
\r
9 import org.openflow.deserialization.factories.FeaturesReplyMessageFactory;
\r
10 import org.openflow.lib.util.BufferHelper;
\r
13 * @author michal.polkorab
\r
16 public class FeaturesReplyMessageFactoryTest {
\r
19 * Testing {@link FeaturesReplyMessageFactory} for correct translation into POJO
\r
22 public void test() {
\r
23 byte[] data = new byte[]{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
\r
24 0x00, 0x01, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00,
\r
25 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03 };
\r
26 ByteBuf bb = BufferHelper.buildBuffer(data);
\r
27 GetFeaturesOutput builtByFactory = FeaturesReplyMessageFactory.getInstance().bufferToMessage(bb, HelloMessageFactoryTest.VERSION_YET_SUPPORTED);
\r
29 Assert.assertTrue(builtByFactory.getVersion() == HelloMessageFactoryTest.VERSION_YET_SUPPORTED);
\r
30 Assert.assertEquals(builtByFactory.getXid().longValue(), 16909060L);
\r
31 Assert.assertTrue(builtByFactory.getTables() == 1);
\r
32 Assert.assertTrue(builtByFactory.getAuxiliaryId() == 1);
\r
33 Assert.assertEquals(66051L, builtByFactory.getBuffers().longValue());
\r
34 Assert.assertEquals(66051L, builtByFactory.getCapabilities().longValue());
\r
35 Assert.assertEquals(66051L, builtByFactory.getReserved().longValue());
\r
36 Assert.assertTrue(builtByFactory.getDatapathId().longValue() == 283686952306183L);
\r