@Test public void testGetAlgorithm() throws Exception { var mvcResult = mockMvc.perform(get("/algorithms?name=TEST_DETECTION_ALG")) .andExpect(status().isOk()) .andExpect(jsonPath("$.name").value("TEST_DETECTION_ALG")) .andExpect(jsonPath("$.description").value("Test algorithm for detection.")) .andExpect(jsonPath("$.actionType").value("DETECTION")) .andReturn(); var algorithm = _objectMapper.readValue(mvcResult.getResponse().getContentAsByteArray(), Algorithm.class); var properties = algorithm.getProvidesCollection().getProperties(); assertEquals(2, properties.size()); var algoProp = properties.stream() .filter(p -> p.getName().equals("TEST_ALGO_PROP")) .findAny() .orElse(null); assertNotNull(algoProp); assertEquals("Test algo property", algoProp.getDescription()); assertEquals("TRUE", algoProp.getDefaultValue()); assertEquals(ValueType.BOOLEAN, algoProp.getType()); assertNull(algoProp.getPropertiesKey()); var wfProp = properties.stream() .filter(p -> p.getName().equals("TEST_WF_PROPERTY")) .findAny() .orElse(null); assertNotNull(wfProp); assertEquals("WF PROP DESCR", wfProp.getDescription()); assertEquals("5", wfProp.getDefaultValue()); assertEquals(ValueType.INT, wfProp.getType()); assertNull(wfProp.getPropertiesKey()); }
@RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) public ResponseEntity<Algorithm> getAlgorithm(String name) { return Optional.ofNullable(_pipelineService.getAlgorithm(name)) .map(this::getAlgoWithDefaultValuesSet) .map(p -> new ResponseEntity<>(p, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); }
PipelineController { @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) public ResponseEntity<Algorithm> getAlgorithm(String name) { return Optional.ofNullable(_pipelineService.getAlgorithm(name)) .map(this::getAlgoWithDefaultValuesSet) .map(p -> new ResponseEntity<>(p, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } }
PipelineController { @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) public ResponseEntity<Algorithm> getAlgorithm(String name) { return Optional.ofNullable(_pipelineService.getAlgorithm(name)) .map(this::getAlgoWithDefaultValuesSet) .map(p -> new ResponseEntity<>(p, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } @Inject  PipelineController(
            PropertiesUtil propertiesUtil,
            WorkflowPropertyService workflowPropertyService,
            PipelineService pipelineService); }
PipelineController { @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) public ResponseEntity<Algorithm> getAlgorithm(String name) { return Optional.ofNullable(_pipelineService.getAlgorithm(name)) .map(this::getAlgoWithDefaultValuesSet) .map(p -> new ResponseEntity<>(p, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } @Inject  PipelineController(
            PropertiesUtil propertiesUtil,
            WorkflowPropertyService workflowPropertyService,
            PipelineService pipelineService); @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(InvalidPipelineException.class) @ResponseBody MessageModel invalidPipelineHandler(InvalidPipelineException ex); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available pipelines.") List<Pipeline> getPipelines(); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Pipeline> getPipeline(String name); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.POST) @ApiOperation("Adds a new pipeline.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Pipeline pipeline); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes a pipeline.") void deletePipeline(String name); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available tasks.") List<Task> getTasks(); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Task> getTask(String name); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.POST) @ApiOperation("Adds a new task.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Task task); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes a task.") void deleteTask(String name); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available actions.") List<Action> getActions(); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Action> getAction(String name); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.POST) @ApiOperation("Adds a new action.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Action action); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes an action.") void deleteAction(String name); @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available algorithms.") List<Algorithm> getAlgorithms(); @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Algorithm> getAlgorithm(String name); }
PipelineController { @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) public ResponseEntity<Algorithm> getAlgorithm(String name) { return Optional.ofNullable(_pipelineService.getAlgorithm(name)) .map(this::getAlgoWithDefaultValuesSet) .map(p -> new ResponseEntity<>(p, HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } @Inject  PipelineController(
            PropertiesUtil propertiesUtil,
            WorkflowPropertyService workflowPropertyService,
            PipelineService pipelineService); @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(InvalidPipelineException.class) @ResponseBody MessageModel invalidPipelineHandler(InvalidPipelineException ex); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available pipelines.") List<Pipeline> getPipelines(); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Pipeline> getPipeline(String name); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.POST) @ApiOperation("Adds a new pipeline.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Pipeline pipeline); @RequestMapping(value = { "/pipelines", "/rest/pipelines" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes a pipeline.") void deletePipeline(String name); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available tasks.") List<Task> getTasks(); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Task> getTask(String name); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.POST) @ApiOperation("Adds a new task.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Task task); @RequestMapping(value = { "/tasks", "/rest/tasks" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes a task.") void deleteTask(String name); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available actions.") List<Action> getActions(); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Action> getAction(String name); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.POST) @ApiOperation("Adds a new action.") @ApiResponses(@ApiResponse(code = 400, message = "Invalid request", response = MessageModel.class)) void add(@RequestBody Action action); @RequestMapping(value = { "/actions", "/rest/actions" }, method = RequestMethod.DELETE, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiOperation("Deletes an action.") void deleteAction(String name); @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET) @ApiOperation("Retrieves list of available algorithms.") List<Algorithm> getAlgorithms(); @RequestMapping(value = { "/algorithms", "/rest/algorithms" }, method = RequestMethod.GET, // Uses query string parameter instead of path variable to support names with special characters. params = "name") @ApiResponses(@ApiResponse(code = 404, message = "Not found")) ResponseEntity<Algorithm> getAlgorithm(String name);  }