本文整理汇总了Java中net.floodlightcontroller.core.test.MockFloodlightProvider.setSwitches方法的典型用法代码示例。如果您正苦于以下问题:Java MockFloodlightProvider.setSwitches方法的具体用法?Java MockFloodlightProvider.setSwitches怎么用?Java MockFloodlightProvider.setSwitches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.core.test.MockFloodlightProvider
的用法示例。
在下文中一共展示了MockFloodlightProvider.setSwitches方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import net.floodlightcontroller.core.test.MockFloodlightProvider; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
staticFlowEntryPusher = new StaticFlowEntryPusher();
storage = createStorageWithFlowEntries();
dpid = HexString.toLong(TestSwitch1DPID);
mockSwitch = createNiceMock(IOFSwitch.class);
writeCapture = new Capture<OFMessage>(CaptureType.ALL);
contextCapture = new Capture<FloodlightContext>(CaptureType.ALL);
writeCaptureList = new Capture<List<OFMessage>>(CaptureType.ALL);
//OFMessageSafeOutStream mockOutStream = createNiceMock(OFMessageSafeOutStream.class);
mockSwitch.write(capture(writeCapture), capture(contextCapture));
expectLastCall().anyTimes();
mockSwitch.write(capture(writeCaptureList), capture(contextCapture));
expectLastCall().anyTimes();
mockSwitch.flush();
expectLastCall().anyTimes();
FloodlightModuleContext fmc = new FloodlightModuleContext();
fmc.addService(IStorageSourceService.class, storage);
MockFloodlightProvider mockFloodlightProvider = getMockFloodlightProvider();
Map<Long, IOFSwitch> switchMap = new HashMap<Long, IOFSwitch>();
switchMap.put(dpid, mockSwitch);
// NO ! expect(mockFloodlightProvider.getSwitches()).andReturn(switchMap).anyTimes();
mockFloodlightProvider.setSwitches(switchMap);
fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
RestApiServer restApi = new RestApiServer();
fmc.addService(IRestApiService.class, restApi);
restApi.init(fmc);
staticFlowEntryPusher.init(fmc);
staticFlowEntryPusher.startUp(fmc); // again, to hack unittest
}