use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class MonitorService method dumpDirectly.
private void dumpDirectly(final String path, final List<String> result) {
for (String each : regCenter.getChildrenKeys(path)) {
String zkPath = path + "/" + each;
String zkValue = regCenter.get(zkPath);
if (null == zkValue) {
zkValue = "";
}
TreeCache treeCache = (TreeCache) regCenter.getRawCache("/" + jobName);
ChildData treeCacheData = treeCache.getCurrentData(zkPath);
String treeCachePath = null == treeCacheData ? "" : treeCacheData.getPath();
String treeCacheValue = null == treeCacheData ? "" : new String(treeCacheData.getData());
if (zkValue.equals(treeCacheValue) && zkPath.equals(treeCachePath)) {
result.add(Joiner.on(" | ").join(zkPath, zkValue));
} else {
result.add(Joiner.on(" | ").join(zkPath, zkValue, treeCachePath, treeCacheValue));
}
dumpDirectly(zkPath, result);
}
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ConfigurationListenerManagerTest method assertCronSettingChangedJobListenerWhenIsNotCronPath.
@Test
public void assertCronSettingChangedJobListenerWhenIsNotCronPath() {
configurationListenerManager.new CronSettingAndJobEventChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/config/other", null, LiteJsonConstants.getJobJson().getBytes())), "/test_job/config/other");
verify(jobScheduleController, times(0)).rescheduleJob(Matchers.<String>any());
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ConfigurationListenerManagerTest method assertCronSettingChangedJobListenerWhenIsCronPathButNotUpdate.
@Test
public void assertCronSettingChangedJobListenerWhenIsCronPathButNotUpdate() {
configurationListenerManager.new CronSettingAndJobEventChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/config", null, LiteJsonConstants.getJobJson().getBytes())), "/test_job/config");
verify(jobScheduleController, times(0)).rescheduleJob(Matchers.<String>any());
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class ConfigurationListenerManagerTest method assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateAndFindJob.
@Test
public void assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateAndFindJob() {
JobRegistry.getInstance().addJobScheduleController("test_job", jobScheduleController);
configurationListenerManager.new CronSettingAndJobEventChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/config", null, LiteJsonConstants.getJobJson().getBytes())), "/test_job/config");
verify(jobScheduleController).rescheduleJob("0/1 * * * * ?");
}
use of org.apache.curator.framework.recipes.cache.ChildData in project elastic-job by dangdangdotcom.
the class GuaranteeListenerManagerTest method assertStartedNodeRemovedJobListenerWhenIsNotRemoved.
@Test
public void assertStartedNodeRemovedJobListenerWhenIsNotRemoved() {
guaranteeListenerManager.new StartedNodeRemovedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/guarantee/started", null, "".getBytes())), "/test_job/guarantee/started");
verify(distributeOnceElasticJobListener, times(0)).notifyWaitingTaskStart();
}
Aggregations