Search in sources :

Example 6 with Condition

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition in project elastic-job by dangdangdotcom.

the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithErrorSort.

@Test
public void assertFindJobExecutionEventsWithErrorSort() {
    Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, "jobName", "ERROR_SORT", 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, "notExistField", "ASC", null, null, null));
    assertThat(result.getTotal(), is(500));
    assertThat(result.getRows().size(), is(10));
}
Also used : Condition(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition) JobExecutionEvent(com.dangdang.ddframe.job.event.type.JobExecutionEvent) Test(org.junit.Test)

Example 7 with Condition

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition in project elastic-job by dangdangdotcom.

the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithFields.

@Test
public void assertFindJobExecutionEventsWithFields() {
    Map<String, Object> fields = new HashMap<>();
    fields.put("isSuccess", "1");
    Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, null, fields));
    assertThat(result.getTotal(), is(250));
    assertThat(result.getRows().size(), is(10));
    fields.put("isSuccess", null);
    fields.put("jobName", "test_job_1");
    result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, null, fields));
    assertThat(result.getTotal(), is(1));
    assertThat(result.getRows().size(), is(1));
}
Also used : Condition(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition) JobExecutionEvent(com.dangdang.ddframe.job.event.type.JobExecutionEvent) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 8 with Condition

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition in project elastic-job by dangdangdotcom.

the class JobEventRdbSearchTest method assertFindJobExecutionEventsWithErrorFields.

@Test
public void assertFindJobExecutionEventsWithErrorFields() {
    Map<String, Object> fields = new HashMap<>();
    fields.put("notExistField", "some value");
    Result<JobExecutionEvent> result = repository.findJobExecutionEvents(new Condition(10, 1, null, null, null, null, fields));
    assertThat(result.getTotal(), is(500));
    assertThat(result.getRows().size(), is(10));
}
Also used : Condition(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition) JobExecutionEvent(com.dangdang.ddframe.job.event.type.JobExecutionEvent) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 9 with Condition

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition 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));
}
Also used : Condition(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition) JobExecutionEvent(com.dangdang.ddframe.job.event.type.JobExecutionEvent) Test(org.junit.Test)

Example 10 with Condition

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition in project elastic-job by dangdangdotcom.

the class JobEventRdbSearchTest method assertFindJobStatusTraceEventsWithFields.

@Test
public void assertFindJobStatusTraceEventsWithFields() {
    Map<String, Object> fields = new HashMap<>();
    fields.put("jobName", "test_job_1");
    Result<JobStatusTraceEvent> result = repository.findJobStatusTraceEvents(new Condition(10, 1, null, null, null, null, fields));
    assertThat(result.getTotal(), is(1));
    assertThat(result.getRows().size(), is(1));
}
Also used : Condition(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition) HashMap(java.util.HashMap) JobStatusTraceEvent(com.dangdang.ddframe.job.event.type.JobStatusTraceEvent) Test(org.junit.Test)

Aggregations

Condition (com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch.Condition)15 Test (org.junit.Test)14 JobExecutionEvent (com.dangdang.ddframe.job.event.type.JobExecutionEvent)7 JobStatusTraceEvent (com.dangdang.ddframe.job.event.type.JobStatusTraceEvent)7 HashMap (java.util.HashMap)4 Date (java.util.Date)3 SimpleDateFormat (java.text.SimpleDateFormat)1