use of org.xwiki.filter.filterxml.input.FilterXMLInputProperties in project xwiki-platform by xwiki.
the class AbstractInstanceFilterStreamTest method importFromXML.
protected void importFromXML(String resource, InstanceOutputProperties instanceProperties) throws FilterException {
if (instanceProperties == null) {
instanceProperties = new InstanceOutputProperties();
instanceProperties.setVerbose(false);
}
OutputFilterStream outputFilterStream = this.outputFilterStreamFactory.createOutputFilterStream(instanceProperties);
URL url = getClass().getResource("/filter/" + resource + ".xml");
FilterXMLInputProperties properties = new FilterXMLInputProperties();
properties.setSource(new DefaultURLInputSource(url));
InputFilterStream inputFilterStream = this.xmlInputFilterStreamFactory.createInputFilterStream(properties);
inputFilterStream.read(outputFilterStream.getFilter());
try {
inputFilterStream.close();
} catch (IOException e) {
throw new FilterException("Failed to close input wiki stream", e);
}
try {
outputFilterStream.close();
} catch (IOException e) {
throw new FilterException("Failed to close output wiki stream", e);
}
}
use of org.xwiki.filter.filterxml.input.FilterXMLInputProperties in project xwiki-platform by xwiki.
the class ExtensionInstanceOutputFilterStreamTest method importFromXML.
protected void importFromXML(String resource, InstanceOutputProperties instanceProperties) throws FilterException {
if (instanceProperties == null) {
instanceProperties = new InstanceOutputProperties();
instanceProperties.setVerbose(false);
}
OutputFilterStream outputFilterStream = this.outputFilterStreamFactory.createOutputFilterStream(instanceProperties);
URL url = getClass().getResource("/" + resource + ".xml");
FilterXMLInputProperties properties = new FilterXMLInputProperties();
properties.setSource(new DefaultURLInputSource(url));
InputFilterStream inputFilterStream = this.xmlInputFilterStreamFactory.createInputFilterStream(properties);
inputFilterStream.read(outputFilterStream.getFilter());
try {
inputFilterStream.close();
} catch (IOException e) {
throw new FilterException("Failed to close input wiki stream", e);
}
try {
outputFilterStream.close();
} catch (IOException e) {
throw new FilterException("Failed to close output wiki stream", e);
}
}
Aggregations