@Test public void testinValidSyntax() throws Exception { ContentHandle content = resourceToContentHandle("wsdl-invalid-syntax.wsdl"); WsdlContentValidator validator = new WsdlContentValidator(); Assertions.assertThrows(InvalidContentException.class, () -> { validator.validate(ValidityLevel.SYNTAX_ONLY, content); }); }
@Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { Document wsdlDoc = DocumentBuilderAccessor.getDocumentBuilder().parse(stream); if (level == ValidityLevel.FULL) { WSDLReaderAccessor.getWSDLReader().readWSDL(null, wsdlDoc); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for WSDL Schema artifact.", e); } } }
WsdlContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { Document wsdlDoc = DocumentBuilderAccessor.getDocumentBuilder().parse(stream); if (level == ValidityLevel.FULL) { WSDLReaderAccessor.getWSDLReader().readWSDL(null, wsdlDoc); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for WSDL Schema artifact.", e); } } } }
WsdlContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { Document wsdlDoc = DocumentBuilderAccessor.getDocumentBuilder().parse(stream); if (level == ValidityLevel.FULL) { WSDLReaderAccessor.getWSDLReader().readWSDL(null, wsdlDoc); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for WSDL Schema artifact.", e); } } } WsdlContentValidator(); }
WsdlContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { Document wsdlDoc = DocumentBuilderAccessor.getDocumentBuilder().parse(stream); if (level == ValidityLevel.FULL) { WSDLReaderAccessor.getWSDLReader().readWSDL(null, wsdlDoc); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for WSDL Schema artifact.", e); } } } WsdlContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent); }
WsdlContentValidator extends XmlContentValidator { @Override public void validate(ValidityLevel level, ContentHandle artifactContent) throws InvalidContentException { if (level == ValidityLevel.SYNTAX_ONLY || level == ValidityLevel.FULL) { try (InputStream stream = artifactContent.stream()) { Document wsdlDoc = DocumentBuilderAccessor.getDocumentBuilder().parse(stream); if (level == ValidityLevel.FULL) { WSDLReaderAccessor.getWSDLReader().readWSDL(null, wsdlDoc); } } catch (Exception e) { throw new InvalidContentException("Syntax violation for WSDL Schema artifact.", e); } } } WsdlContentValidator(); @Override void validate(ValidityLevel level, ContentHandle artifactContent);  }