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.deserialization.factories.HelloMessageFactoryTest;
16 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
17 import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncInputBuilder;
22 * @author timotej.kubas
23 * @author michal.polkorab
25 public class GetaAsyncRequestMessageFactoryTest {
26 private static final byte MESSAGE_TYPE = 26;
27 private static final int MESSAGE_LENGTH = 8;
30 * Testing of {@link GetAsyncRequestMessageFactory} for correct translation from POJO
34 public void testGetAsyncReques() throws Exception {
35 GetAsyncInputBuilder builder = new GetAsyncInputBuilder();
36 BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
37 GetAsyncInput message = builder.build();
39 ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
40 GetAsyncRequestMessageFactory factory = GetAsyncRequestMessageFactory.getInstance();
41 factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);
43 BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);