Search in sources :

Example 66 with TreeCacheEvent

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

the class JobOperationListenerManagerTest method assertJobTriggerStatusJobListenerWhenIsAddButNotLocalHostJobTriggerPath.

@Test
public void assertJobTriggerStatusJobListenerWhenIsAddButNotLocalHostJobTriggerPath() {
    jobOperationListenerManager.new JobTriggerStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/other", null, "".getBytes())), "/test_job/servers/" + ip + "/other");
    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 67 with TreeCacheEvent

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

the class JobOperationListenerManagerTest method assertJobShutdownStatusJobListenerWhenIsNotJobShutdownPath.

@Test
public void assertJobShutdownStatusJobListenerWhenIsNotJobShutdownPath() {
    jobOperationListenerManager.new JobShutdownStatusJobListener().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)).shutdown();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 68 with TreeCacheEvent

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

the class JobOperationListenerManagerTest method assertJobPausedStatusJobListenerWhenIsJobPausedPathAndAdd.

@Test
public void assertJobPausedStatusJobListenerWhenIsJobPausedPathAndAdd() {
    JobRegistry.getInstance().addJobScheduleController("test_job", jobScheduleController);
    jobOperationListenerManager.new JobPausedStatusJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/servers/" + ip + "/paused", null, "".getBytes())), "/test_job/servers/" + ip + "/paused");
    verify(jobScheduleController).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)

Aggregations

TreeCacheEvent (org.apache.curator.framework.recipes.cache.TreeCacheEvent)68 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