Search in sources :

Example 61 with TreeCacheEvent

use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.

the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenRemove.

@Test
public void assertJobTriggerStatusJobListenerWhenRemove() {
    jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/servers/" + ip + "/trigger", null, "".getBytes())), "/test_job/servers/" + ip + "/trigger");
    verify(serverService, times(0)).clearJobTriggerStatus();
    verify(jobScheduleController, times(0)).triggerJob();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 62 with TreeCacheEvent

use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.

the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathButNoJobRegister.

@Test
public void assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathButNoJobRegister() {
    jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/trigger", null, "".getBytes())), "/test_job/servers/" + ip + "/trigger");
    verify(serverService).clearJobTriggerStatus();
    verify(jobScheduleController, times(0)).triggerJob();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 63 with TreeCacheEvent

use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.

the class JobOperationListenerManagerTest method assertJobPausedStatusJobListenerWhenIsNotJobPausedPath.

@Test
public void assertJobPausedStatusJobListenerWhenIsNotJobPausedPath() {
    jobOperationListenerManager.new JobPausedStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/servers/" + ip + "/other", null, "".getBytes())), "/test_job/servers/" + ip + "/other");
    verify(jobScheduleController, times(0)).pauseJob();
    verify(jobScheduleController, times(0)).resumeJob();
}
Also used : JobPausedStatusJobListener(com.dangdang.ddframe.job.lite.internal.server.JobOperationListenerManager.JobPausedStatusJobListener) ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 64 with TreeCacheEvent

use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.

the class JobOperationListenerManagerTest method assertJobShutdownStatusJobListenerWhenIsJobShutdownPathButJobIsNotExisted.

@Test
public void assertJobShutdownStatusJobListenerWhenIsJobShutdownPathButJobIsNotExisted() {
    jobOperationListenerManager.new JobShutdownStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/shutdown", null, "".getBytes())), "/test_job/servers/" + ip + "/shutdown");
    verify(jobScheduleController, times(0)).shutdown();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 65 with TreeCacheEvent

use of org.apache.curator.framework.recipes.cache.TreeCacheEvent in project elastic-job by dangdangdotcom.

the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathAndJobRegisterButServerIsNotReady.

@Test
public void assertJobTriggerStatusJobListenerWhenIsAddAndIsJobLocalHostTriggerPathAndJobRegisterButServerIsNotReady() {
    JobRegistry.getInstance().addJobScheduleController("test_job", jobScheduleController);
    jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/trigger", null, "".getBytes())), "/test_job/servers/" + ip + "/trigger");
    verify(serverService).clearJobTriggerStatus();
    verify(serverService).isLocalhostServerReady();
    verify(jobScheduleController, times(0)).triggerJob();
}
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