use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class ElectionListenerManagerTest method assertLeaderElectionJobListenerWhenIsLeaderHostPathAndIsRemoveAndIsNotLeaderWithoutAvailableServers.
@Test
public void assertLeaderElectionJobListenerWhenIsLeaderHostPathAndIsRemoveAndIsNotLeaderWithoutAvailableServers() {
when(leaderElectionService.hasLeader()).thenReturn(false);
when(serverService.getAvailableServers()).thenReturn(Collections.<String>emptyList());
electionListenerManager.new LeaderElectionJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/leader/election/host", null, "localhost".getBytes())), "/test_job/leader/election/host");
verify(leaderElectionService).hasLeader();
verify(serverService).getAvailableServers();
verify(leaderElectionService, times(0)).leaderElection();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class ElectionListenerManagerTest method assertLeaderElectionJobListenerWhenJobDisabledAndIsNotLeader.
@Test
public void assertLeaderElectionJobListenerWhenJobDisabledAndIsNotLeader() {
when(leaderElectionService.isLeader()).thenReturn(false);
when(serverNode.isLocalJobPausedPath("/test_job/server/mockedIP/disabled")).thenReturn(true);
electionListenerManager.new LeaderElectionJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/server/mockedIP/disabled", null, "localhost".getBytes())), "/test_job/server/mockedIP/disabled");
verify(leaderElectionService, times(0)).removeLeader();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenRemove.
@Test
public void assertJobTriggerStatusJobListenerWhenRemove() {
jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/servers/" + ip + "/trigger", null, "".getBytes())), "/test_job/servers/" + ip + "/trigger");
verify(serverService, times(0)).clearJobTriggerStatus();
verify(jobScheduleController, times(0)).triggerJob();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathButNoJobRegister.
@Test
public void assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathButNoJobRegister() {
jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/trigger", null, "".getBytes())), "/test_job/servers/" + ip + "/trigger");
verify(serverService).clearJobTriggerStatus();
verify(jobScheduleController, times(0)).triggerJob();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class JobOperationListenerManagerTest method assertJobPausedStatusJobListenerWhenIsNotJobPausedPath.
@Test
public void assertJobPausedStatusJobListenerWhenIsNotJobPausedPath() {
jobOperationListenerManager.new JobPausedStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/servers/" + ip + "/other", null, "".getBytes())), "/test_job/servers/" + ip + "/other");
verify(jobScheduleController, times(0)).pauseJob();
verify(jobScheduleController, times(0)).resumeJob();
}
Aggregations