@Ignore("https: @Test public void testInstance() throws Exception { final String source = "header1,header2,header3\n" + "l1r1,l1r2,l1r3\n" + "l2r1,l2r2,l2r3\n" + "l3r1,l3r2,l3r3\n"; DfdlInspectionRequest request = new DfdlInspectionRequest(); request.setType(InspectionType.INSTANCE); request.setDfdlSchemaName("csv"); request.getOptions().put(CsvDfdlSchemaGenerator.Options.EXAMPLE.value(), source); request.getOptions().put(CsvDfdlSchemaGenerator.Options.DELIMITER.value(), ","); Response res = dfdlService.inspect(request); Object entity = res.getEntity(); assertEquals(byte[].class, entity.getClass()); DfdlInspectionResponse inspectionResponse = Json.mapper().readValue((byte[])entity, DfdlInspectionResponse.class); XmlDocument xmlDoc = inspectionResponse.getXmlDocument(); assertEquals(1, xmlDoc.getFields().getField().size()); XmlComplexType root = (XmlComplexType) xmlDoc.getFields().getField().get(0); assertNotNull(root); assertEquals(1, xmlDoc.getFields().getField().size()); XmlComplexType file = (XmlComplexType) xmlDoc.getFields().getField().get(0); assertEquals("tns:file", file.getName()); assertEquals(2, file.getXmlFields().getXmlField().size()); XmlComplexType record = (XmlComplexType) file.getXmlFields().getXmlField().get(1); assertEquals("tns:record", record.getName()); assertEquals(3, record.getXmlFields().getXmlField().size()); XmlField header1 = (XmlField) record.getXmlFields().getXmlField().get(0); assertEquals("tns:header1", header1.getName()); assertEquals(FieldType.STRING, header1.getFieldType()); XmlField header2 = (XmlField) record.getXmlFields().getXmlField().get(1); assertEquals("tns:header2", header2.getName()); assertEquals(FieldType.STRING, header2.getFieldType()); XmlField header3 = (XmlField) record.getXmlFields().getXmlField().get(2); assertEquals("tns:header3", header3.getName()); assertEquals(FieldType.STRING, header3.getFieldType()); }
@POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) public Response inspect(InputStream request) { return inspect(fromJson(request, DfdlInspectionRequest.class)); }
DfdlService { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) public Response inspect(InputStream request) { return inspect(fromJson(request, DfdlInspectionRequest.class)); } }
DfdlService { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) public Response inspect(InputStream request) { return inspect(fromJson(request, DfdlInspectionRequest.class)); }  }
DfdlService { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) public Response inspect(InputStream request) { return inspect(fromJson(request, DfdlInspectionRequest.class)); }  @GET @Path("/simple") @Produces(MediaType.TEXT_PLAIN) @Operation(summary = "Simple", description = "Simple hello service") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class)), description = "Return a response")) String simpleHelloWorld(@QueryParam("from") String from); @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) Response inspect(InputStream request); Response inspect(DfdlInspectionRequest request); }
DfdlService { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) public Response inspect(InputStream request) { return inspect(fromJson(request, DfdlInspectionRequest.class)); }  @GET @Path("/simple") @Produces(MediaType.TEXT_PLAIN) @Operation(summary = "Simple", description = "Simple hello service") @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = String.class)), description = "Return a response")) String simpleHelloWorld(@QueryParam("from") String from); @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Path("/inspect") @Operation(summary = "Inspect DFDL", description = "Inspect a DFDL schema or instance and return a Document object") @RequestBody(description = "DfdlInspectionRequest object", content = @Content(schema = @Schema(implementation = DfdlInspectionRequest.class))) @ApiResponses(@ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = DfdlInspectionResponse.class)), description = "Return a Document object represented by XmlDocument")) Response inspect(InputStream request); Response inspect(DfdlInspectionRequest request);  }