Search in sources :

Example 1 with IParamContext

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());
}
Also used : PhaseStatusCollection(com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection) IParamContext(com.qlangtech.tis.order.center.IParamContext) DefaultChainContext(com.qlangtech.tis.exec.impl.DefaultChainContext) DumpPhaseStatus(com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus)

Example 2 with IParamContext

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);
    }
}
Also used : IParamContext(com.qlangtech.tis.order.center.IParamContext) ArrayList(java.util.ArrayList) IIndexBuildLifeCycleHook(com.qlangtech.tis.exec.lifecycle.hook.IIndexBuildLifeCycleHook) IndexBuildHook(com.qlangtech.tis.solrdao.extend.IndexBuildHook)

Aggregations

IParamContext (com.qlangtech.tis.order.center.IParamContext)2 DefaultChainContext (com.qlangtech.tis.exec.impl.DefaultChainContext)1 IIndexBuildLifeCycleHook (com.qlangtech.tis.exec.lifecycle.hook.IIndexBuildLifeCycleHook)1 PhaseStatusCollection (com.qlangtech.tis.fullbuild.phasestatus.PhaseStatusCollection)1 DumpPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus)1 IndexBuildHook (com.qlangtech.tis.solrdao.extend.IndexBuildHook)1 ArrayList (java.util.ArrayList)1