Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,11 @@ void testGetComputationRefsWithNoMatchingFilters() throws Exception
.filter(sessionFilter)
.accept(MediaType.APPLICATION_JSON)
.header("Authorization", authHeader)
.queryParam("site", comp.getParmList().get(0).getSiteName())
.queryParam("datatype", comp.getParmList().get(0).getDataType())
.queryParam("site", comp.getParmList().get(0).getSiteId())
.queryParam("datatype", comp.getParmList().get(0).getDataTypeId())
.queryParam("group", "test group")
.queryParam("algorithm", comp.getAlgorithmName())
.queryParam("process", comp.getApplicationName())
.queryParam("algorithm", comp.getAlgorithmId())
.queryParam("process", comp.getAppId())
.queryParam("enabled", false)
.queryParam("interval", comp.getParmList().get(0).getInterval())
.when()
Expand All @@ -347,11 +347,11 @@ void testGetComputationRefsWithNoMatchingFilters() throws Exception
.filter(sessionFilter)
.accept(MediaType.APPLICATION_JSON)
.header("Authorization", authHeader)
.queryParam("site", comp.getParmList().get(0).getSiteName())
.queryParam("datatype", comp.getParmList().get(0).getDataType())
.queryParam("group", comp.getGroupName())
.queryParam("algorithm", comp.getAlgorithmName())
.queryParam("process", comp.getApplicationName())
.queryParam("site", comp.getParmList().get(0).getSiteId())
.queryParam("datatype", comp.getParmList().get(0).getDataTypeId())
.queryParam("group", comp.getGroupId())
.queryParam("algorithm", comp.getAlgorithmId())
.queryParam("process", comp.getAppId())
.queryParam("enabled", comp.isEnabled())
.queryParam("interval", "bi-annual")
.when()
Expand All @@ -361,19 +361,20 @@ void testGetComputationRefsWithNoMatchingFilters() throws Exception
.then()
.log().ifValidationFails(LogDetail.ALL, true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_NOT_FOUND))
.statusCode(is(HttpServletResponse.SC_OK))
.body("size()", is(0))
;

given()
.log().ifValidationFails(LogDetail.ALL, true)
.filter(sessionFilter)
.accept(MediaType.APPLICATION_JSON)
.header("Authorization", authHeader)
.queryParam("site", comp.getParmList().get(0).getSiteName())
.queryParam("datatype", comp.getParmList().get(0).getDataType())
.queryParam("group", comp.getGroupName())
.queryParam("algorithm", "water pressure calc")
.queryParam("process", comp.getApplicationName())
.queryParam("site", comp.getParmList().get(0).getSiteId())
.queryParam("datatype", comp.getParmList().get(0).getDataTypeId())
.queryParam("group", comp.getGroupId())
.queryParam("algorithm", "25")
.queryParam("process", comp.getAppId())
.queryParam("enabled", comp.isEnabled())
.queryParam("interval", comp.getParmList().get(0).getInterval())
.when()
Expand All @@ -383,7 +384,7 @@ void testGetComputationRefsWithNoMatchingFilters() throws Exception
.then()
.log().ifValidationFails(LogDetail.ALL, true)
.assertThat()
.statusCode(is(HttpServletResponse.SC_NOT_FOUND))
.statusCode(is(HttpServletResponse.SC_OK))
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public Response getComputationRefs(
description = "Whether to filter only enabled computations") @QueryParam("enabled") Boolean enabled,
@Parameter(schema = @Schema(implementation = String.class),
description = "Interval code to filter on") @QueryParam("interval") String interval)
throws DbException, WebAppException
throws DbException
{
try (ComputationDAI dai = getLegacyTimeseriesDB().makeComputationDAO())
{
Expand All @@ -125,10 +125,6 @@ public Response getComputationRefs(
compFilter.setIntervalCode(interval);
}
List<ApiComputationRef> computationRefs = map(dai.compEditList(compFilter));
if (computationRefs.isEmpty())
{
throw new DatabaseItemNotFoundException("No computations found matching the filter criteria");
}
return Response.status(HttpServletResponse.SC_OK).entity(computationRefs).build();
}
catch(DbIoException e)
Expand Down
Loading