use of org.xmlunit.validation.ValidationResult in project syndesis by syndesisio.
the class UnifiedXmlDataShapeGeneratorShapeValidityTest method shouldGenerateValidOutputSchemasets.
@Test
public void shouldGenerateValidOutputSchemasets() throws IOException {
final DataShape output = generator.createShapeFromResponse(specificationContent, swagger, operation);
if (output.getKind() != DataShapeKinds.XML_SCHEMA) {
return;
}
final Validator validator = Validator.forLanguage(Languages.W3C_XML_SCHEMA_NS_URI);
try (InputStream in = UnifiedXmlDataShapeGenerator.class.getResourceAsStream("/swagger/atlas-xml-schemaset-model-v2.xsd")) {
validator.setSchemaSource(new StreamSource(in));
final String outputSpecification = output.getSpecification();
final ValidationResult result = validator.validateInstance(source(outputSpecification));
//
assertThat(result.isValid()).as("Non valid output XML schemaset was generated for specification: %s, operation: %s, errors: %s", specification, operation.getOperationId(), //
StreamSupport.stream(result.getProblems().spliterator(), false).map(ValidationProblem::toString).collect(//
Collectors.joining("\n"))).isTrue();
}
}
use of org.xmlunit.validation.ValidationResult in project syndesis by syndesisio.
the class UnifiedXmlDataShapeGeneratorShapeValidityTest method shouldGenerateValidInputSchemasets.
@Test
public void shouldGenerateValidInputSchemasets() {
final DataShape input = generator.createShapeFromRequest(specificationContent, swagger, operation);
if (input.getKind() != DataShapeKinds.XML_SCHEMA) {
return;
}
final String inputSpecification = input.getSpecification();
final ValidationResult result = VALIDATOR.validateInstance(source(inputSpecification));
//
assertThat(result.isValid()).as("Non valid input XML schemaset was generated for specification: %s, operation: %s, errors: %s", specification, operation.getOperationId(), //
StreamSupport.stream(result.getProblems().spliterator(), false).map(ValidationProblem::toString).collect(//
Collectors.joining("\n"))).isTrue();
}
Aggregations