use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class CloudJobFacadeTest method assertPostJobExecutionEvent.
@Test
public void assertPostJobExecutionEvent() {
JobExecutionEvent jobExecutionEvent = new JobExecutionEvent("fake_task_id", "test_job", ExecutionSource.NORMAL_TRIGGER, 0);
jobFacade.postJobExecutionEvent(jobExecutionEvent);
verify(eventBus).post(jobExecutionEvent);
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventBusTest method assertPostWithoutListener.
@Test
public void assertPostWithoutListener() throws NoSuchFieldException {
jobEventBus = new JobEventBus();
assertIsRegistered(false);
ReflectionUtils.setFieldValue(jobEventBus, "eventBus", eventBus);
jobEventBus.post(new JobExecutionEvent("fake_task_id", "test_event_bus_job", ExecutionSource.NORMAL_TRIGGER, 0));
verify(eventBus, times(0)).post(Matchers.<JobEvent>any());
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventBusTest method assertPost.
@Test
public void assertPost() throws InterruptedException, NoSuchFieldException {
jobEventBus = new JobEventBus(new TestJobEventConfiguration(jobEventCaller));
assertIsRegistered(true);
jobEventBus.post(new JobExecutionEvent("fake_task_id", "test_event_bus_job", ExecutionSource.NORMAL_TRIGGER, 0));
while (!TestJobEventListener.isExecutionEventCalled()) {
Thread.sleep(100L);
}
verify(jobEventCaller).call();
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobExecutionEventTest method assertNewJobExecutionEvent.
@Test
public void assertNewJobExecutionEvent() {
JobExecutionEvent actual = new JobExecutionEvent("fake_task_id", "test_job", JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0);
assertThat(actual.getJobName(), is("test_job"));
assertThat(actual.getSource(), is(JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER));
assertThat(actual.getShardingItem(), is(0));
assertNotNull(actual.getHostname());
assertNotNull(actual.getStartTime());
assertNull(actual.getCompleteTime());
assertFalse(actual.isSuccess());
assertThat(actual.getFailureCause(), is(""));
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbListenerTest method assertPostJobExecutionEvent.
@Test
public void assertPostJobExecutionEvent() {
JobExecutionEvent jobExecutionEvent = new JobExecutionEvent("fake_task_id", JOB_NAME, JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0);
jobEventBus.post(jobExecutionEvent);
verify(repository, atMost(1)).addJobExecutionEvent(jobExecutionEvent);
}
Aggregations