use of eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex in project hale by halestudio.
the class OMLReaderTest method readXMLSchema.
/**
* Reads a XML schema
*
* @param input the input supplier
* @return the schema
* @throws IOProviderConfigurationException if the configuration of the
* reader is invalid
* @throws IOException if reading the schema fails
*/
private static Schema readXMLSchema(LocatableInputSupplier<? extends InputStream> input) throws IOProviderConfigurationException, IOException {
XmlSchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(new DefaultTypeIndex());
reader.setSource(input);
reader.validate();
IOReport report = reader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return reader.getSchema();
}
use of eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex in project hale by halestudio.
the class AppSchemaIsolatedWorkspacesMappingTest method loadSchema.
private static Schema loadSchema(SchemaReader schemaReader, String resource) throws Exception {
DefaultInputSupplier input = new DefaultInputSupplier(AppSchemaIsolatedWorkspacesMappingTest.class.getResource(resource).toURI());
schemaReader.setSharedTypes(new DefaultTypeIndex());
schemaReader.setSource(input);
schemaReader.validate();
IOReport report = schemaReader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return schemaReader.getSchema();
}
use of eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex in project hale by halestudio.
the class AppSchemaMappingTest method loadSchema.
private static Schema loadSchema(SchemaReader schemaReader, String resource) throws Exception {
DefaultInputSupplier input = new DefaultInputSupplier(AppSchemaMappingTest.class.getResource(resource).toURI());
schemaReader.setSharedTypes(new DefaultTypeIndex());
schemaReader.setSource(input);
schemaReader.validate();
IOReport report = schemaReader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return schemaReader.getSchema();
}
use of eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex in project hale by halestudio.
the class XmlSchemaReaderTest method readSchema.
/**
* Reads a schema
*
* @param input the input supplier
* @return the schema
* @throws IOProviderConfigurationException if the configuration of the
* reader is invalid
* @throws IOException if reading the schema fails
*/
public static Schema readSchema(LocatableInputSupplier<? extends InputStream> input) throws IOProviderConfigurationException, IOException {
XmlSchemaReader reader = new XmlSchemaReader();
// reader.setContentType(XMLSchemaIO.XSD_CT);
reader.setSharedTypes(new DefaultTypeIndex());
reader.setSource(input);
reader.validate();
IOReport report = reader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return reader.getSchema();
}
use of eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex in project hale by halestudio.
the class TestUtil method loadSchema.
/**
* Loads the specified XML Schema.
*
* @param location the URI specifying the location of the schema
* @return the loaded schema
* @throws IOProviderConfigurationException if the schema reader
* configuration failed
* @throws IOException if the schema could not be loaded
*/
public static Schema loadSchema(URI location) throws IOProviderConfigurationException, IOException {
DefaultInputSupplier input = new DefaultInputSupplier(location);
XmlSchemaReader reader = new XmlSchemaReader();
reader.setSharedTypes(new DefaultTypeIndex());
reader.setSource(input);
reader.validate();
IOReport report = reader.execute(null);
assertTrue(report.isSuccess());
assertTrue("Errors are contained in the report", report.getErrors().isEmpty());
return reader.getSchema();
}
Aggregations