bean.setTargetTable(targetTable);
ImportProtocolDecide service = new ImportProtocolDecide() {
@Override
protected Map<String, CacheInfo> collectRemoteCacheInfo(ImportBean _)
throws BulkLoaderSystemException {
return Collections.singletonMap("tb1", new CacheInfo(
CacheInfo.FEATURE_VERSION,
tb1.getCacheId(),
last,
"__TG_TEST1",
tb1.getImportTargetColumns(),
tb1.getImportTargetType().getName(),
new ImportTarget1().__tgc__DataModelVersion()));
}
};
service.execute(bean);
assertThat(tb1.getImportProtocol().getKind(), is(FileProtocol.Kind.UPDATE_CACHE));
assertThat(tb1.getImportProtocol().getLocation(), is(tb1.getDfsFilePath()));
assertThat(tb1.getStartTimestamp(), is(notNullValue()));
CacheInfo info = tb1.getImportProtocol().getInfo();
assertThat(info, is(notNullValue()));
assertThat(info.getId(), is("tb1"));
assertThat(info.getFeatureVersion(), is(CacheInfo.FEATURE_VERSION));
assertThat(info.getTimestamp(), is(not(nullValue())));
assertThat(info.getTableName(), is("__TG_TEST1"));
assertThat(info.getColumnNames(), is((Object) new HashSet<String>(tb1.getImportTargetColumns())));
assertThat(info.getModelClassName(), is(ImportTarget1.class.getName()));
assertThat(info.getModelClassVersion(), is(new ImportTarget1().__tgc__DataModelVersion()));
}