Search in sources :

Example 1 with TestParamContext

use of com.qlangtech.tis.fullbuild.taskflow.TestParamContext in project tis by qlangtech.

the class TestIndexSwapTaskflowLauncher method createRangeChainContext.

// 
public static DefaultChainContext createRangeChainContext(String collectionName, FullbuildPhase start, FullbuildPhase end, String... pts) throws Exception {
    TestParamContext params = new TestParamContext();
    params.set(IFullBuildContext.KEY_APP_SHARD_COUNT, String.valueOf(shardCount));
    params.set(IFullBuildContext.KEY_APP_NAME, collectionName);
    params.set(IFullBuildContext.KEY_WORKFLOW_NAME, "totalpay");
    params.set(IFullBuildContext.KEY_WORKFLOW_ID, WF_ID);
    params.set(IExecChainContext.COMPONENT_START, start.getName());
    params.set(IExecChainContext.COMPONENT_END, end.getName());
    final DefaultChainContext chainContext = new DefaultChainContext(params);
    ExecutePhaseRange range = chainContext.getExecutePhaseRange();
    Assert.assertEquals(start, range.getStart());
    Assert.assertEquals(end, range.getEnd());
    Map<IDumpTable, ITabPartition> dateParams = Maps.newHashMap();
    chainContext.setAttribute(ExecChainContextUtils.PARTITION_DATA_PARAMS, new TabPartitions(dateParams));
    chainContext.setAttribute(IExecChainContext.KEY_TASK_ID, TASK_ID);
    // final PluginStore<IndexBuilderTriggerFactory> buildTriggerFactory = TIS.getPluginStore(IndexBuilderTriggerFactory.class);
    // assertNotNull(buildTriggerFactory.getPlugin());
    // if (pts.length > 0) {
    // chainContext.setPs(pts[0]);
    // } else {
    // SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
    // String pt = format.format(new Date());
    // chainContext.setPs(pt);
    // }
    chainContext.setMdcParamContext(() -> {
    });
    return chainContext;
}
Also used : ExecutePhaseRange(com.qlangtech.tis.exec.ExecutePhaseRange) DefaultChainContext(com.qlangtech.tis.exec.impl.DefaultChainContext) ITabPartition(com.qlangtech.tis.fullbuild.indexbuild.ITabPartition) IDumpTable(com.qlangtech.tis.fullbuild.indexbuild.IDumpTable) TabPartitions(com.qlangtech.tis.sql.parser.TabPartitions) TestParamContext(com.qlangtech.tis.fullbuild.taskflow.TestParamContext)

Example 2 with TestParamContext

use of com.qlangtech.tis.fullbuild.taskflow.TestParamContext in project tis by qlangtech.

the class TestIndexSwapTaskflowLauncherWithDataXTrigger method createRangeChainContext.

public static DefaultChainContext createRangeChainContext(FullbuildPhase start, FullbuildPhase end) throws Exception {
    TestParamContext params = new TestParamContext();
    params.set(IFullBuildContext.KEY_APP_NAME, DATAX_NAME);
    params.set(IExecChainContext.COMPONENT_START, start.getName());
    params.set(IExecChainContext.COMPONENT_END, end.getName());
    final DefaultChainContext chainContext = new DefaultChainContext(params);
    ExecutePhaseRange range = chainContext.getExecutePhaseRange();
    Assert.assertEquals(start, range.getStart());
    Assert.assertEquals(end, range.getEnd());
    chainContext.setAttribute(IExecChainContext.KEY_TASK_ID, TASK_ID);
    chainContext.setMdcParamContext(() -> {
    });
    return chainContext;
}
Also used : ExecutePhaseRange(com.qlangtech.tis.exec.ExecutePhaseRange) DefaultChainContext(com.qlangtech.tis.exec.impl.DefaultChainContext) TestParamContext(com.qlangtech.tis.fullbuild.taskflow.TestParamContext)

Aggregations

ExecutePhaseRange (com.qlangtech.tis.exec.ExecutePhaseRange)2 DefaultChainContext (com.qlangtech.tis.exec.impl.DefaultChainContext)2 TestParamContext (com.qlangtech.tis.fullbuild.taskflow.TestParamContext)2 IDumpTable (com.qlangtech.tis.fullbuild.indexbuild.IDumpTable)1 ITabPartition (com.qlangtech.tis.fullbuild.indexbuild.ITabPartition)1 TabPartitions (com.qlangtech.tis.sql.parser.TabPartitions)1