2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
11 import io.netty.buffer.ByteBuf;
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage;
19 * @author michal.polkorab
21 public class OF10HelloMessageFactoryTest {
24 * Testing {@link OF10HelloMessageFactory} for correct translation into POJO
27 public void testWithoutElements() {
28 ByteBuf bb = BufferHelper.buildBuffer();
29 HelloMessage builtByFactory = BufferHelper.decodeV10(
30 OF10HelloMessageFactory.getInstance(), bb);
32 BufferHelper.checkHeaderV10(builtByFactory);
33 Assert.assertNull("Wrong elements", builtByFactory.getElements());
37 * Testing {@link OF10HelloMessageFactory} for correct translation into POJO
40 public void testWithElements() {
41 ByteBuf bb = BufferHelper.buildBuffer("00 01 " // type
43 + "00 00 00 11 " // bitmap 1
44 + "00 00 00 00 " // bitmap 2
45 + "00 00 00 00" // padding
47 HelloMessage builtByFactory = BufferHelper.decodeV10(
48 OF10HelloMessageFactory.getInstance(), bb);
50 BufferHelper.checkHeaderV10(builtByFactory);
51 Assert.assertNull("Wrong elements", builtByFactory.getElements());