@Test(expected = BadRequestException.class) @WithMockUser(authorities = { "EDIT_OPENAPI3_ENDPOINT" }) public void updateGeneratedEndpoint() { EndpointUpdate pathAndMethod = new EndpointUpdate(); pathAndMethod.setMethod(EndpointUpdate.MethodEnum.STAR); pathAndMethod.setPath("/test"); endpointsApiController.updateEndpoint("10", pathAndMethod); }
@Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) public ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint ep; try { String method = endpointUpdate.getMethod() == null ? null : endpointUpdate.getMethod().toString(); ep = endpointConverter.convert(endpointService.updateEndpoint(endpointId, method, endpointUpdate.getPath())); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (EndpointService.IllegalGeneratedEndpointUpdateException e) { throw new BadRequestException("Updating is not allowed for generated endpoint " + id); } catch (EndpointAlreadyExistsException e) { throw new ConflictException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } return new ResponseEntity<>(ep, HttpStatus.OK); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) public ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint ep; try { String method = endpointUpdate.getMethod() == null ? null : endpointUpdate.getMethod().toString(); ep = endpointConverter.convert(endpointService.updateEndpoint(endpointId, method, endpointUpdate.getPath())); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (EndpointService.IllegalGeneratedEndpointUpdateException e) { throw new BadRequestException("Updating is not allowed for generated endpoint " + id); } catch (EndpointAlreadyExistsException e) { throw new ConflictException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } return new ResponseEntity<>(ep, HttpStatus.OK); } }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) public ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint ep; try { String method = endpointUpdate.getMethod() == null ? null : endpointUpdate.getMethod().toString(); ep = endpointConverter.convert(endpointService.updateEndpoint(endpointId, method, endpointUpdate.getPath())); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (EndpointService.IllegalGeneratedEndpointUpdateException e) { throw new BadRequestException("Updating is not allowed for generated endpoint " + id); } catch (EndpointAlreadyExistsException e) { throw new ConflictException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } return new ResponseEntity<>(ep, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) public ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint ep; try { String method = endpointUpdate.getMethod() == null ? null : endpointUpdate.getMethod().toString(); ep = endpointConverter.convert(endpointService.updateEndpoint(endpointId, method, endpointUpdate.getPath())); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (EndpointService.IllegalGeneratedEndpointUpdateException e) { throw new BadRequestException("Updating is not allowed for generated endpoint " + id); } catch (EndpointAlreadyExistsException e) { throw new ConflictException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } return new ResponseEntity<>(ep, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") ResponseEntity<Endpoint> getEndpoint(String id); @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) ResponseEntity<Void> deleteEndpoint(String id); @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> addEndpointServiceClients(String id, ServiceClients serviceClients); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<Void> deleteEndpointServiceClients(String id, ServiceClients serviceClients); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) public ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint ep; try { String method = endpointUpdate.getMethod() == null ? null : endpointUpdate.getMethod().toString(); ep = endpointConverter.convert(endpointService.updateEndpoint(endpointId, method, endpointUpdate.getPath())); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (EndpointService.IllegalGeneratedEndpointUpdateException e) { throw new BadRequestException("Updating is not allowed for generated endpoint " + id); } catch (EndpointAlreadyExistsException e) { throw new ConflictException(e); } catch (ClientNotFoundException e) { throw new ConflictException("Client not found for the given endpoint with id: " + id); } return new ResponseEntity<>(ep, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") ResponseEntity<Endpoint> getEndpoint(String id); @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) ResponseEntity<Void> deleteEndpoint(String id); @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> addEndpointServiceClients(String id, ServiceClients serviceClients); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<Void> deleteEndpointServiceClients(String id, ServiceClients serviceClients);  }