@Test public void testValidSyntax() throws Exception { ContentHandle contentA = resourceToContentHandle("wsdl-valid.wsdl"); WsdlContentValidator validator = new WsdlContentValidator(); validator.validate(ValidityLevel.SYNTAX_ONLY, contentA); ContentHandle contentB = resourceToContentHandle("wsdl-invalid-semantics.wsdl"); validator.validate(ValidityLevel.SYNTAX_ONLY, contentB); }
@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);  }