Skip to content

Commit

Permalink
Fix imports and spacing.
Browse files Browse the repository at this point in the history
Removed .andDo(print())
  • Loading branch information
corneil committed Nov 26, 2023
1 parent 1bf1052 commit 4a9fbb1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@

package org.springframework.cloud.dataflow.server.repository;

import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Instant;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -239,12 +246,10 @@ public JdbcAggregateJobQueryDao(DataSource dataSource, SchemaService schemaServi
@Override
public Page<JobInstanceExecutions> listJobInstances(String jobName, Pageable pageable) throws NoSuchJobException {
int total = countJobExecutions(jobName);
if(total == 0) {
if (total == 0) {
throw new NoSuchJobException("No Job with that name either current or historic: [" + jobName + "]");
}
List<JobInstanceExecutions> taskJobInstancesForJobName = total > 0
? getTaskJobInstancesForJobName(jobName, pageable)
: Collections.emptyList();
List<JobInstanceExecutions> taskJobInstancesForJobName = getTaskJobInstancesForJobName(jobName, pageable);
return new PageImpl<>(taskJobInstancesForJobName, pageable, total);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,12 @@ public void testJobInstanceControllerConstructorMissingRepository() {
@Test
public void testGetInstanceNotFound() throws Exception {
mockMvc.perform(get("/jobs/instances/1345345345345").accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isNotFound());
}

@Test
public void testGetInstance() throws Exception {
mockMvc.perform(get("/jobs/instances/1").accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.jobInstanceId", equalTo(1)))
.andExpect(jsonPath("$.jobExecutions[0].stepExecutionCount", equalTo(1)))
Expand All @@ -136,7 +134,6 @@ public void testGetInstance() throws Exception {
@Test
public void testGetInstancesByName() throws Exception {
mockMvc.perform(get("/jobs/instances/").param("name", JOB_NAME_ORIG).accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.jobInstanceResourceList[0].jobName", is(JOB_NAME_ORIG)))
.andExpect(jsonPath("$._embedded.jobInstanceResourceList", hasSize(1)));
Expand All @@ -145,7 +142,6 @@ public void testGetInstancesByName() throws Exception {
@Test
public void testGetExecutionsByNameMultipleResult() throws Exception {
mockMvc.perform(get("/jobs/instances/").param("name", JOB_NAME_FOOBAR).accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.jobInstanceResourceList[0].jobName", is(JOB_NAME_FOOBAR)))
.andExpect(jsonPath("$._embedded.jobInstanceResourceList[0].jobExecutions[0].executionId", is(4)))
Expand All @@ -156,7 +152,6 @@ public void testGetExecutionsByNameMultipleResult() throws Exception {
@Test
public void testGetInstanceByNameNotFound() throws Exception {
mockMvc.perform(get("/jobs/instances/").param("name", "BAZ").accept(MediaType.APPLICATION_JSON))
.andDo(print())
.andExpect(status().is4xxClientError())
.andExpect(content().string(containsString("NoSuchJobException")));
}
Expand Down

0 comments on commit 4a9fbb1

Please sign in to comment.