Skip to content

Commit

Permalink
it
Browse files Browse the repository at this point in the history
Signed-off-by: mrMoZ1 <[email protected]>
  • Loading branch information
mrMoZ1 committed Nov 25, 2021
1 parent a8ce436 commit 69e7d0a
Showing 1 changed file with 85 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public void setup() {
this.dataJobExecution1 = JobExecutionUtil.createDataJobExecution(
jobExecutionRepository, "testId1", dataJob1, now, now, ExecutionStatus.FINISHED);
this.dataJobExecution2 = JobExecutionUtil.createDataJobExecution(
jobExecutionRepository,"testId2", dataJob2, now.minusSeconds(1), now.minusSeconds(1), ExecutionStatus.RUNNING);
jobExecutionRepository, "testId2", dataJob2, now.minusSeconds(1), now.minusSeconds(1), ExecutionStatus.RUNNING);
this.dataJobExecution3 = JobExecutionUtil.createDataJobExecution(
jobExecutionRepository,"testId3", dataJob3, now.minusSeconds(10), now.minusSeconds(10), ExecutionStatus.SUBMITTED);
jobExecutionRepository, "testId3", dataJob3, now.minusSeconds(10), now.minusSeconds(10), ExecutionStatus.SUBMITTED);
}

private static String getQuery() {
Expand Down Expand Up @@ -116,6 +116,34 @@ public void testExecutions_filterByStartTimeGte() throws Exception {
Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

@Test
public void testExecutions_filterByStartTimeLte() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(JOBS_URI)
.queryParam("query", getQuery())
.param("variables", "{" +
"\"filter\": {" +
" \"startTimeLte\": \"" + dataJobExecution2.getStartTime() + "\"" +
" }," +
"\"pageNumber\": 1," +
"\"pageSize\": 10" +
"}")
.with(user(TEST_USERNAME)))
.andExpect(status().is(200))
.andExpect(content().contentType("application/json"))
.andExpect(jsonPath(
"$.data.content[*].id",
Matchers.contains(dataJobExecution1.getId(), dataJobExecution2.getId())))
.andExpect(jsonPath(
"$.data.content[*].jobName",
Matchers.contains(dataJob1.getName(), dataJob2.getName())))
.andExpect(jsonPath(
"$.data.content[*].status",
Matchers.contains(dataJobExecution1.getStatus().toString(), dataJobExecution2.getStatus().toString())))
.andExpect(jsonPath(
"$.data.content[*].id",
Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

@Test
public void testExecutions_filterByEndTimeGte() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(JOBS_URI)
Expand Down Expand Up @@ -144,6 +172,34 @@ public void testExecutions_filterByEndTimeGte() throws Exception {
Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

@Test
public void testExecutions_filterByEndTimeLte() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(JOBS_URI)
.queryParam("query", getQuery())
.param("variables", "{" +
"\"filter\": {" +
" \"endTimeLte\": \"" + dataJobExecution2.getEndTime() + "\"" +
" }," +
"\"pageNumber\": 1," +
"\"pageSize\": 10" +
"}")
.with(user("user")))
.andExpect(status().is(200))
.andExpect(content().contentType("application/json"))
.andExpect(jsonPath(
"$.data.content[*].id",
Matchers.contains(dataJobExecution1.getId(), dataJobExecution2.getId())))
.andExpect(jsonPath(
"$.data.content[*].jobName",
Matchers.contains(dataJob1.getName(), dataJob2.getName())))
.andExpect(jsonPath(
"$.data.content[*].status",
Matchers.contains(dataJobExecution1.getStatus().toString(), dataJobExecution2.getStatus().toString())))
.andExpect(jsonPath(
"$.data.content[*].id",
Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

@Test
public void testExecutions_filterByStatusIn() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(JOBS_URI)
Expand All @@ -169,4 +225,31 @@ public void testExecutions_filterByStatusIn() throws Exception {
Matchers.contains(dataJobExecution1.getStatus().toString(), dataJobExecution2.getStatus().toString())))
.andExpect(jsonPath("$.data.content[*].id", Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

@Test
public void testExecutions_filterByJobNameIn() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get(JOBS_URI)
.queryParam("query", getQuery())
.param("variables", "{" +
"\"filter\": {" +
" \"jobNameIn\": [\"" + dataJobExecution1.getDataJob().getName() + "\"]" +
" }," +
"\"pageNumber\": 1," +
"\"pageSize\": 10" +
"}")
.with(user("user")))
.andExpect(status().is(200))
.andExpect(content().contentType("application/json"))
.andExpect(jsonPath(
"$.data.content[*].id",
Matchers.contains(dataJobExecution1.getId(), dataJobExecution2.getId())))
.andExpect(jsonPath(
"$.data.content[*].jobName",
Matchers.contains(dataJob1.getName(), dataJob2.getName())))
.andExpect(jsonPath(
"$.data.content[*].status",
Matchers.contains(dataJobExecution1.getStatus().toString(), dataJobExecution2.getStatus().toString())))
.andExpect(jsonPath("$.data.content[*].id", Matchers.not(Matchers.contains(dataJobExecution3.getId()))));
}

}

0 comments on commit 69e7d0a

Please sign in to comment.