@Test public void testValidateConfig() throws Exception { ViewArchiveUtility utility = new ViewArchiveUtility(); InputStream configStream = getClass().getClassLoader().getResourceAsStream("test_view.xml"); utility.validateConfig(configStream); }
protected void validateConfig(InputStream configStream) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = getClass().getClassLoader().getResource(VIEW_XSD); Schema schema = schemaFactory.newSchema(schemaUrl); schema.newValidator().validate(new StreamSource(configStream)); }
ViewArchiveUtility { protected void validateConfig(InputStream configStream) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = getClass().getClassLoader().getResource(VIEW_XSD); Schema schema = schemaFactory.newSchema(schemaUrl); schema.newValidator().validate(new StreamSource(configStream)); } }
ViewArchiveUtility { protected void validateConfig(InputStream configStream) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = getClass().getClassLoader().getResource(VIEW_XSD); Schema schema = schemaFactory.newSchema(schemaUrl); schema.newValidator().validate(new StreamSource(configStream)); }  }
ViewArchiveUtility { protected void validateConfig(InputStream configStream) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = getClass().getClassLoader().getResource(VIEW_XSD); Schema schema = schemaFactory.newSchema(schemaUrl); schema.newValidator().validate(new StreamSource(configStream)); }  ViewConfig getViewConfigFromArchive(File archiveFile); ViewConfig getViewConfigFromExtractedArchive(String archivePath, boolean validate); File getFile(String path); FileOutputStream getFileOutputStream(File file); JarInputStream getJarFileStream(File file); }
ViewArchiveUtility { protected void validateConfig(InputStream configStream) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaUrl = getClass().getClassLoader().getResource(VIEW_XSD); Schema schema = schemaFactory.newSchema(schemaUrl); schema.newValidator().validate(new StreamSource(configStream)); }  ViewConfig getViewConfigFromArchive(File archiveFile); ViewConfig getViewConfigFromExtractedArchive(String archivePath, boolean validate); File getFile(String path); FileOutputStream getFileOutputStream(File file); JarInputStream getJarFileStream(File file);  }