@Test public void testGetMapping() throws Exception { String mappingId = "SampleId2"; WebTarget target = target("/" + MappingOptionListContainer.MAPPINGS + "/" + mappingId); doReturn(new HashMap<String, List<MetadataTransformation>>()).when(metadataTransformationManager).getMetadataTransformations(); Response response = target.request(MediaType.APPLICATION_XML).get(); assertEquals(404, response.getStatus()); }
@GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) public MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId) throws DoesNotExistException { Map<String, List<MetadataTransformation>> metadataTransformationsMap = metadataTransformationManager.getMetadataTransformations(); for (List<MetadataTransformation> metadataTransformations : metadataTransformationsMap.values()) { for (MetadataTransformation metadataTransformation : metadataTransformations) { if (metadataTransformation.getId().toLowerCase().equals(mappingId.toLowerCase())) return metadataTransformation; } } throw new DoesNotExistException("Mapping with id " + mappingId + " does NOT exist!"); }
MappingResource { @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) public MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId) throws DoesNotExistException { Map<String, List<MetadataTransformation>> metadataTransformationsMap = metadataTransformationManager.getMetadataTransformations(); for (List<MetadataTransformation> metadataTransformations : metadataTransformationsMap.values()) { for (MetadataTransformation metadataTransformation : metadataTransformations) { if (metadataTransformation.getId().toLowerCase().equals(mappingId.toLowerCase())) return metadataTransformation; } } throw new DoesNotExistException("Mapping with id " + mappingId + " does NOT exist!"); } }
MappingResource { @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) public MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId) throws DoesNotExistException { Map<String, List<MetadataTransformation>> metadataTransformationsMap = metadataTransformationManager.getMetadataTransformations(); for (List<MetadataTransformation> metadataTransformations : metadataTransformationsMap.values()) { for (MetadataTransformation metadataTransformation : metadataTransformations) { if (metadataTransformation.getId().toLowerCase().equals(mappingId.toLowerCase())) return metadataTransformation; } } throw new DoesNotExistException("Mapping with id " + mappingId + " does NOT exist!"); } MappingResource();  MappingResource(DefaultDataManager dataManager, MetadataTransformationManager metadataTransformationManager, MetadataSchemaManager metadataSchemaManager); }
MappingResource { @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) public MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId) throws DoesNotExistException { Map<String, List<MetadataTransformation>> metadataTransformationsMap = metadataTransformationManager.getMetadataTransformations(); for (List<MetadataTransformation> metadataTransformations : metadataTransformationsMap.values()) { for (MetadataTransformation metadataTransformation : metadataTransformations) { if (metadataTransformation.getId().toLowerCase().equals(mappingId.toLowerCase())) return metadataTransformation; } } throw new DoesNotExistException("Mapping with id " + mappingId + " does NOT exist!"); } MappingResource();  MappingResource(DefaultDataManager dataManager, MetadataTransformationManager metadataTransformationManager, MetadataSchemaManager metadataSchemaManager); @OPTIONS @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Get options over mappings conext.", httpMethod = "OPTIONS", response = MappingOptionListContainer.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a list of all available options)") }) MappingOptionListContainer getOptions(); @GET @Path("/" + MappingOptionListContainer.OPTIONS) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Get options over mappings conext.", httpMethod = "GET", response = MappingOptionListContainer.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a list of all available options)") }) MappingOptionListContainer getGETOptions(); @POST @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes("multipart/mixed") @ApiOperation(value = "Create a new mapping - XSL file through HTTP POST.", httpMethod = "POST", response = String.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "Created (Response containing a String message)"), @ApiResponse(code = 400, message = "InvalidArgumentsException"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 406, message = "MissingArgumentsException"), @ApiResponse(code = 409, message = "AlreadyExistsException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response createMapping(MultiPart multiPart); @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId); @DELETE @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Delete a mapping.", httpMethod = "DELETE", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a String message)"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response deleteMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId); @PUT @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes("multipart/mixed") @ApiOperation(value = "Update a mapping.", httpMethod = "PUT", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a String message)"), @ApiResponse(code = 400, message = "InvalidArgumentsException"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 406, message = "MissingArgumentsException"), @ApiResponse(code = 409, message = "AlreadyExistsException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response updateMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId,
            MultiPart multiPart); }
MappingResource { @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) public MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId) throws DoesNotExistException { Map<String, List<MetadataTransformation>> metadataTransformationsMap = metadataTransformationManager.getMetadataTransformations(); for (List<MetadataTransformation> metadataTransformations : metadataTransformationsMap.values()) { for (MetadataTransformation metadataTransformation : metadataTransformations) { if (metadataTransformation.getId().toLowerCase().equals(mappingId.toLowerCase())) return metadataTransformation; } } throw new DoesNotExistException("Mapping with id " + mappingId + " does NOT exist!"); } MappingResource();  MappingResource(DefaultDataManager dataManager, MetadataTransformationManager metadataTransformationManager, MetadataSchemaManager metadataSchemaManager); @OPTIONS @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Get options over mappings conext.", httpMethod = "OPTIONS", response = MappingOptionListContainer.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a list of all available options)") }) MappingOptionListContainer getOptions(); @GET @Path("/" + MappingOptionListContainer.OPTIONS) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Get options over mappings conext.", httpMethod = "GET", response = MappingOptionListContainer.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a list of all available options)") }) MappingOptionListContainer getGETOptions(); @POST @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes("multipart/mixed") @ApiOperation(value = "Create a new mapping - XSL file through HTTP POST.", httpMethod = "POST", response = String.class) @ApiResponses(value = { @ApiResponse(code = 201, message = "Created (Response containing a String message)"), @ApiResponse(code = 400, message = "InvalidArgumentsException"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 406, message = "MissingArgumentsException"), @ApiResponse(code = 409, message = "AlreadyExistsException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response createMapping(MultiPart multiPart); @GET @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Retrieves the specified mapping.", httpMethod = "GET", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing an Dataset)"), @ApiResponse(code = 404, message = "DoesNotExistException") }) MetadataTransformation getMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId); @DELETE @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @ApiOperation(value = "Delete a mapping.", httpMethod = "DELETE", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a String message)"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response deleteMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId); @PUT @Path("/" + MappingOptionListContainer.MAPPINGID) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Consumes("multipart/mixed") @ApiOperation(value = "Update a mapping.", httpMethod = "PUT", response = String.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "OK (Response containing a String message)"), @ApiResponse(code = 400, message = "InvalidArgumentsException"), @ApiResponse(code = 404, message = "DoesNotExistException"), @ApiResponse(code = 406, message = "MissingArgumentsException"), @ApiResponse(code = 409, message = "AlreadyExistsException"), @ApiResponse(code = 500, message = "InternalServerErrorException") }) Response updateMapping(@ApiParam(value = "Id of mapping", required = true) @PathParam("mappingId") String mappingId,
            MultiPart multiPart); public DefaultDataManager dataManager; public MetadataTransformationManager metadataTransformationManager; public MetadataSchemaManager metadataSchemaManager; }