use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithPageSizeAndNumber.
@Test
public void assertFindJobExecutionEventsWithPageSizeAndNumber() {
Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
result = repository.findJobExecutionEvents(new Condition(50, 1, null, null, null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(50));
result = repository.findJobExecutionEvents(new Condition(100, 5, null, null, null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(100));
result = repository.findJobExecutionEvents(new Condition(100, 6, null, null, null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(0));
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithTime.
@Test
public void assertFindJobExecutionEventsWithTime() {
Date now = new Date();
Date tenMinutesBefore = new Date(now.getTime() - 10 * 60 * 1000);
Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, tenMinutesBefore, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, now, null, null));
assertThat(result.getTotal(), is(0));
assertThat(result.getRows().size(), is(0));
result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, tenMinutesBefore, null));
assertThat(result.getTotal(), is(0));
assertThat(result.getRows().size(), is(0));
result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, now, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, tenMinutesBefore, now, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithErrorPageSizeAndNumber.
@Test
public void assertFindJobExecutionEventsWithErrorPageSizeAndNumber() {
Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(-1, -1, null, null, null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithSort.
@Test
public void assertFindJobExecutionEventsWithSort() {
Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, "jobName", "ASC", null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
assertThat(result.getRows().get(0).getJobName(), is("test_job_1"));
result = repository.findJobExecutionEvents(new Condition(10, 1, "jobName", "DESC", null, null, null));
assertThat(result.getTotal(), is(500));
assertThat(result.getRows().size(), is(10));
assertThat(result.getRows().get(0).getJobName(), is("test_job_99"));
}
use of com.dangdang.ddframe.job.event.type.JobExecutionEvent in project elastic-job by dangdangdotcom.
the class JobEventRdbSearchTest method initStorage.
private static void initStorage() {
for (int i = 1; i <= 500; i++) {
JobExecutionEvent startEvent = new JobExecutionEvent("fake_task_id", "test_job_" + i, ExecutionSource.NORMAL_TRIGGER, 0);
storage.addJobExecutionEvent(startEvent);
if (i % 2 == 0) {
JobExecutionEvent successEvent = startEvent.executionSuccess();
storage.addJobExecutionEvent(successEvent);
}
storage.addJobStatusTraceEvent(new JobStatusTraceEvent("test_job_" + i, "fake_failed_failover_task_id", "fake_slave_id", Source.LITE_EXECUTOR, ExecutionType.FAILOVER, "0", State.TASK_FAILED, "message is empty."));
}
}
Aggregations