use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertFailoverJobCrashedJobListenerWhenIsRunningItemPathAndRemoveAndItemNotCompletedAndEnableFailoverButHasRunningItems.
@Test
public void assertFailoverJobCrashedJobListenerWhenIsRunningItemPathAndRemoveAndItemNotCompletedAndEnableFailoverButHasRunningItems() {
when(executionService.isCompleted(0)).thenReturn(false);
when(configService.load(true)).thenReturn(LiteJobConfiguration.newBuilder(new SimpleJobConfiguration(JobCoreConfiguration.newBuilder("test_job", "0/1 * * * * ?", 3).failover(true).build(), TestSimpleJob.class.getCanonicalName())).monitorExecution(true).build());
when(shardingService.getLocalHostShardingItems()).thenReturn(Arrays.asList(1, 2));
when(executionService.hasRunningItems(Arrays.asList(1, 2))).thenReturn(true);
failoverListenerManager.new FailoverJobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/execution/0/failover", null, "".getBytes())), "/test_job/execution/0/failover");
verify(executionService).isCompleted(0);
verify(configService).load(true);
verify(failoverService).setCrashedFailoverFlag(0);
verify(shardingService).getLocalHostShardingItems();
verify(executionService).hasRunningItems(Arrays.asList(1, 2));
verify(failoverService, times(0)).failoverIfNecessary();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertFailoverJobCrashedJobListenerWhenIsRunningItemPathAndRemoveButItemCompleted.
@Test
public void assertFailoverJobCrashedJobListenerWhenIsRunningItemPathAndRemoveButItemCompleted() {
when(executionService.isCompleted(0)).thenReturn(true);
failoverListenerManager.new FailoverJobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/execution/0/failover", null, "".getBytes())), "/test_job/execution/0/failover");
verify(executionService).isCompleted(0);
verify(failoverService, times(0)).setCrashedFailoverFlag(0);
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertFailoverJobCrashedJobListenerWhenIsRunningItemPathButNotRemove.
@Test
public void assertFailoverJobCrashedJobListenerWhenIsRunningItemPathButNotRemove() {
failoverListenerManager.new FailoverJobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/execution/0/failover", null, "".getBytes())), "/test_job/execution/0/failover");
verify(failoverService, times(0)).setCrashedFailoverFlag(0);
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertJobCrashedJobListenerWhenIsNotRunningItemPath.
@Test
public void assertJobCrashedJobListenerWhenIsNotRunningItemPath() {
failoverListenerManager.new JobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/execution/0/other", null, "".getBytes())), "/test_job/execution/0/other");
verify(failoverService, times(0)).setCrashedFailoverFlag(0);
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class FailoverListenerManagerTest method assertFailoverJobCrashedJobListenerWhenIsNotRunningItemPath.
@Test
public void assertFailoverJobCrashedJobListenerWhenIsNotRunningItemPath() {
failoverListenerManager.new FailoverJobCrashedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/execution/0/other", null, "".getBytes())), "/test_job/execution/0/other");
verify(failoverService, times(0)).setCrashedFailoverFlag(0);
}
Aggregations