use of org.finra.herd.model.api.xml.JdbcExecutionRequest 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.finra.herd.model.api.xml.JdbcExecutionRequest in project herd by FINRAOS.
the class ExecuteJdbc method executeImpl.
@Override
public void executeImpl(DelegateExecution execution) throws Exception {
// Construct request from parameters
String contentTypeString = activitiHelper.getRequiredExpressionVariableAsString(contentType, execution, "ContentType");
String requestString = activitiHelper.getRequiredExpressionVariableAsString(jdbcExecutionRequest, execution, "JdbcExecutionRequest").trim();
String receiveTaskIdString = activitiHelper.getExpressionVariableAsString(receiveTaskId, execution);
JdbcExecutionRequest jdbcExecutionRequestObject = getRequestObject(contentTypeString, requestString, JdbcExecutionRequest.class);
if (receiveTaskIdString == null) {
executeSync(execution, null, jdbcExecutionRequestObject);
} else {
executeAsync(execution, jdbcExecutionRequestObject, receiveTaskIdString);
}
}
Aggregations