Copyright update
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / GetaAsyncRequestMessageFactoryTest.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
10
11 import io.netty.buffer.ByteBuf;
12 import io.netty.buffer.UnpooledByteBufAllocator;
13
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;
20
21 /**
22  * @author timotej.kubas
23  * @author michal.polkorab
24  */
25 public class GetaAsyncRequestMessageFactoryTest {
26     private static final byte MESSAGE_TYPE = 26;
27     private static final int MESSAGE_LENGTH = 8;
28     
29     /**
30      * Testing of {@link GetAsyncRequestMessageFactory} for correct translation from POJO
31      * @throws Exception 
32      */
33     @Test
34     public void testGetAsyncReques() throws Exception {
35         GetAsyncInputBuilder builder = new GetAsyncInputBuilder();
36         BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
37         GetAsyncInput message = builder.build();
38         
39         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
40         GetAsyncRequestMessageFactory factory = GetAsyncRequestMessageFactory.getInstance();
41         factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);
42         
43         BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);
44     }
45 }