use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class DeleteBusinessObjectDataAttributeTest method testDeleteBusinessObjectDataAttributeMissingOptionalParameters.
@Test
public void testDeleteBusinessObjectDataAttributeMissingOptionalParameters() 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 attribute key.
BusinessObjectDataAttributeKey businessObjectDataAttributeKey = businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE);
// Create a business object data attribute entity.
BusinessObjectDataAttributeEntity businessObjectDataAttributeEntity = businessObjectDataAttributeDaoTestHelper.createBusinessObjectDataAttributeEntity(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1);
// Validate that the business object data attribute is created.
assertNotNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey));
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));
// Build the expected response object.
BusinessObjectDataAttribute expectedBusinessObjectDataAttribute = new BusinessObjectDataAttribute(businessObjectDataAttributeEntity.getId(), businessObjectDataAttributeHelper.getBusinessObjectDataAttributeKey(businessObjectDataKey, ATTRIBUTE_NAME_1_MIXED_CASE), ATTRIBUTE_VALUE_1);
// Run the activiti task and validate the returned response object.
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(DeleteBusinessObjectDataAttribute.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(expectedBusinessObjectDataAttribute));
testActivitiServiceTaskSuccess(DeleteBusinessObjectDataAttribute.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
// Validate that the business object data attribute is deleted.
assertNull(businessObjectDataAttributeDao.getBusinessObjectDataAttributeByKey(businessObjectDataAttributeKey));
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class ExecuteJdbcTest method testExecuteJdbcSuccess.
@Test
public void testExecuteJdbcSuccess() throws Exception {
JdbcExecutionRequest jdbcExecutionRequest = jdbcServiceTestHelper.createDefaultUpdateJdbcExecutionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
List<Parameter> parameters = new ArrayList<>();
populateParameters(jdbcExecutionRequest, fieldExtensionList, parameters);
JdbcExecutionResponse expectedJdbcExecutionResponse = new JdbcExecutionResponse();
expectedJdbcExecutionResponse.setStatements(jdbcExecutionRequest.getStatements());
expectedJdbcExecutionResponse.getStatements().get(0).setStatus(JdbcStatementStatus.SUCCESS);
expectedJdbcExecutionResponse.getStatements().get(0).setResult("1");
String expectedJdbcExecutionResponseJson = jsonHelper.objectToJson(expectedJdbcExecutionResponse);
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, expectedJdbcExecutionResponseJson);
testActivitiServiceTaskSuccess(JAVA_DELEGATE_CLASS_NAME, fieldExtensionList, parameters, variableValuesToValidate);
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class ExecuteJdbcTest method testExecuteJdbcErrorValidation.
@Test
public void testExecuteJdbcErrorValidation() throws Exception {
JdbcExecutionRequest jdbcExecutionRequest = jdbcServiceTestHelper.createDefaultUpdateJdbcExecutionRequest();
jdbcExecutionRequest.setConnection(null);
List<FieldExtension> fieldExtensionList = new ArrayList<>();
List<Parameter> parameters = new ArrayList<>();
populateParameters(jdbcExecutionRequest, fieldExtensionList, parameters);
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, VARIABLE_VALUE_IS_NULL);
variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_ERROR_MESSAGE, "JDBC connection is required");
executeWithoutLogging(ActivitiRuntimeHelper.class, () -> {
testActivitiServiceTaskFailure(JAVA_DELEGATE_CLASS_NAME, fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class ExecuteJdbcTest method testExecuteJdbcErrorStatement.
@Test
public void testExecuteJdbcErrorStatement() throws Exception {
JdbcExecutionRequest jdbcExecutionRequest = jdbcServiceTestHelper.createDefaultUpdateJdbcExecutionRequest();
jdbcExecutionRequest.getStatements().get(0).setSql(MockJdbcOperations.CASE_2_SQL);
List<FieldExtension> fieldExtensionList = new ArrayList<>();
List<Parameter> parameters = new ArrayList<>();
populateParameters(jdbcExecutionRequest, fieldExtensionList, parameters);
JdbcExecutionResponse expectedJdbcExecutionResponse = new JdbcExecutionResponse();
expectedJdbcExecutionResponse.setStatements(jdbcExecutionRequest.getStatements());
expectedJdbcExecutionResponse.getStatements().get(0).setStatus(JdbcStatementStatus.ERROR);
expectedJdbcExecutionResponse.getStatements().get(0).setErrorMessage("java.sql.SQLException: test DataIntegrityViolationException cause");
String expectedJdbcExecutionResponseString = jsonHelper.objectToJson(expectedJdbcExecutionResponse);
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(BaseJavaDelegate.VARIABLE_JSON_RESPONSE, expectedJdbcExecutionResponseString);
variableValuesToValidate.put(ActivitiRuntimeHelper.VARIABLE_ERROR_MESSAGE, "There are failed executions. See JSON response for details.");
executeWithoutLogging(ActivitiRuntimeHelper.class, () -> {
testActivitiServiceTaskFailure(JAVA_DELEGATE_CLASS_NAME, fieldExtensionList, parameters, variableValuesToValidate);
});
}
use of org.activiti.bpmn.model.FieldExtension in project herd by FINRAOS.
the class GenerateBusinessObjectDataDdlCollectionTest method testGenerateBusinessObjectDataDdlCollectionXml.
@Test
public void testGenerateBusinessObjectDataDdlCollectionXml() throws Exception {
// Prepare database entities required for testing.
businessObjectDataServiceTestHelper.createDatabaseEntitiesForBusinessObjectDataDdlTesting(AbstractServiceTest.PARTITION_VALUE);
// Prepare the request.
BusinessObjectDataDdlCollectionRequest request = businessObjectDataServiceTestHelper.getTestBusinessObjectDataDdlCollectionRequest();
List<FieldExtension> fieldExtensionList = new ArrayList<>();
fieldExtensionList.add(buildFieldExtension("contentType", "${contentType}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataDdlCollectionRequest", "${businessObjectDataDdlCollectionRequest}"));
List<Parameter> parameters = new ArrayList<>();
parameters.add(buildParameter("contentType", "xml"));
parameters.add(buildParameter("businessObjectDataDdlCollectionRequest", xmlHelper.objectToXml(request)));
Map<String, Object> variableValuesToValidate = new HashMap<>();
variableValuesToValidate.put(GenerateBusinessObjectDataDdlCollection.VARIABLE_DDL_COLLECTION, businessObjectDataServiceTestHelper.getExpectedBusinessObjectDataDdlCollectionResponse().getDdlCollection());
executeWithoutLogging(LogVariables.class, () -> {
testActivitiServiceTaskSuccess(GenerateBusinessObjectDataDdlCollection.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate);
});
}
Aggregations