Search in sources :

Example 71 with Job

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

the class ActivitiDelegateTest method testActivitiUnReportableError.

/**
 * This method tests the scenario when an workflow related error is throws while workflow is executing an Async type task like Timer. This error is logged
 * as WARN.
 */
@Test(expected = ActivitiException.class)
public void testActivitiUnReportableError() throws Exception {
    BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);
    ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");
    serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
    serviceTask.setImplementation("${BeanNotAvailable}");
    jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
    Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, null));
    org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
    if (timer != null) {
        executeWithoutLogging(TimerExecuteNestedActivityJobHandler.class, () -> {
            activitiManagementService.executeJob(timer.getId());
        });
    }
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask) Job(org.finra.herd.model.api.xml.Job) BpmnModel(org.activiti.bpmn.model.BpmnModel) Test(org.junit.Test) HerdActivitiServiceTaskTest(org.finra.herd.service.activiti.task.HerdActivitiServiceTaskTest)

Aggregations

Job (org.finra.herd.model.api.xml.Job)71 Test (org.junit.Test)60 Parameter (org.finra.herd.model.api.xml.Parameter)30 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)21 ArrayList (java.util.ArrayList)20 FieldExtension (org.activiti.bpmn.model.FieldExtension)11 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)11 Task (org.activiti.engine.task.Task)9 BusinessObjectDataKey (org.finra.herd.model.api.xml.BusinessObjectDataKey)9 ObjectNotFoundException (org.finra.herd.model.ObjectNotFoundException)8 JobDefinition (org.finra.herd.model.api.xml.JobDefinition)7 JobDeleteRequest (org.finra.herd.model.api.xml.JobDeleteRequest)7 JobSignalRequest (org.finra.herd.model.api.xml.JobSignalRequest)7 S3PropertiesLocation (org.finra.herd.model.api.xml.S3PropertiesLocation)7 AccessDeniedException (org.springframework.security.access.AccessDeniedException)7 JobAction (org.finra.herd.model.api.xml.JobAction)6 JobUpdateRequest (org.finra.herd.model.api.xml.JobUpdateRequest)6 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)6 ApplicationUser (org.finra.herd.model.dto.ApplicationUser)6 SecurityUserWrapper (org.finra.herd.model.dto.SecurityUserWrapper)6