use of eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessSchemaReader in project hale by halestudio.
the class MsAccessDataReaderTestSuit method schemaReaderTest.
/**
* Test - reads a sample MsAccess Database schema. UCanAccess lib should not
* throw any error.
*
* @throws Exception if an error occurs
*/
public void schemaReaderTest() throws Exception {
MsAccessSchemaReader schemaReader = new MsAccessSchemaReader();
schemaReader.setSource(new FileIOSupplier(getSourceTempFilePath()));
schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME));
schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD));
IOReport report = schemaReader.execute(new LogProgressIndicator());
assertTrue(report.isSuccess());
TEMP_SOURCE_FILE_NAME = null;
Schema schema = schemaReader.getSchema();
assertTrue(schema != null);
Collection<? extends TypeDefinition> k = schema.getMappingRelevantTypes();
for (TypeDefinition def : k) System.out.println(def.getDisplayName());
checkTables(k);
}
use of eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessSchemaReader in project hale by halestudio.
the class MsAccessDataReaderTestSuit method readSchema.
/**
* Reads a schema from a MsAccess database file.
*
* @param sourceFile the file of the source database.
* @return the schema
* @throws Exception any exception thrown by {@link MsAccessSchemaReader}
*/
public Schema readSchema(File sourceFile) throws Exception {
MsAccessSchemaReader schemaReader = new MsAccessSchemaReader();
schemaReader.setSource(new FileIOSupplier(sourceFile));
schemaReader.setParameter(JDBCSchemaReader.PARAM_USER, Value.of(USER_NAME));
schemaReader.setParameter(JDBCSchemaReader.PARAM_PASSWORD, Value.of(PASSWORD));
IOReport report = schemaReader.execute(new LogProgressIndicator());
assertTrue(report.isSuccess());
return schemaReader.getSchema();
}
Aggregations