当前位置: 首页>>代码示例>>Java>>正文


Java HistoricProcessInstance.getProcessVariables方法代码示例

本文整理汇总了Java中org.activiti.engine.history.HistoricProcessInstance.getProcessVariables方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstance.getProcessVariables方法的具体用法?Java HistoricProcessInstance.getProcessVariables怎么用?Java HistoricProcessInstance.getProcessVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.history.HistoricProcessInstance的用法示例。


在下文中一共展示了HistoricProcessInstance.getProcessVariables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJob

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private Map<String, Object> createJob(String clusterName, String dryRun, String contentType, String emrClusterDefinitionOverride) throws Exception
{
    List<Parameter> parameters = new ArrayList<>();
    parameters.add(new Parameter("clusterName", clusterName));
    parameters.add(new Parameter("dryRun", dryRun));
    parameters.add(new Parameter("contentType", contentType));
    parameters.add(new Parameter("emrClusterDefinitionOverride", emrClusterDefinitionOverride));

    // Run a job with Activiti XML that will start cluster.
    Job job = jobServiceTestHelper.createJobForCreateCluster(ACTIVITI_XML_CREATE_CLUSTER_WITH_CLASSPATH, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    return hisInstance.getProcessVariables();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:CreateEmrClusterTest.java

示例2: testCheckCluster

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCheckCluster() throws Exception
{
    // Run a job with Activiti XML that will start cluster, check status and terminate.
    Job job = jobServiceTestHelper.createJobForCreateCluster(ACTIVITI_XML_CHECK_CLUSTER_WITH_CLASSPATH, getParameters(true, "", "false"));
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    //check to be sure fields exist.  These should exist whether verbose is set or not
    assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_ID));
    assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS));
    assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_CREATION_TIME));
    assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_READY_TIME));
    assertTrue(variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_END_TIME));
    assertTrue(
        variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS_CHANGE_REASON_CODE));
    assertTrue(
        variables.containsKey(taskName + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + CheckEmrCluster.VARIABLE_EMR_CLUSTER_STATUS_CHANGE_REASON_MESSAGE));
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:23,代码来源:CheckEmrClusterTest.java

示例3: testCheckClusterByRetrieveInstanceFleets

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCheckClusterByRetrieveInstanceFleets() throws Exception
{
    // Run a job with Activiti XML that will start cluster, check status and terminate.
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();

    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    Job job =
        jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(true, "true", "true"));
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();
    String emrClusterInstanceFleetJson = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "instance_fleets");
    assertNotNull(emrClusterInstanceFleetJson);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:22,代码来源:CheckEmrClusterTest.java

示例4: createJobAndCheckStepStatusSuccess

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private void createJobAndCheckStepStatusSuccess(String activitiXml, List<Parameter> parameters) throws Exception
{
    Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String addStepServiceTaskStatus =
        (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + ActivitiRuntimeHelper.VARIABLE_STATUS);
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, addStepServiceTaskStatus);

    String addStepId = (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + BaseAddEmrStep.VARIABLE_EMR_STEP_ID);
    assertNotNull(addStepId);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:AddEmrStepsTest.java

示例5: testCheckClusterByClusterIdStepId

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
/**
 * This method tests the check EMR cluster activiti task with cluster Id and step Id specified
 */
