Skip to content

Commit

Permalink
feat: report level stub strategy can be updated (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsSmets authored Aug 28, 2024
1 parent e24d746 commit d29c580
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/nl/nn/testtool/web/api/ReportApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public Response getLatestReports(@PathParam("storage") String storageName, @Path
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response updateReport(@PathParam("storage") String storageName, @PathParam("storageId") int storageId, Map<String, String> map) {
String[] fields = new String[]{"name", "path", "variables", "description", "transformation", "checkpointId", "checkpointMessage", "stub"};
String[] fields = new String[]{"name", "path", "variables", "description", "transformation", "checkpointId", "checkpointMessage", "stub", "stubStrategy"};
if (map.isEmpty() || !mapContainsOnly(map, null, fields))
return Response.status(Response.Status.BAD_REQUEST).entity("No new values or incorrect values have been given for report with storageId [" + storageId + "] - detailed error message - Values given are:\n" + map).build();

Expand All @@ -315,6 +315,9 @@ public Response updateReport(@PathParam("storage") String storageName, @PathPara
if (StringUtils.isNotEmpty(map.get("transformation")))
report.setTransformation(map.get("transformation"));

if (StringUtils.isNotEmpty(map.get("stubStrategy")))
report.setStubStrategy(map.get("stubStrategy"));

String variables = map.get("variables");
if (variables != null && !variables.equals(report.getVariableCsv())) {
report.setVariableCsv(variables);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/nl/nn/testtool/web/api/TestToolApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,12 @@ public Response changeNodeLinkStrategy(@QueryParam("nodeLinkStrategy") String no
return Response.ok().build();
}

@GET
@Path("/stub-strategies")
@Consumes(MediaType.APPLICATION_JSON)
public Response getPossibleStubStrategies() {
var strategies = testTool.getStubStrategies();
return Response.ok(strategies).build();
}

}

0 comments on commit d29c580

Please sign in to comment.