Search in sources :

Example 1 with DefaultTypeIndex

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();
}
Also used : DefaultTypeIndex(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex) XmlSchemaReader(eu.esdihumboldt.hale.io.xsd.reader.XmlSchemaReader) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport)

Example 2 with DefaultTypeIndex

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();
}
Also used : DefaultTypeIndex(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex) DefaultInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport)

Example 3 with DefaultTypeIndex

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();
}
Also used : DefaultTypeIndex(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex) DefaultInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport)

Example 4 with DefaultTypeIndex

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();
}
Also used : DefaultTypeIndex(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport)

Example 5 with DefaultTypeIndex

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();
}
Also used : DefaultTypeIndex(eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex) DefaultInputSupplier(eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier) XmlSchemaReader(eu.esdihumboldt.hale.io.xsd.reader.XmlSchemaReader) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport)

Aggregations

IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)5 DefaultTypeIndex (eu.esdihumboldt.hale.common.schema.model.impl.DefaultTypeIndex)5 DefaultInputSupplier (eu.esdihumboldt.hale.common.core.io.supplier.DefaultInputSupplier)3 XmlSchemaReader (eu.esdihumboldt.hale.io.xsd.reader.XmlSchemaReader)2