@Test @WithMockUser(authorities = { "VIEW_ENDPOINT" }) public void getEndpoint() { Endpoint endpoint = endpointsApiController.getEndpoint("12").getBody(); assertTrue(endpoint.getId().equals("12")); assertTrue(endpoint.getMethod().equals(Endpoint.MethodEnum.PUT)); assertTrue(endpoint.getPath().equals("/foo")); }
@Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") public ResponseEntity<Endpoint> getEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint endpoint; try { endpoint = endpointConverter.convert(endpointService.getEndpoint(endpointId)); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } return new ResponseEntity(endpoint, HttpStatus.OK); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") public ResponseEntity<Endpoint> getEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint endpoint; try { endpoint = endpointConverter.convert(endpointService.getEndpoint(endpointId)); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } return new ResponseEntity(endpoint, HttpStatus.OK); } }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") public ResponseEntity<Endpoint> getEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint endpoint; try { endpoint = endpointConverter.convert(endpointService.getEndpoint(endpointId)); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } return new ResponseEntity(endpoint, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") public ResponseEntity<Endpoint> getEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint endpoint; try { endpoint = endpointConverter.convert(endpointService.getEndpoint(endpointId)); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } return new ResponseEntity(endpoint, 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('VIEW_ENDPOINT')") public ResponseEntity<Endpoint> getEndpoint(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); Endpoint endpoint; try { endpoint = endpointConverter.convert(endpointService.getEndpoint(endpointId)); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } return new ResponseEntity(endpoint, 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);  }