use of com.dangdang.ddframe.job.reg.base.ElectionCandidate in project elastic-job by dangdangdotcom.
the class ZookeeperElectionServiceTest method assertContend.
@Test
public void assertContend() throws Exception {
ElectionCandidate anotherElectionCandidate = mock(ElectionCandidate.class);
CuratorFramework anotherClient = CuratorFrameworkFactory.newClient(EmbedTestingServer.getConnectionString(), new RetryOneTime(2000));
ZookeeperElectionService anotherService = new ZookeeperElectionService("ANOTHER_CLIENT:8899", anotherClient, ELECTION_PATH, anotherElectionCandidate);
anotherClient.start();
anotherClient.blockUntilConnected();
anotherService.start();
KillSession.kill(client.getZookeeperClient().getZooKeeper(), EmbedTestingServer.getConnectionString());
service.stop();
verify(anotherElectionCandidate).startLeadership();
}
Aggregations