941f6c965c2ba46625a423f7fbb7816877165b35
[controller.git] / third-party / openflowj / src / test / java / org / openflow / protocol / OFGetConfigReplyTest.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.openflow.protocol;
11
12 import java.nio.ByteBuffer;
13
14 import junit.framework.TestCase;
15
16 import org.openflow.util.OFTestCase;
17
18 public class OFGetConfigReplyTest extends OFTestCase {
19     public void testWriteRead() throws Exception {
20         OFSetConfig msg = (OFSetConfig) messageFactory
21                 .getMessage(OFType.SET_CONFIG);
22         msg.setFlags((short) 1);
23         ByteBuffer bb = ByteBuffer.allocate(1024);
24         bb.clear();
25         msg.writeTo(bb);
26         bb.flip();
27         msg.readFrom(bb);
28         TestCase.assertEquals(OFType.SET_CONFIG, msg.getType());
29         TestCase.assertEquals((short)1, msg.getFlags());
30     }
31 }