Search in sources :

Example 1 with ExecutionContext

use of com.runwaysdk.system.scheduler.ExecutionContext in project geoprism-registry by terraframe.

the class BusinessObjectImporterTest method mockImport.

private ImportHistory mockImport(BusinessObjectImportConfiguration config) throws Throwable {
    if (config.getDate() == null) {
        config.setDate(new Date());
    }
    config.setImportStrategy(ImportStrategy.NEW_AND_UPDATE);
    DataImportJob job = new DataImportJob();
    job.apply();
    ImportHistory hist = (ImportHistory) job.createNewHistory();
    config.setHistoryId(hist.getOid());
    config.setJobId(job.getOid());
    BusinessType type = config.getType();
    hist.appLock();
    hist.setImportFileId(config.getVaultFileId());
    hist.setConfigJson(config.toJSON().toString());
    hist.setOrganization(type.getOrganization());
    hist.setGeoObjectTypeCode(type.getCode());
    hist.apply();
    ExecutionContext context = MockScheduler.executeJob(job, hist);
    hist = (ImportHistory) context.getHistory();
    return hist;
}
Also used : ExecutionContext(com.runwaysdk.system.scheduler.ExecutionContext) DataImportJob(net.geoprism.registry.etl.DataImportJob) BusinessType(net.geoprism.registry.BusinessType) Date(java.util.Date) ImportHistory(net.geoprism.registry.etl.ImportHistory)

Aggregations

ExecutionContext (com.runwaysdk.system.scheduler.ExecutionContext)1 Date (java.util.Date)1 BusinessType (net.geoprism.registry.BusinessType)1 DataImportJob (net.geoprism.registry.etl.DataImportJob)1 ImportHistory (net.geoprism.registry.etl.ImportHistory)1