use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class AddBusinessObjectDataStorageUnitTest method testAddBusinessObjectDataStorageUnitUsingJsonRequest.
@Test
public void testAddBusinessObjectDataStorageUnitUsingJsonRequest() throws Exception {
BusinessObjectDataStorageUnitCreateRequest businessObjectDataStorageUnitCreateRequest = businessObjectDataServiceTestHelper.getBusinessObjectDataStorageUnitCreateRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataStorageUnitCreateRequest", "${businessObjectDataStorageUnitCreateRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "json"));
parameters.add(buildParameter("businessObjectDataStorageUnitCreateRequest", jsonHelper.objectToJson(businessObjectDataStorageUnitCreateRequest)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_NOT_NULL);
testActivitiServiceTaskSuccess(AddBusinessObjectDataStorageUnit.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class AddEmrStepsTest method testAddHadoopJarStep.
@Test
public void testAddHadoopJarStep() throws Exception {
List<FieldExtension> fieldExtensionList = new ArrayList<>();
FieldExtension exceptionField = new FieldExtension();
exceptionField.setFieldName("jarLocation");
exceptionField.setExpression("${jarLocation}");
fieldExtensionList.add(exceptionField);
exceptionField = new FieldExtension();
exceptionField.setFieldName("mainClass");
exceptionField.setExpression("${mainClass}");
fieldExtensionList.add(exceptionField);
exceptionField = new FieldExtension();
exceptionField.setFieldName("scriptArguments");
exceptionField.setExpression("${scriptArguments}");
fieldExtensionList.add(exceptionField);
List<Parameter> parameters = new ArrayList<>(getCommonParameters("Hadoop jar Step"));
Parameter parameter = new Parameter("jarLocation", "s3://test-bucket-managed/app-a/test/hadoop-mapreduce-examples-2.4.0.jar");
parameters.add(parameter);
parameter = new Parameter("mainClass", "wordcount");
parameters.add(parameter);
parameter = new Parameter("scriptArguments", "arg1|arg/|withpipe|arg2|arg3");
parameters.add(parameter);
testActivitiAddEmrStepSuccess(AddEmrHadoopJarStep.class.getCanonicalName(), fieldExtensionList, parameters);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class ActivitiDelegateTest method testActivitiReportableError.
/**
* This method tests the scenario when an error that is not workflow related is throws while workflow is executing an Async type task like Timer. This error
* is logged as ERROR.
*/
@Test(expected = ActivitiException.class)
public void testActivitiReportableError() throws Exception {
BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
FieldExtension exceptionField = new FieldExtension();
exceptionField.setFieldName("exceptionToThrow");
exceptionField.setExpression("${exceptionToThrow}");
serviceTask.getFieldExtensions().add(exceptionField);
jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
List<Parameter> parameters = new ArrayList<>();
Parameter parameter = new Parameter("exceptionToThrow", MockJavaDelegate.EXCEPTION_BPMN_ERROR);
parameters.add(parameter);
Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, parameters));
org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
if (timer != null) {
executeWithoutLogging(Arrays.asList(ActivitiRuntimeHelper.class, TimerExecuteNestedActivityJobHandler.class), () -> {
activitiManagementService.executeJob(timer.getId());
});
}
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class AddEmrMasterSecurityGroupTest method testAddEmrMasterSecurityGroup.
@Test
public void testAddEmrMasterSecurityGroup() throws Exception {
// Create a pipe-separated list of security group IDs.
final String securityGroupIds = EC2_SECURITY_GROUP_1 + "|" + EC2_SECURITY_GROUP_2;
// Create EC2 on-demand pricing entities required for testing.
ec2OnDemandPricingDaoTestHelper.createEc2OnDemandPricingEntities();
// Create the namespace entity.
NamespaceEntity namespaceEntity = namespaceDaoTestHelper.createNamespaceEntity(NAMESPACE);
// Create a trusting AWS account.
trustingAccountDaoTestHelper.createTrustingAccountEntity(AWS_ACCOUNT_ID, AWS_ROLE_ARN);
// Create an EMR cluster definition.
emrClusterDefinitionDaoTestHelper.createEmrClusterDefinitionEntity(namespaceEntity, EMR_CLUSTER_DEFINITION_NAME, IOUtils.toString(resourceLoader.getResource(EMR_CLUSTER_DEFINITION_XML_FILE_WITH_CLASSPATH).getInputStream()));
// Create an EMR cluster definition override with an AWS account ID.
EmrClusterDefinition emrClusterDefinitionOverride = new EmrClusterDefinition();
emrClusterDefinitionOverride.setAccountId(AWS_ACCOUNT_ID);
// Create an EMR cluster.
emrService.createCluster(new EmrClusterCreateRequest(NAMESPACE, EMR_CLUSTER_DEFINITION_NAME, EMR_CLUSTER_NAME, NO_DRY_RUN, emrClusterDefinitionOverride));
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}"));
fieldExtensionList.add(buildFieldExtension("emrClusterDefinitionName", "${emrClusterDefinitionName}"));
fieldExtensionList.add(buildFieldExtension("emrClusterName", "${emrClusterName}"));
fieldExtensionList.add(buildFieldExtension("securityGroupIds", "${securityGroupIds}"));
fieldExtensionList.add(buildFieldExtension("accountId", "${accountId}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("namespace", NAMESPACE));
parameters.add(buildParameter("emrClusterDefinitionName", EMR_CLUSTER_DEFINITION_NAME));
parameters.add(buildParameter("emrClusterName", EMR_CLUSTER_NAME));
parameters.add(buildParameter("securityGroupIds", securityGroupIds));
parameters.add(buildParameter("accountId", AWS_ACCOUNT_ID));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(AddEmrMasterSecurityGroup.VARIABLE_EMR_MASTER_SECURITY_GROUPS, securityGroupIds);
testActivitiServiceTaskSuccess(AddEmrMasterSecurityGroup.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class UpdateBusinessObjectDataStatusTest method testUpdateBusinessObjectDataStatus.
@Test
public void testUpdateBusinessObjectDataStatus() 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);
// Create a business object data status entity.
businessObjectDataStatusDaoTestHelper.createBusinessObjectDataStatusEntity(BDATA_STATUS_2);
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("businessObjectDataStatus", "${businessObjectDataStatus}"));
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("businessObjectDataStatus", BDATA_STATUS_2));
// Build the expected response object.
BusinessObjectDataStatusUpdateResponse expectedBusinessObjectDataStatusUpdateResponse = new BusinessObjectDataStatusUpdateResponse(businessObjectDataKey, BDATA_STATUS_2, BDATA_STATUS);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(UpdateBusinessObjectDataStatus.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataStatusUpdateResponse));
testActivitiServiceTaskSuccess(UpdateBusinessObjectDataStatus.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
}
Aggregations