use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class CloudJobConfigurationListenerTest method assertChildEventWhenStateIsAddAndIsConfigPath.
@Test
public void assertChildEventWhenStateIsAddAndIsConfigPath() throws Exception {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson().getBytes())));
verify(producerManager).schedule(Matchers.<CloudJobConfiguration>any());
}
use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class CloudJobConfigurationListenerTest method assertChildEventWhenStateIsRemovedAndIsJobConfigPath.
@Test
public void assertChildEventWhenStateIsRemovedAndIsJobConfigPath() throws Exception {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/config/job/test_job", null, "".getBytes())));
verify(producerManager).unschedule("test_job");
}
use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class CloudJobConfigurationListenerTest method assertChildEventWhenStateIsUpdateAndIsConfigPathAndMisfireDisabled.
@Test
public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndMisfireDisabled() throws Exception {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson(false).getBytes())));
verify(readyService).setMisfireDisabled("test_job");
verify(producerManager).reschedule(Matchers.<CloudJobConfiguration>any());
}
use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class CloudJobConfigurationListenerTest method assertChildEventWhenIsRootConfigPath.
@Test
public void assertChildEventWhenIsRootConfigPath() throws Exception {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/config/job", null, "".getBytes())));
verify(producerManager, times(0)).schedule(Matchers.<CloudJobConfiguration>any());
verify(producerManager, times(0)).reschedule(Matchers.<CloudJobConfiguration>any());
verify(producerManager, times(0)).unschedule(Matchers.<String>any());
}
use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.
the class CloudJobConfigurationListenerTest method assertChildEventWhenStateIsUpdateAndIsConfigPathAndDaemonJob.
@Test
public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndDaemonJob() throws Exception {
cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson(CloudJobExecutionType.DAEMON).getBytes())));
verify(readyService).remove(Collections.singletonList("test_job"));
verify(producerManager).reschedule(Matchers.<CloudJobConfiguration>any());
}
Aggregations