Search in sources :

Example 26 with TreeCacheEvent

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());
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 27 with TreeCacheEvent

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");
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 28 with TreeCacheEvent

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());
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 29 with TreeCacheEvent

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());
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 30 with TreeCacheEvent

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());
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Aggregations

TreeCacheEvent (org.apache.curator.framework.recipes.cache.TreeCacheEvent)69 Test (org.junit.Test)68 ChildData (org.apache.curator.framework.recipes.cache.ChildData)67 LeaderElectionJobListener (com.dangdang.ddframe.job.lite.internal.election.ElectionListenerManager.LeaderElectionJobListener)7 SimpleJobConfiguration (com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration)6 JobPausedStatusJobListener (com.dangdang.ddframe.job.lite.internal.server.JobOperationListenerManager.JobPausedStatusJobListener)5 TestSimpleJob (com.dangdang.ddframe.job.lite.fixture.TestSimpleJob)4 CronSettingAndJobEventChangedJobListener (com.dangdang.ddframe.job.lite.internal.config.ConfigurationListenerManager.CronSettingAndJobEventChangedJobListener)4 MonitorExecutionChangedJobListener (com.dangdang.ddframe.job.lite.internal.execution.ExecutionListenerManager.MonitorExecutionChangedJobListener)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 EnumMap (java.util.EnumMap)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 TreeCache (org.apache.curator.framework.recipes.cache.TreeCache)1 TreeCacheListener (org.apache.curator.framework.recipes.cache.TreeCacheListener)1 ConfigurationType (org.apache.metron.common.configuration.ConfigurationType)1 ParseException (org.apache.metron.stellar.dsl.ParseException)1