@Test
public void testCheckClusterByClusterIdStepId() throws Exception
{
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();

    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    // Run a job with Activiti XML that will start cluster, check status and terminate.
    Job job =
        jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(true, "false", "false"));
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
    assertEquals(hiveStepId, emrStepId);
    String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
    assertNull(emrStepJarLocation);

    String shellStepId = (String) variables.get("addShellStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(shellStepId);
    String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
    assertEquals(shellStepId, activeStepId);
    String activeStepJarLocation =
        (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_jarLocation");
    assertNull(activeStepJarLocation);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:37,代码来源:CheckEmrClusterTest.java

示例6: testCheckClusterByClusterIdStepIdVerbose

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
/**
 * This method tests the check EMR cluster activiti task with cluster Id and step Id specified
 */
@Test
public void testCheckClusterByClusterIdStepIdVerbose() throws Exception
{
    // Run a job with Activiti XML that will start cluster, check status and terminate.
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();

    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    Job job =
        jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(true, "true", "false"));
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(hiveStepId);
    String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
    assertEquals(hiveStepId, emrStepId);
    String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
    assertNotNull(emrStepJarLocation);

    String shellStepId = (String) variables.get("addShellStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(shellStepId);
    String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
    assertEquals(shellStepId, activeStepId);
    String activeStepJarLocation =
        (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_jarLocation");
    assertNotNull(activeStepJarLocation);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:38,代码来源:CheckEmrClusterTest.java

示例7: testCheckClusterByClusterIdStepIdNoActiveStep

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCheckClusterByClusterIdStepIdNoActiveStep() throws Exception
{
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();

    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    // Run a job with Activiti XML that will start cluster, check status and terminate.
    Job job =
        jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), getParameters(false, "false", "false"));
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(hiveStepId);
    String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
    assertEquals(hiveStepId, emrStepId);
    String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
    assertNull(emrStepJarLocation);

    String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
    assertNull(activeStepId);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:30,代码来源:CheckEmrClusterTest.java

示例8: testCheckClusterByClusterIdStepIdActiveStepHasNoId

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCheckClusterByClusterIdStepIdActiveStepHasNoId() throws Exception
{
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();
    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    List<Parameter> parameters = new ArrayList<>();
    parameters.add(new Parameter("clusterName", "testCluster1"));
    parameters.add(new Parameter("hiveStepName", "a_hive_step"));
    parameters.add(new Parameter("hiveScriptLocation", "a_hive_step_location"));
    parameters.add(new Parameter("shellStepName", MockEmrOperationsImpl.MOCK_STEP_RUNNING_WITHOUT_ID_NAME));
    parameters.add(new Parameter("shellScriptLocation", "a_shell_step_location"));
    parameters.add(new Parameter("verbose", "false"));
    parameters.add(new Parameter("retrieveInstanceFleets", "false"));

    // Run a job with Activiti XML that will start cluster, check status and terminate.
    Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(hiveStepId);
    String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
    assertEquals(hiveStepId, emrStepId);
    String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
    assertNull(emrStepJarLocation);

    String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
    assertNull(activeStepId);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:37,代码来源:CheckEmrClusterTest.java

示例9: createJobAndCheckTaskStatusSuccess

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private Job createJobAndCheckTaskStatusSuccess(String activitiXml, List<Parameter> parameters, Map<String, Object> variableValuesToValidate)
    throws Exception
{
    Job job = jobServiceTestHelper.createJobFromActivitiXml(activitiXml, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String serviceTaskStatus = (String) variables.get(getServiceTaskVariableName(ActivitiRuntimeHelper.VARIABLE_STATUS));
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, serviceTaskStatus);

    if (variableValuesToValidate != null)
    {
        for (Map.Entry<String, Object> varEntry : variableValuesToValidate.entrySet())
        {
            Object wfVariableValue = variables.get(getServiceTaskVariableName(varEntry.getKey()));
            Object expectedVariableValue = varEntry.getValue();
            if (expectedVariableValue.equals(VARIABLE_VALUE_NOT_NULL))
            {
                assertNotNull(wfVariableValue);
            }
            else if (expectedVariableValue.equals(VARIABLE_VALUE_IS_NULL))
            {
                assertNull(wfVariableValue);
            }
            else
            {
                assertEquals(expectedVariableValue, wfVariableValue);
            }
        }
    }

    return job;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:37,代码来源:HerdActivitiServiceTaskTest.java

示例10: createJobAndCheckTaskStatusFailure

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private Job createJobAndCheckTaskStatusFailure(String activitiXml, List<Parameter> parameters, Map<String, Object> variableValuesToValidate)
    throws Exception
{
    Job job = jobServiceTestHelper.createJobFromActivitiXml(activitiXml, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String serviceTaskStatus = (String) variables.get(getServiceTaskVariableName(ActivitiRuntimeHelper.VARIABLE_STATUS));
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_ERROR, serviceTaskStatus);

    if (variableValuesToValidate != null)
    {
        for (Map.Entry<String, Object> varEntry : variableValuesToValidate.entrySet())
        {
            Object wfVariableValue = variables.get(getServiceTaskVariableName(varEntry.getKey()));
            Object expectedVariableValue = varEntry.getValue();
            if (expectedVariableValue.equals(VARIABLE_VALUE_NOT_NULL))
            {
                assertNotNull(wfVariableValue);
            }
            else if (expectedVariableValue.equals(VARIABLE_VALUE_IS_NULL))
            {
                assertNull(wfVariableValue);
            }
            else
            {
                assertEquals(expectedVariableValue, wfVariableValue);
            }
        }
    }

    return job;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:37,代码来源:HerdActivitiServiceTaskTest.java

示例11: createJobAndCheckStepStatusFailure

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
private void createJobAndCheckStepStatusFailure(String activitiXml, List<Parameter> parameters) throws Exception
{
    Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String addStepServiceTaskStatus =
        (String) variables.get("addStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + ActivitiRuntimeHelper.VARIABLE_STATUS);
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_ERROR, addStepServiceTaskStatus);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:14,代码来源:AddEmrStepsTest.java

示例12: executeJob

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
/**
 * Executes the Activiti job with the given parameters and returns variables. The parameters are as defined in the documentation.
 *
 * @param businessObjectDefinitionName the business object definition name.
 * @param businessObjectFormatUsage the business object format usage.
 * @param fileTypeCode the file type code.
 * @param partitionKey the partition key.
 * @param partitionValue the partition value.
 * @param subPartitionValues the sub-partition values.
 * @param businessObjectFormatVersion the business object format version (optional).
 * @param businessObjectDataVersion the business object data version (optional).
 *
 * @return map of variable name to variable value
 * @throws Exception
 */
private Map<String, Object> executeJob(String namespace, String businessObjectDefinitionName, String businessObjectFormatUsage, String fileTypeCode,
    String partitionKey, String partitionValue, String subPartitionValues, String businessObjectFormatVersion, String businessObjectDataVersion)
    throws Exception
{
    // Prepare input data
    List<FieldExtension> fieldExtensionList = new ArrayList<>();
    if (namespace != null)
    {
        fieldExtensionList.add(buildFieldExtension("namespace", "${businessObjectDefinitionNamespace}"));
    }
    fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
    fieldExtensionList.add(buildFieldExtension("partitionKey", "${partitionKey}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));

    List<Parameter> parameters = new ArrayList<>();
    if (namespace != null)
    {
        parameters.add(buildParameter("businessObjectDefinitionNamespace", namespace));
    }
    parameters.add(buildParameter("businessObjectDefinitionName", businessObjectDefinitionName));
    parameters.add(buildParameter("businessObjectFormatUsage", businessObjectFormatUsage));
    parameters.add(buildParameter("businessObjectFormatFileType", fileTypeCode));
    parameters.add(buildParameter("partitionKey", partitionKey));
    parameters.add(buildParameter("partitionValue", partitionValue));
    parameters.add(buildParameter("subPartitionValues", subPartitionValues));
    parameters.add(buildParameter("businessObjectFormatVersion", businessObjectFormatVersion));
    parameters.add(buildParameter("businessObjectDataVersion", businessObjectDataVersion));

    String activitiXml = buildActivitiXml(IMPLEMENTATION, fieldExtensionList);

    // Execute job
    Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    return hisInstance.getProcessVariables();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:59,代码来源:GetBusinessObjectDataTest.java

示例13: testCheckClusterByClusterIdStepIdRequestedStepHasNoId

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
/**
 * This method tests the check EMR cluster activiti task with cluster Id and step Id specified and requested step contains no id in response
 */
@Test
public void testCheckClusterByClusterIdStepIdRequestedStepHasNoId() throws Exception
{
    List<FieldExtension> fieldExtensions = getOptionalFieldExtensions();
    FieldExtension fieldExtension = new FieldExtension();
    fieldExtension.setFieldName("emrStepId");
    fieldExtension.setExpression("${addHiveStepServiceTask_emrStepId}");
    fieldExtensions.add(fieldExtension);

    List<Parameter> parameters = new ArrayList<>();
    parameters.add(new Parameter("clusterName", "testCluster1"));
    parameters.add(new Parameter("hiveStepName", MockEmrOperationsImpl.MOCK_STEP_WITHOUT_ID_NAME));
    parameters.add(new Parameter("hiveScriptLocation", "a_hive_step_location"));
    parameters.add(new Parameter("shellStepName", MockEmrOperationsImpl.MOCK_STEP_RUNNING_NAME));
    parameters.add(new Parameter("shellScriptLocation", "a_shell_step_location"));
    parameters.add(new Parameter("verbose", "false"));
    parameters.add(new Parameter("retrieveInstanceFleets", "false"));

    // Run a job with Activiti XML that will start cluster, check status and terminate.
    Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(getCheckClusterActivitiXml(fieldExtensions), parameters);
    assertNotNull(job);

    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    String hiveStepId = (String) variables.get("addHiveStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(hiveStepId);
    String emrStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_id");
    assertNull(emrStepId);
    String emrStepJarLocation = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "step_jarLocation");
    assertNull(emrStepJarLocation);

    String shellStepId = (String) variables.get("addShellStepServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "emrStepId");
    assertNotNull(shellStepId);
    String activeStepId = (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_id");
    assertEquals(shellStepId, activeStepId);
    String activeStepJarLocation =
        (String) variables.get("checkClusterServiceTask" + ActivitiRuntimeHelper.TASK_VARIABLE_MARKER + "activeStep_jarLocation");
    assertNull(activeStepJarLocation);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:45,代码来源:CheckEmrClusterTest.java

示例14: testCreateBusinessObjectDataAttribute

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCreateBusinessObjectDataAttribute() throws Exception
{
    // Create a business object data key.
    BusinessObjectDataKey businessObjectDataKey =
        new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES,
            DATA_VERSION);

    // Create a business object data entity.
    businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);

    List<FieldExtension> fieldExtensionList = new ArrayList<>();

    fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAttributeValue", "${businessObjectDataAttributeValue}"));

    List<Parameter> parameters = new ArrayList<>();

    parameters.add(buildParameter("namespace", BDEF_NAMESPACE));
    parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME));
    parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE));
    parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE));
    parameters.add(buildParameter("businessObjectFormatVersion", FORMAT_VERSION.toString()));
    parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
    parameters.add(buildParameter("subPartitionValues", herdStringHelper.buildStringWithDefaultDelimiter(SUBPARTITION_VALUES)));
    parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
    parameters.add(buildParameter("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));
    parameters.add(buildParameter("businessObjectDataAttributeValue", ATTRIBUTE_VALUE_1));

    // Run the activiti task.
    String activitiXml = buildActivitiXml(CreateBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList);
    Job job = jobServiceTestHelper.createJobFromActivitiXml(activitiXml, parameters);
    assertNotNull(job);
    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    // Validate status.
    String serviceTaskStatus = (String) variables.get(getServiceTaskVariableName(ActivitiRuntimeHelper.VARIABLE_STATUS));
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, serviceTaskStatus);

    // Retrieve JSON response.
    String jsonResponse = (String) variables.get(getServiceTaskVariableName(BaseJavaDelegate.VARIABLE_JSON_RESPONSE));
    ObjectMapper objectMapper = new ObjectMapper();
    BusinessObjectDataAttribute businessObjectDataAttribute = objectMapper.readValue(jsonResponse.getBytes(), BusinessObjectDataAttribute.class);

    // Validate JSON response.
    assertEquals(BDEF_NAMESPACE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getNamespace());
    assertEquals(BDEF_NAME, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDefinitionName());
    assertEquals(FORMAT_USAGE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatUsage());
    assertEquals(FORMAT_FILE_TYPE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatFileType());
    assertEquals(FORMAT_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatVersion());
    assertEquals(PARTITION_VALUE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getPartitionValue());
    assertEquals(SUBPARTITION_VALUES, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getSubPartitionValues());
    assertEquals(DATA_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataVersion());
    assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataAttributeName());
    assertEquals(ATTRIBUTE_VALUE_1, businessObjectDataAttribute.getBusinessObjectDataAttributeValue());
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:67,代码来源:CreateBusinessObjectDataAttributeTest.java

示例15: testCreateBusinessObjectDataAttributeMissingOptionalParameters

import org.activiti.engine.history.HistoricProcessInstance; //导入方法依赖的package包/类
@Test
public void testCreateBusinessObjectDataAttributeMissingOptionalParameters() throws Exception
{
    // Create a business object data key without sub-partition values.
    BusinessObjectDataKey businessObjectDataKey =
        new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE,
            NO_SUBPARTITION_VALUES, DATA_VERSION);

    // Create a business object data entity.
    businessObjectDataDaoTestHelper.createBusinessObjectDataEntity(businessObjectDataKey, LATEST_VERSION_FLAG_SET, BDATA_STATUS);

    List<FieldExtension> fieldExtensionList = new ArrayList<>();

    fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
    fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
    fieldExtensionList.add(buildFieldExtension("businessObjectDataAttributeName", "${businessObjectDataAttributeName}"));

    List<Parameter> parameters = new ArrayList<>();

    parameters.add(buildParameter("namespace", BDEF_NAMESPACE));
    parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME));
    parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE));
    parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE));
    parameters.add(buildParameter("businessObjectFormatVersion", FORMAT_VERSION.toString()));
    parameters.add(buildParameter("partitionValue", PARTITION_VALUE));
    parameters.add(buildParameter("businessObjectDataVersion", DATA_VERSION.toString()));
    parameters.add(buildParameter("businessObjectDataAttributeName", ATTRIBUTE_NAME_1_MIXED_CASE));

    // Run the activiti task.
    String activitiXml = buildActivitiXml(CreateBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList);
    Job job = jobServiceTestHelper.createJobFromActivitiXml(activitiXml, parameters);
    assertNotNull(job);
    HistoricProcessInstance hisInstance =
        activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
    Map<String, Object> variables = hisInstance.getProcessVariables();

    // Validate status.
    String serviceTaskStatus = (String) variables.get(getServiceTaskVariableName(ActivitiRuntimeHelper.VARIABLE_STATUS));
    assertEquals(ActivitiRuntimeHelper.TASK_STATUS_SUCCESS, serviceTaskStatus);

    // Retrieve JSON response.
    String jsonResponse = (String) variables.get(getServiceTaskVariableName(BaseJavaDelegate.VARIABLE_JSON_RESPONSE));
    ObjectMapper objectMapper = new ObjectMapper();
    BusinessObjectDataAttribute businessObjectDataAttribute = objectMapper.readValue(jsonResponse.getBytes(), BusinessObjectDataAttribute.class);

    // Validate JSON response.
    assertEquals(BDEF_NAMESPACE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getNamespace());
    assertEquals(BDEF_NAME, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDefinitionName());
    assertEquals(FORMAT_USAGE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatUsage());
    assertEquals(FORMAT_FILE_TYPE_CODE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatFileType());
    assertEquals(FORMAT_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectFormatVersion());
    assertEquals(PARTITION_VALUE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getPartitionValue());
    assertEquals(NO_SUBPARTITION_VALUES, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getSubPartitionValues());
    assertEquals(DATA_VERSION, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataVersion());
    assertEquals(ATTRIBUTE_NAME_1_MIXED_CASE, businessObjectDataAttribute.getBusinessObjectDataAttributeKey().getBusinessObjectDataAttributeName());
    assertNull(businessObjectDataAttribute.getBusinessObjectDataAttributeValue());
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:63,代码来源:CreateBusinessObjectDataAttributeTest.java


注:本文中的org.activiti.engine.history.HistoricProcessInstance.getProcessVariables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。