use of com.qlangtech.tis.order.center.IParamContext in project tis by qlangtech.
the class TestDefaultChainContext method testLoadPhaseStatusFromLatest.
public void testLoadPhaseStatusFromLatest() {
IParamContext paramContext = this.mock("paramContext", IParamContext.class);
DefaultChainContext chainContext = new DefaultChainContext(paramContext);
PhaseStatusCollection statusCollection = chainContext.loadPhaseStatusFromLatest(dataXname);
assertNull(statusCollection);
// ./src/test/resources/com/qlangtech/tis/full/dump/cfg_repo/df-logs/66/dump
statusCollection = chainContext.loadPhaseStatusFromLatest(dataXname);
assertNotNull(statusCollection);
DumpPhaseStatus dumpPhase = statusCollection.getDumpPhase();
assertNotNull(dumpPhase);
assertEquals(62, dumpPhase.getTaskId());
String dataXFileName = "instancedetail_0.json";
DumpPhaseStatus.TableDumpStatus dataXExecStatus = dumpPhase.getTable(dataXFileName);
assertNotNull(dataXFileName + " relevant dataX instance can be null", dataXExecStatus);
assertEquals(524525, dataXExecStatus.getReadRows());
assertEquals(1000001, dataXExecStatus.getAllRows());
}
use of com.qlangtech.tis.order.center.IParamContext in project tis by qlangtech.
the class AdapterIndexBuildLifeCycleHook method create.
public static IIndexBuildLifeCycleHook create(ParseResult schemaParse) {
try {
List<IIndexBuildLifeCycleHook> indexBuildLifeCycleHooks = new ArrayList<>();
List<IndexBuildHook> indexBuildHooks = schemaParse.getIndexBuildHooks();
for (IndexBuildHook buildHook : indexBuildHooks) {
Class<?> clazz = Class.forName(buildHook.getFullClassName());
IIndexBuildLifeCycleHook indexBuildHook = (IIndexBuildLifeCycleHook) clazz.newInstance();
if (indexBuildHook instanceof AdapterIndexBuildLifeCycleHook) {
((AdapterIndexBuildLifeCycleHook) indexBuildHook).init(buildHook.getParams());
}
indexBuildLifeCycleHooks.add(indexBuildHook);
}
return new IIndexBuildLifeCycleHook() {
@Override
public void start(IParamContext ctx) {
try {
indexBuildLifeCycleHooks.forEach((e) -> {
e.start(ctx);
});
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
@Override
public void buildFaild(IParamContext ctx) {
try {
indexBuildLifeCycleHooks.forEach((e) -> {
e.buildFaild(ctx);
});
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
@Override
public void buildSuccess(IParamContext ctx) {
try {
indexBuildLifeCycleHooks.forEach((e) -> {
e.buildSuccess(ctx);
});
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
};
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations