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.serialization.factories;
11 import io.netty.buffer.ByteBuf;
12 import io.netty.buffer.UnpooledByteBufAllocator;
14 import org.junit.Test;
15 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
16 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesInputBuilder;
21 * @author michal.polkorab
24 public class GetFeaturesInputMessageFactoryTest {
26 private static final byte FEATURES_REQUEST_MESSAGE_CODE_TYPE = GetFeaturesInputMessageFactory.MESSAGE_TYPE;
29 * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
33 public void testV13() throws Exception {
34 GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
35 BufferHelper.setupHeader(gfib, EncodeConstants.OF13_VERSION_ID);
36 GetFeaturesInput gfi = gfib.build();
38 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
39 GetFeaturesInputMessageFactory gfimf = GetFeaturesInputMessageFactory.getInstance();
40 gfimf.messageToBuffer(EncodeConstants.OF13_VERSION_ID, out, gfi);
42 BufferHelper.checkHeaderV13(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);
46 * Testing of {@link GetFeaturesInputMessageFactory} for correct translation from POJO
50 public void testV10() throws Exception {
51 GetFeaturesInputBuilder gfib = new GetFeaturesInputBuilder();
52 BufferHelper.setupHeader(gfib, EncodeConstants.OF10_VERSION_ID);
53 GetFeaturesInput gfi = gfib.build();
55 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
56 GetFeaturesInputMessageFactory gfimf = GetFeaturesInputMessageFactory.getInstance();
57 gfimf.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, gfi);
59 BufferHelper.checkHeaderV10(out, FEATURES_REQUEST_MESSAGE_CODE_TYPE, 8);