Search in sources :

Example 1 with CronSettingAndJobEventChangedJobListener

use of com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener 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());
}
Also used : CronSettingAndJobEventChangedJobListener(com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 2 with CronSettingAndJobEventChangedJobListener

use of com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener 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());
}
Also used : CronSettingAndJobEventChangedJobListener(com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 3 with CronSettingAndJobEventChangedJobListener

use of com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener 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 * * * * ?");
}
Also used : CronSettingAndJobEventChangedJobListener(com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 4 with CronSettingAndJobEventChangedJobListener

use of com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener in project elastic-job by dangdangdotcom.

the class ConfigurationListenerManagerTest method assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateButCannotFindJob.

@Test
public void assertCronSettingChangedJobListenerWhenIsCronPathAndUpdateButCannotFindJob() {
    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, times(0)).rescheduleJob(Matchers.<String>any());
}
Also used : CronSettingAndJobEventChangedJobListener(com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Aggregations

CronSettingAndJobEventChangedJobListener (com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener)4 ChildData (org.apache.curator.framework.recipes.cache.ChildData)4 TreeCacheEvent (org.apache.curator.framework.recipes.cache.TreeCacheEvent)4 Test (org.junit.Test)4