Search in sources :

Example 26 with JobDefinitionCreateRequest

use of org.finra.herd.model.api.xml.JobDefinitionCreateRequest in project herd by FINRAOS.

the class ExecuteJdbcTestHelper method prepareHerdDatabaseForExecuteJdbcWithReceiveTaskTest.

/**
 * Prepares Herd database for ExecuteJdbcWithReceiveTask test by creating and persisting a test job definition entity.
 *
 * @param jobDefinitionNamespace the namespace for the job definition
 * @param jobDefinitionName the name of the job definition
 * @param activitiXmlClasspathResourceName the Activiti XML classpath resource location
 *
 * @throws Exception
 */
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void prepareHerdDatabaseForExecuteJdbcWithReceiveTaskTest(String jobDefinitionNamespace, String jobDefinitionName, String activitiXmlClasspathResourceName) throws Exception {
    // Create the test namespace entity.
    namespaceDaoTestHelper.createNamespaceEntity(jobDefinitionNamespace);
    // Create a job definition create request.
    JobDefinitionCreateRequest jobDefinitionCreateRequest = new JobDefinitionCreateRequest();
    jobDefinitionCreateRequest.setNamespace(jobDefinitionNamespace);
    jobDefinitionCreateRequest.setJobName(jobDefinitionName);
    jobDefinitionCreateRequest.setDescription("This is a test job definition.");
    jobDefinitionCreateRequest.setActivitiJobXml(IOUtils.toString(resourceLoader.getResource(activitiXmlClasspathResourceName).getInputStream()));
    jobDefinitionCreateRequest.setParameters(null);
    // Create and persist a valid test job definition.
    jobDefinitionService.createJobDefinition(jobDefinitionCreateRequest, false);
}
Also used : JobDefinitionCreateRequest(org.finra.herd.model.api.xml.JobDefinitionCreateRequest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

JobDefinitionCreateRequest (org.finra.herd.model.api.xml.JobDefinitionCreateRequest)26 Test (org.junit.Test)19 JobDefinition (org.finra.herd.model.api.xml.JobDefinition)9 Parameter (org.finra.herd.model.api.xml.Parameter)5 BpmnModel (org.activiti.bpmn.model.BpmnModel)4 EndEvent (org.activiti.bpmn.model.EndEvent)4 Process (org.activiti.bpmn.model.Process)4 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)4 StartEvent (org.activiti.bpmn.model.StartEvent)4 JobCreateRequest (org.finra.herd.model.api.xml.JobCreateRequest)4 JobDefinitionUpdateRequest (org.finra.herd.model.api.xml.JobDefinitionUpdateRequest)4 JobDefinitionEntity (org.finra.herd.model.jpa.JobDefinitionEntity)4 ArrayList (java.util.ArrayList)3 ScriptTask (org.activiti.bpmn.model.ScriptTask)3 Job (org.finra.herd.model.api.xml.Job)3 S3PropertiesLocation (org.finra.herd.model.api.xml.S3PropertiesLocation)3 InputStream (java.io.InputStream)2 AlreadyExistsException (org.finra.herd.model.AlreadyExistsException)2 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)2 Transactional (org.springframework.transaction.annotation.Transactional)1