use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class GetExpectedPartitionValueTest method testGetExpectedPartitionValueMissingOptionalParameters.
/**
* This unit test does not pass optional parameters.
*/
@Test
public void testGetExpectedPartitionValueMissingOptionalParameters() throws Exception {
// Create and persist a partition key group entity.
PartitionKeyGroupEntity partitionKeyGroupEntity = partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP);
// Create and persist a list of expected partition values.
expectedPartitionValueDaoTestHelper.createExpectedPartitionValueEntities(partitionKeyGroupEntity, expectedPartitionValueDaoTestHelper.getTestUnsortedExpectedPartitionValues());
// Get a sorted list of expected partition values.
List<String> testSortedExpectedPartitionValues = expectedPartitionValueDaoTestHelper.getTestSortedExpectedPartitionValues();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension(GetExpectedPartitionValue.VARIABLE_PARTITION_KEY_GROUP_NAME, "${partitionKeyGroupName}"));
fieldExtensionList.add(buildFieldExtension(GetExpectedPartitionValue.VARIABLE_EXPECTED_PARTITION_VALUE, "${expectedPartitionValue}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter(GetExpectedPartitionValue.VARIABLE_PARTITION_KEY_GROUP_NAME, PARTITION_KEY_GROUP));
parameters.add(buildParameter(GetExpectedPartitionValue.VARIABLE_EXPECTED_PARTITION_VALUE, testSortedExpectedPartitionValues.get(TEST_EXPECTED_PARTITION_VALUE_INDEX)));
// Retrieve and validate the expected partition value information.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GetExpectedPartitionValue.VARIABLE_PARTITION_KEY_GROUP_NAME, PARTITION_KEY_GROUP);
variableValuesToValidate.put(GetExpectedPartitionValue.VARIABLE_EXPECTED_PARTITION_VALUE, testSortedExpectedPartitionValues.get(TEST_EXPECTED_PARTITION_VALUE_INDEX));
testActivitiServiceTaskSuccess(GetExpectedPartitionValue.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class InvalidateUnregisteredBusinessObjectDataTest method testInvalidateUnregisteredBusinessObjectDataSuccessJson.
/**
* Tests a standard request that is valid JSON.
*
* @throws Exception
*/
@Test
public void testInvalidateUnregisteredBusinessObjectDataSuccessJson() throws Exception {
// The test request
BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE);
// The expected response
BusinessObjectDataInvalidateUnregisteredResponse expectedResponse = getExpectedBusinessObjectDataInvalidateUnregisteredResponse(request);
// Setup format
businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request);
// Construct Activiti parameters
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataInvalidateUnregisteredRequest", "${businessObjectDataInvalidateUnregisteredRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectDataInvalidateUnregisteredRequest", jsonHelper.objectToJson(request)));
/*
* Assert that:
* Status is SUCCESS
* Error message is not set
* Response is expected JSON
*/
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_STATUS, ActivitiRuntimeHelper.TASK_STATUS_SUCCESS);
variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_ERROR_MESSAGE, VARIABLE_VALUE_IS_NULL);
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedResponse));
testActivitiServiceTaskSuccess(InvalidateUnregisteredBusinessObjectData.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class RegisterBusinessObjectDataTest method testRegisterBusinessObjectDataJson.
@Test
public void testRegisterBusinessObjectDataJson() throws Exception {
BusinessObjectDataCreateRequest businessObjectDataCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataCreateRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataCreateRequest", "${businessObjectDataCreateRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectDataCreateRequest", jsonHelper.objectToJson(businessObjectDataCreateRequest)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(RegisterBusinessObjectData.VARIABLE_ID, VARIABLE_VALUE_NOT_NULL);
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
testActivitiServiceTaskSuccess(RegisterBusinessObjectData.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class CheckEmrClusterTest method testCheckClusterByClusterIdStepIdNoActiveStep.
@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);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class CheckEmrClusterTest method getOptionalFieldExtensions.
private List<FieldExtension> getOptionalFieldExtensions() {
List<FieldExtension> fieldExtensionList = new ArrayList<>();
FieldExtension fieldExtension = new FieldExtension();
fieldExtension.setFieldName("emrClusterId");
fieldExtension.setExpression("${createClusterServiceTask_emrClusterId}");
fieldExtensionList.add(fieldExtension);
fieldExtension = new FieldExtension();
fieldExtension.setFieldName("verbose");
fieldExtension.setExpression("${verbose}");
fieldExtensionList.add(fieldExtension);
fieldExtension = new FieldExtension();
fieldExtension.setFieldName("retrieveInstanceFleets");
fieldExtension.setExpression("${retrieveInstanceFleets}");
fieldExtensionList.add(fieldExtension);
return fieldExtensionList;
}
Aggregations