当前位置: 首页>>代码示例>>Java>>正文


Java Capture.getValue方法代码示例

本文整理汇总了Java中org.easymock.Capture.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Capture.getValue方法的具体用法?Java Capture.getValue怎么用?Java Capture.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.easymock.Capture的用法示例。


在下文中一共展示了Capture.getValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSingleMessageWrite

import org.easymock.Capture; //导入方法依赖的package包/类
/** write a packetOut, which is not buffered */
@Test(timeout = 5000)
public void testSingleMessageWrite() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();
    
    conn.write(packetOut);
    eventLoop.runTasks();
    assertThat("Write should have been flushed", cMsgList.hasCaptured(), equalTo(true));
    
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(packetOut));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:OFConnectionTest.java

示例2: testMessageWriteList

import org.easymock.Capture; //导入方法依赖的package包/类
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));
    eventLoop.runTasks();
    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:OFConnectionTest.java

示例3: testSingleMessageWrite

import org.easymock.Capture; //导入方法依赖的package包/类
/** write a packetOut, which is buffered */
@Test(timeout = 5000)
public void testSingleMessageWrite() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();
    
    conn.write(packetOut);
    assertThat("Write should have been flushed", cMsgList.hasCaptured(), equalTo(true));
    
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(packetOut));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:19,代码来源:OFConnectionTest.java

示例4: testMessageWriteList

import org.easymock.Capture; //导入方法依赖的package包/类
/** write a list of messages */
@Test(timeout = 5000)
public void testMessageWriteList() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFHello hello = factory.hello(ImmutableList.<OFHelloElem>of());
    OFPacketOut packetOut = factory.buildPacketOut()
            .setData(new byte[] { 0x01, 0x02, 0x03, 0x04 })
            .setActions(ImmutableList.<OFAction>of( factory.actions().output(OFPort.of(1), 0)))
            .build();

    conn.write(ImmutableList.of(hello, packetOut));

    assertThat("Write should have been written", cMsgList.hasCaptured(), equalTo(true));
    List<OFMessage> value = cMsgList.getValue();
    logger.info("Captured channel write: "+value);
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(hello, packetOut));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:20,代码来源:OFConnectionTest.java

示例5: deleteFlow

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void deleteFlow() throws Exception {
    Capture<OFFlowMod> capture = prepareForInstallTest();
    switchManager.deleteFlow(dpid, cookieHex, cookie);
    final OFFlowMod actual = capture.getValue();
    assertEquals(OFFlowModCommand.DELETE, actual.getCommand());
    assertEquals(Long.valueOf(cookieHex, 16).longValue(), actual.getCookie().getValue());
    assertEquals(SwitchManager.NON_SYSTEM_MASK, actual.getCookieMask());
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:10,代码来源:SwitchManagerTest.java

示例6: deleteMeter

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void deleteMeter() {
    final Capture<OFMeterMod> capture = prepareForMeterTest();
    switchManager.deleteMeter(dpid, meterId);
    final OFMeterMod meterMod = capture.getValue();
    assertEquals(meterMod.getCommand(), OFMeterModCommand.DELETE);
    assertEquals(meterMod.getMeterId(), meterId);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:9,代码来源:SwitchManagerTest.java

示例7: assertExpireTime

import org.easymock.Capture; //导入方法依赖的package包/类
private void assertExpireTime(long expectedExpire, Capture<TwoWayChannelMessage> initiateCapture) {
    final TwoWayChannelMessage response = initiateCapture.getValue();
    final MessageType type = response.getType();
    assertEquals("Wrong type " + type, MessageType.INITIATE, type);
    final long actualExpire = response.getInitiate().getExpireTimeSecs();
    assertTrue("Expire time too small " + expectedExpire + " > " + actualExpire, expectedExpire <= actualExpire);
    assertTrue("Expire time too large  " + expectedExpire + "<" + actualExpire, expectedExpire >= actualExpire);
}
 
开发者ID:creativechain,项目名称:creacoinj,代码行数:9,代码来源:PaymentChannelServerTest.java

示例8: testFloodNoBufferId

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void testFloodNoBufferId() throws Exception {
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    
    // build our expected flooded packetOut
	OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
        .setActions(al)
        .setBufferId(OFBufferId.NO_BUFFER)
        .setXid(1)
        .setInPort(OFPort.of(1))
        .setData(this.testPacketSerialized).build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes();

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertTrue(OFMessageUtils.equalsIgnoreXid(m, po));
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:37,代码来源:HubTest.java

示例9: testFloodBufferId

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn = this.packetIn.createBuilder()
    		.setBufferId(OFBufferId.of(10))
    		.setXid(1)
    		.build();

    OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    // build our expected flooded packetOut
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
    	.setActions(al)
        .setXid(1)
        .setBufferId(OFBufferId.of(10))
        .setInPort(OFPort.of(1))
        .build();

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL);
    expect(mockSwitch.write(capture(wc1))).andReturn(true).anyTimes();

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertEquals(po, m);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:41,代码来源:HubTest.java

示例10: testFloodNoBufferId

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void testFloodNoBufferId() throws Exception {
    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    
    // build our expected flooded packetOut
	OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
        .setActions(al)
        .setBufferId(OFBufferId.NO_BUFFER)
        .setXid(1)
        .setInPort(OFPort.of(1))
        .setData(this.testPacketSerialized).build();
    
    Capture<OFMessage> wc1 = new Capture<OFMessage>(CaptureType.ALL);
    
    mockSwitch.write(capture(wc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertTrue(OFMessageUtils.equalsIgnoreXid(m, po));
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:37,代码来源:HubTest.java

示例11: testFloodBufferId

import org.easymock.Capture; //导入方法依赖的package包/类
@Test
public void testFloodBufferId() throws Exception {
    MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
    this.packetIn = this.packetIn.createBuilder()
    		.setBufferId(OFBufferId.of(10))
    		.setXid(1)
    		.build();

    OFActionOutput ao = OFFactories.getFactory(OFVersion.OF_13).actions().buildOutput().setPort(OFPort.FLOOD).build();
	List<OFAction> al = new ArrayList<OFAction>();
	al.add(ao);
    // build our expected flooded packetOut
    OFPacketOut po = OFFactories.getFactory(OFVersion.OF_13).buildPacketOut()
    	.setActions(al)
        .setXid(1)
        .setBufferId(OFBufferId.of(10))
        .setInPort(OFPort.of(1))
        .build();

    // Mock up our expected behavior
    IOFSwitch mockSwitch = createMock(IOFSwitch.class);
    EasyMock.expect(mockSwitch.getOFFactory()).andReturn(OFFactories.getFactory(OFVersion.OF_13)).anyTimes();
    Capture<OFPacketOut> wc1 = new Capture<OFPacketOut>(CaptureType.ALL);
    mockSwitch.write(capture(wc1));

    // Start recording the replay on the mocks
    replay(mockSwitch);
    // Get the listener and trigger the packet in
    IOFMessageListener listener = mockFloodlightProvider.getListeners().get(
            OFType.PACKET_IN).get(0);
    listener.receive(mockSwitch, this.packetIn,
                     parseAndAnnotate(this.packetIn));

    // Verify the replay matched our expectations
    verify(mockSwitch);
    
    assertTrue(wc1.hasCaptured());
    OFMessage m = wc1.getValue();
    assertEquals(po, m);
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:41,代码来源:HubTest.java


注:本文中的org.easymock.Capture.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。