use of org.onosproject.cluster.LeadershipService in project onos by opennetworkinglab.
the class ElectionTestRunCommand method doExecute.
@Override
protected void doExecute() {
LeadershipService service = get(LeadershipService.class);
service.runForLeadership(ELECTION_APP);
// print the current leader
print("Entering leadership elections for the Election app.");
}
use of org.onosproject.cluster.LeadershipService in project onos by opennetworkinglab.
the class ElectionTestWithdrawCommand method doExecute.
@Override
protected void doExecute() {
LeadershipService service = get(LeadershipService.class);
service.withdraw(ELECTION_APP);
// print the current leader
print("Withdrawing from leadership elections for the Election app.");
}
use of org.onosproject.cluster.LeadershipService in project onos by opennetworkinglab.
the class WorkPartitionManagerTest method setUp.
@Before
public void setUp() {
leadershipService = createMock(LeadershipService.class);
leadershipService.addListener(anyObject(LeadershipEventListener.class));
expectLastCall().andDelegateTo(new TestLeadershipService());
for (int i = 0; i < WorkPartitionManager.NUM_PARTITIONS; i++) {
expect(leadershipService.runForLeadership(ELECTION_PREFIX + i)).andReturn(null).times(1);
}
partitionManager = new WorkPartitionManager().withScheduledExecutor(new NullScheduledExecutor());
partitionManager.clusterService = new TestClusterService();
partitionManager.localNodeId = MY_NODE_ID;
partitionManager.leadershipService = leadershipService;
partitionManager.eventDispatcher = new TestEventDispatcher();
}
use of org.onosproject.cluster.LeadershipService in project onos by opennetworkinglab.
the class ElectionTestLeaderCommand method doExecute.
@Override
protected void doExecute() {
LeadershipService service = get(LeadershipService.class);
// print the current leader
leader = service.getLeader(ELECTION_APP);
printLeader(leader);
}
Aggregations