Search in sources :

Example 1 with MsAccessSchemaReader

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);
}
Also used : Schema(eu.esdihumboldt.hale.common.schema.model.Schema) IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) FileIOSupplier(eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier) LogProgressIndicator(eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator) MsAccessSchemaReader(eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessSchemaReader) TypeDefinition(eu.esdihumboldt.hale.common.schema.model.TypeDefinition)

Example 2 with MsAccessSchemaReader

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();
}
Also used : IOReport(eu.esdihumboldt.hale.common.core.io.report.IOReport) FileIOSupplier(eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier) LogProgressIndicator(eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator) MsAccessSchemaReader(eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessSchemaReader)

Aggregations

LogProgressIndicator (eu.esdihumboldt.hale.common.core.io.impl.LogProgressIndicator)2 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)2 FileIOSupplier (eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier)2 MsAccessSchemaReader (eu.esdihumboldt.hale.io.jdbc.msaccess.MsAccessSchemaReader)2 Schema (eu.esdihumboldt.hale.common.schema.model.Schema)1 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)1