use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ExecutionListenerManagerTest method assertMonitorExecutionChangedJobListenerWhenIsMonitorExecutionPathAndUpdateButEnable.
@Test
public void assertMonitorExecutionChangedJobListenerWhenIsMonitorExecutionPathAndUpdateButEnable() {
executionListenerManager.new MonitorExecutionChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/config", null, LiteJsonConstants.getJobJson().getBytes())), "/test_job/config");
verify(executionService, times(0)).removeExecutionInfo();
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ExecutionListenerManagerTest method assertMonitorExecutionChangedJobListenerWhenIsMonitorExecutionPathAndUpdateButDisable.
@Test
public void assertMonitorExecutionChangedJobListenerWhenIsMonitorExecutionPathAndUpdateButDisable() {
executionListenerManager.new MonitorExecutionChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/config", null, LiteJsonConstants.getJobJson(false).getBytes())), "/test_job/config");
verify(executionService).removeExecutionInfo();
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertJobCrashedJobListenerWhenIsRunningItemPathAndRemoveButItemCompleted.
@Test
public void assertJobCrashedJobListenerWhenIsRunningItemPathAndRemoveButItemCompleted() {
when(executionService.isCompleted(0)).thenReturn(true);
failoverListenerManager.new JobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/execution/0/running", null, "".getBytes())), "/test_job/execution/0/running");
verify(executionService).isCompleted(0);
verify(failoverService, times(0)).setCrashedFailoverFlag(0);
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertFailoverSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButEnableFailover.
@Test
public void assertFailoverSettingsChangedJobListenerWhenIsFailoverPathAndUpdateButEnableFailover() {
failoverListenerManager.new FailoverSettingsChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/config", null, LiteJsonConstants.getJobJson().getBytes())), "/test_job/config");
verify(failoverService, times(0)).removeFailoverInfo();
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ElectionListenerManagerTest method assertLeaderElectionJobListenerWhenIsLeaderHostPathAndIsRemoveAndIsLeader.
@Test
public void assertLeaderElectionJobListenerWhenIsLeaderHostPathAndIsRemoveAndIsLeader() {
when(leaderElectionService.hasLeader()).thenReturn(true);
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(leaderElectionService, times(0)).leaderElection();
}
Aggregations