VirtualCswApi { @ApiOperation( value = "Get virtual CSW services", notes = "Virtual CSWs are created to easily setup services " + "providing access to records without the need to define filters. For example, " + "in Europe, local, regional and national organizations define entry point " + "for records in the scope of the INSPIRE directive. Those services can then be " + "easily harvested to exchange information. " + "Virtual CSWs do not support transaction. For this use the main " + "catalog CSW service.", nickname = "getAllVirtualCsw") @RequestMapping( produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) @ResponseBody public List<Service> getAllVirtualCsw() throws Exception { return serviceRepository.findAll(); }  @ApiOperation( value = "Get virtual CSW services", notes = "Virtual CSWs are created to easily setup services " + "providing access to records without the need to define filters. For example, " + "in Europe, local, regional and national organizations define entry point " + "for records in the scope of the INSPIRE directive. Those services can then be " + "easily harvested to exchange information. " + "Virtual CSWs do not support transaction. For this use the main " + "catalog CSW service.", nickname = "getAllVirtualCsw") @RequestMapping( produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) @ResponseBody List<Service> getAllVirtualCsw(); @ApiOperation( value = "Get a virtual CSW", notes = "", nickname = "getVirtualCsw") @RequestMapping( path = "/{identifier}", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) @ApiResponses(value = { @ApiResponse(code = 404, message = "Resource not found.") }) @ResponseBody Service getVirtualCsw(
        @ApiParam(
            value = API_PARAM_CSW_SERVICE_IDENTIFIER,
            required = true
        )
        @PathVariable
            int identifier
    ); @ApiOperation( value = "Add a virtual CSW", notes = "The service name MUST be unique. " + "An exception is returned if not the case.", authorizations = { @Authorization(value = "basicAuth") }, nickname = "addVirtualCsw") @RequestMapping( produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PUT ) @ResponseStatus(HttpStatus.CREATED) @PreAuthorize("hasRole('Administrator')") @ApiResponses(value = { @ApiResponse(code = 201, message = "Return the identifier of the newly created service"), @ApiResponse(code = 404, message = "A service already exist with this name") , @ApiResponse(code = 403, message = "Operation not allowed. Only Administrator can access it.") }) @ResponseBody ResponseEntity<Integer> addVirtualCsw(
        @ApiParam(
            value = API_PARAM_CSW_SERVICE_DETAILS,
            required = true
        )
        @RequestBody
            Service service
    ); @ApiOperation( value = "Update a virtual CSW", notes = "", authorizations = { @Authorization(value = "basicAuth") }, nickname = "updateVirtualCsw") @RequestMapping( path = "/{identifier}", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PUT) @ResponseStatus(value = HttpStatus.NO_CONTENT) @PreAuthorize("hasRole('Administrator')") @ApiResponses(value = { @ApiResponse(code = 204, message = "Service updated.") , @ApiResponse(code = 404, message = "Resource not found.") , @ApiResponse(code = 403, message = "Operation not allowed. Only Administrator can access it.") }) void updateVirtualCsw(
        @ApiParam(
            value = API_PARAM_CSW_SERVICE_IDENTIFIER,
            required = true
        )
        @PathVariable
            int identifier,
        @ApiParam(
            value = API_PARAM_CSW_SERVICE_DETAILS,
            required = true
        )
        @RequestBody
            Service service
    ); @ApiOperation( value = "Remove a virtual CSW", notes = "After removal, all virtual CSW configuration is reloaded.", authorizations = { @Authorization(value = "basicAuth") }, nickname = "deleteVirtualCsw") @RequestMapping( path = "/{identifier}", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.DELETE) @ResponseStatus(value = HttpStatus.NO_CONTENT) @PreAuthorize("hasRole('Administrator')") @ApiResponses(value = { @ApiResponse(code = 204, message = "Service removed.") , @ApiResponse(code = 404, message = "Resource not found.") , @ApiResponse(code = 403, message = "Operation not allowed. Only Administrator can access it.") }) void deleteVirtualCsw(
        @ApiParam(
            value = API_PARAM_CSW_SERVICE_IDENTIFIER,
            required = true
        )
        @PathVariable
            int identifier
    ); static final String API_PARAM_CSW_SERVICE_IDENTIFIER; static final String API_PARAM_CSW_SERVICE_DETAILS; }
@Test public void getAllVirtualCsw() throws Exception { List<Service> services = _serviceRepo.findAll(); this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); this.mockMvc.perform(get("/srv/api/csw/virtuals") .accept(MediaType.parseMediaType("application/json"))) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(services.size()))); }