use of eu.esdihumboldt.hale.io.jdbc.spatialite.reader.internal.SpatiaLiteSchemaReader in project hale by halestudio.
the class SpatiaLiteTestSuite method readSchema.
/**
* Reads a schema from a SpatiaLite database file.
*
* @param sourceFilePath the path to the source database file
* @return the schema
* @throws Exception any exception thrown by {@link SpatiaLiteSchemaReader}
*/
public Schema readSchema(String sourceFilePath) throws Exception {
SpatiaLiteSchemaReader schemaReader = new SpatiaLiteSchemaReader();
schemaReader.setSource(new FileIOSupplier(new File(sourceFilePath)));
IOReport report = schemaReader.execute(new LogProgressIndicator());
assertTrue(report.isSuccess());
return schemaReader.getSchema();
}
use of eu.esdihumboldt.hale.io.jdbc.spatialite.reader.internal.SpatiaLiteSchemaReader in project hale by halestudio.
the class SpatiaLiteTestSuite method schemaReaderTest.
/**
* Test - reads a sample SpatiaLite schema
*
* @throws Exception if an error occurs
*/
public void schemaReaderTest() throws Exception {
if (!isSpatiaLiteExtensionAvailable()) {
log.info("Skipping test because SpatiaLite extension is not available");
return;
}
Set<String> propertyNames = new HashSet<String>(Arrays.asList(SOUURCE_TYPE_PROPERTY_NAMES));
SpatiaLiteSchemaReader schemaReader = new SpatiaLiteSchemaReader();
schemaReader.setSource(new FileIOSupplier(new File(getSourceTempFilePath())));
IOReport report = schemaReader.execute(new LogProgressIndicator());
assertTrue(report.isSuccess());
Schema schema = schemaReader.getSchema();
assertEquals(1, schema.getMappingRelevantTypes().size());
TypeDefinition type = schema.getMappingRelevantTypes().iterator().next();
checkType(type, SOUURCE_TYPE_LOCAL_NAME, propertyNames);
}
Aggregations