Search in sources :

Example 6 with IExecChainContext

use of com.qlangtech.tis.exec.IExecChainContext in project tis by qlangtech.

the class TestTisServlet method testCreateNewTask.

/**
 * 测试执行单表流程触发创建
 */
public void testCreateNewTask() {
    HttpUtils.addMockApply(0, "do_create_new_task", "create_new_task_single_table_index_build_response.json", TestTisServlet.class);
    String collectionName = "search4employee4local";
    Integer taskid = 800;
    String historyId = "666";
    TisServlet tisServlet = new TisServlet();
    IExecChainContext execChainContext = EasyMock.createMock("execChainContext", IExecChainContext.class);
    EasyMock.expect(execChainContext.getWorkflowId()).andReturn(null).anyTimes();
    execChainContext.setAttribute(IParamContext.KEY_TASK_ID, taskid);
    EasyMock.expect(execChainContext.getExecutePhaseRange()).andReturn(ExecutePhaseRange.fullRange());
    EasyMock.expect(execChainContext.hasIndexName()).andReturn(true);
    EasyMock.expect(execChainContext.getIndexName()).andReturn(collectionName);
    EasyMock.expect(execChainContext.getString(IFullBuildContext.KEY_BUILD_HISTORY_TASK_ID)).andReturn(historyId);
    EasyMock.replay(execChainContext);
    Integer newTask = tisServlet.createNewTask(execChainContext);
    assertEquals(taskid, newTask);
    EasyMock.verify(execChainContext);
}
Also used : IExecChainContext(com.qlangtech.tis.exec.IExecChainContext)

Aggregations

IExecChainContext (com.qlangtech.tis.exec.IExecChainContext)6 File (java.io.File)4 IRemoteTaskTrigger (com.qlangtech.tis.fullbuild.indexbuild.IRemoteTaskTrigger)3 RunningStatus (com.qlangtech.tis.fullbuild.indexbuild.RunningStatus)3 DataXJobSubmit (com.qlangtech.tis.datax.DataXJobSubmit)2 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)2 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)2 ExecuteResult (com.qlangtech.tis.exec.ExecuteResult)2 DumpPhaseStatus (com.qlangtech.tis.fullbuild.phasestatus.impl.DumpPhaseStatus)2 ITISRpcService (com.tis.hadoop.rpc.ITISRpcService)2 RpcServiceReference (com.tis.hadoop.rpc.RpcServiceReference)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 TisZkClient (com.qlangtech.tis.TisZkClient)1 FullbuildPhase (com.qlangtech.tis.assemble.FullbuildPhase)1 IHiveConnGetter (com.qlangtech.tis.config.hive.IHiveConnGetter)1 HiveTable (com.qlangtech.tis.config.hive.meta.HiveTable)1 IHiveMetaStore (com.qlangtech.tis.config.hive.meta.IHiveMetaStore)1 CuratorDataXTaskMessage (com.qlangtech.tis.datax.CuratorDataXTaskMessage)1