本文整理汇总了Java中org.openflow.protocol.queue.OFQueuePropertyMinRate类的典型用法代码示例。如果您正苦于以下问题:Java OFQueuePropertyMinRate类的具体用法?Java OFQueuePropertyMinRate怎么用?Java OFQueuePropertyMinRate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFQueuePropertyMinRate类属于org.openflow.protocol.queue包,在下文中一共展示了OFQueuePropertyMinRate类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReply
import org.openflow.protocol.queue.OFQueuePropertyMinRate; //导入依赖的package包/类
public void testReply() throws Exception {
OFQueueConfigReply reply = new OFQueueConfigReply();
reply.setPort((short) 5);
OFPacketQueue queue = new OFPacketQueue();
queue.setQueueId(1);
List<OFQueueProperty> properties = new ArrayList<OFQueueProperty>();
properties.add(new OFQueuePropertyMinRate().setRate((short) 1));
queue.setProperties(properties);
queue.setLength((short) (OFPacketQueue.MINIMUM_LENGTH + OFQueuePropertyMinRate.MINIMUM_LENGTH));
List<OFPacketQueue> queues = new ArrayList<OFPacketQueue>();
queues.add(queue);
reply.setQueues(queues);
reply.setLengthU(OFQueueConfigReply.MINIMUM_LENGTH + queue.getLength());
ByteBuffer bb = ByteBuffer.allocate(1024);
bb.clear();
reply.writeTo(bb);
bb.flip();
OFQueueConfigReply reply2 = new OFQueueConfigReply();
reply2.setQueuePropertyFactory(new BasicFactory());
reply2.readFrom(bb);
TestCase.assertEquals(reply, reply2);
TestCase.assertEquals(1, reply2.getQueues().size());
TestCase.assertEquals(1, reply2.getQueues().get(0).getProperties().size());
TestCase.assertTrue(reply2.getQueues().get(0).getProperties().get(0) instanceof OFQueuePropertyMinRate);
TestCase.assertEquals(OFQueuePropertyType.MIN_RATE, reply2.getQueues().get(0).getProperties().get(0).getType());
reply.getQueues().add(queue.clone());
reply.setLengthU(reply.getLengthU() + queue.getLength());
bb.clear();
reply.writeTo(bb);
bb.flip();
reply2 = new OFQueueConfigReply();
reply2.setQueuePropertyFactory(new BasicFactory());
reply2.readFrom(bb);
TestCase.assertEquals(reply, reply2);
TestCase.assertEquals(2, reply2.getQueues().size());
queue.getProperties().add(new OFQueuePropertyMinRate().setRate((short) 2));
queue.setLength((short) (queue.getLength() + OFQueuePropertyMinRate.MINIMUM_LENGTH));
reply.setLengthU(reply.getLengthU() + OFQueuePropertyMinRate.MINIMUM_LENGTH);
bb.clear();
reply.writeTo(bb);
bb.flip();
reply2 = new OFQueueConfigReply();
reply2.setQueuePropertyFactory(new BasicFactory());
reply2.readFrom(bb);
TestCase.assertEquals(reply, reply2);
TestCase.assertEquals(2, reply2.getQueues().size());
TestCase.assertEquals(2, reply2.getQueues().get(0).getProperties().size());
}