Search in sources :

Example 56 with ChildData

use of org.apache.curator.framework.recipes.cache.ChildData 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)

Example 57 with ChildData

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

the class GuaranteeListenerManagerTest method assertCompletedNodeRemovedJobListenerWhenIsNotRemoved.

@Test
public void assertCompletedNodeRemovedJobListenerWhenIsNotRemoved() {
    guaranteeListenerManager.new CompletedNodeRemovedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/test_job/guarantee/completed", null, "".getBytes())), "/test_job/guarantee/completed");
    verify(distributeOnceElasticJobListener, times(0)).notifyWaitingTaskStart();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 58 with ChildData

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

the class GuaranteeListenerManagerTest method assertStartedNodeRemovedJobListenerWhenIsRemovedAndStartedNode.

@Test
public void assertStartedNodeRemovedJobListenerWhenIsRemovedAndStartedNode() {
    guaranteeListenerManager.new StartedNodeRemovedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/test_job/guarantee/started", null, "".getBytes())), "/test_job/guarantee/started");
    verify(distributeOnceElasticJobListener).notifyWaitingTaskStart();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Example 59 with ChildData

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

the class JobListenerTest method assertChildEventSuccess.

@Test
public void assertChildEventSuccess() throws Exception {
    when(event.getData()).thenReturn(new ChildData("/test_job", null, null));
    fooJobListener.childEvent(client, event);
    verify(client).getNamespace();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) Test(org.junit.Test)

Example 60 with ChildData

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

the class FailoverListenerManagerTest method assertFailoverSettingsChangedJobListenerWhenIsFailoverPathButNotUpdate.

@Test
public void assertFailoverSettingsChangedJobListenerWhenIsFailoverPathButNotUpdate() {
    failoverListenerManager.new FailoverSettingsChangedJobListener().dataChanged(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, new ChildData("/test_job/config/failover", null, "".getBytes())), "/test_job/config/failover");
    verify(failoverService, times(0)).removeFailoverInfo();
}
Also used : ChildData(org.apache.curator.framework.recipes.cache.ChildData) TreeCacheEvent(org.apache.curator.framework.recipes.cache.TreeCacheEvent) Test(org.junit.Test)

Aggregations

ChildData (org.apache.curator.framework.recipes.cache.ChildData)88 Test (org.junit.Test)71 TreeCacheEvent (org.apache.curator.framework.recipes.cache.TreeCacheEvent)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 IOException (java.io.IOException)4 CuratorFramework (org.apache.curator.framework.CuratorFramework)4 KeeperException (org.apache.zookeeper.KeeperException)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 HashMap (java.util.HashMap)3 PathChildrenCache (org.apache.curator.framework.recipes.cache.PathChildrenCache)3 PathChildrenCacheEvent (org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent)3 PathChildrenCacheListener (org.apache.curator.framework.recipes.cache.PathChildrenCacheListener)3 TreeCache (org.apache.curator.framework.recipes.cache.TreeCache)3 ReliableMessageRegisterDto (com.paascloud.core.registry.base.ReliableMessageRegisterDto)2 ObjectInputStream (java.io.ObjectInputStream)2