本文整理汇总了Java中net.floodlightcontroller.core.internal.Controller.IUpdate类的典型用法代码示例。如果您正苦于以下问题:Java IUpdate类的具体用法?Java IUpdate怎么用?Java IUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IUpdate类属于net.floodlightcontroller.core.internal.Controller包,在下文中一共展示了IUpdate类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetRole
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
@Test
public void testSetRole() {
controller.connectedSwitches.add(new OFSwitchImpl());
RoleChanger roleChanger = createMock(RoleChanger.class);
roleChanger.submitRequest(controller.connectedSwitches, Role.SLAVE);
controller.roleChanger = roleChanger;
assertEquals("Check that update queue is empty", 0,
controller.updates.size());
replay(roleChanger);
controller.setRole(Role.SLAVE);
verify(roleChanger);
Controller.IUpdate upd = controller.updates.poll();
assertNotNull("Check that update queue has an update", upd);
assertTrue("Check that update is HARoleUpdate",
upd instanceof Controller.HARoleUpdate);
Controller.HARoleUpdate roleUpd = (Controller.HARoleUpdate)upd;
assertSame(null, roleUpd.oldRole);
assertSame(Role.SLAVE, roleUpd.newRole);
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:23,代码来源:ControllerTest.java
示例2: testSetRole
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
@Test
public void testSetRole() {
controller.connectedSwitches.add(new OFSwitchImpl());
RoleChanger roleChanger = createMock(RoleChanger.class);
roleChanger.submitRequest(controller.connectedSwitches, Role.SLAVE);
controller.roleChanger = roleChanger;
assertEquals("Check that update queue is empty", 0,
controller.updates.size());
replay(roleChanger);
controller.setRole(Role.SLAVE, "Testing");
controller.doSetRole(); // avoid wait
verify(roleChanger);
Controller.IUpdate upd = controller.updates.poll();
assertNotNull("Check that update queue has an update", upd);
assertTrue("Check that update is HARoleUpdate",
upd instanceof Controller.HARoleUpdate);
Controller.HARoleUpdate roleUpd = (Controller.HARoleUpdate)upd;
assertSame(Role.MASTER, roleUpd.oldRole);
assertSame(Role.SLAVE, roleUpd.newRole);
}
示例3: testSetRole
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
@Test
public void testSetRole() {
controller.connectedSwitches.add(new OFSwitchImpl());
RoleChanger roleChanger = createMock(RoleChanger.class);
roleChanger.submitRequest(controller.connectedSwitches, Role.SLAVE);
controller.roleChanger = roleChanger;
assertEquals("Check that update queue is empty", 0,
controller.updates.size());
replay(roleChanger);
controller.setRole(Role.SLAVE);
controller.doSetRole(); // avoid wait
verify(roleChanger);
Controller.IUpdate upd = controller.updates.poll();
assertNotNull("Check that update queue has an update", upd);
assertTrue("Check that update is HARoleUpdate",
upd instanceof Controller.HARoleUpdate);
Controller.HARoleUpdate roleUpd = (Controller.HARoleUpdate)upd;
assertSame(Role.MASTER, roleUpd.oldRole);
assertSame(Role.SLAVE, roleUpd.newRole);
}
示例4: addUpdateToQueue
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
@Override
public void addUpdateToQueue(final IUpdate update) {
if (useAsyncUpdates) {
mostRecentUpdateFuture = executorService.submit(new Runnable() {
@Override
public void run() {
update.dispatch();
}
});
} else {
update.dispatch();
}
}
示例5: transitionToActive
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
/**
* Dispatches a new role change notification
* @param oldRole
* @param newRole
*/
public void transitionToActive() {
IUpdate update = new IUpdate() {
@Override
public void dispatch() {
for (IHAListener rl : haListeners.getOrderedListeners()) {
rl.transitionToActive();
}
}
};
addUpdateToQueue(update);
}
示例6: setRoleAndMockController
import net.floodlightcontroller.core.internal.Controller.IUpdate; //导入依赖的package包/类
/**
* Helper method that mocks up the controller and sets the supplied role
* @param role the desired role to pass to setRole
*/
private void setRoleAndMockController(HARole role) {
reset(controller);
controller.addUpdateToQueue(anyObject(IUpdate.class));
expectLastCall().anyTimes();
replay(controller);
roleManager.setRole(role, "test");
}