Search in sources :

Example 71 with Deployment

use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.

the class SpringTransactionIntegrationTest method testTransactionRollbackInServiceTask.

@Deployment
public void testTransactionRollbackInServiceTask() throws Exception {
    runtimeService.startProcessInstanceByKey("txRollbackServiceTask");
    waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
    Job job = managementService.createJobQuery().singleResult();
    assertNotNull(job);
    assertEquals(0, job.getRetries());
    assertEquals("Transaction rolled back because it has been marked as rollback-only", job.getExceptionMessage());
    String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
    assertNotNull(stacktrace);
    assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("Transaction rolled back because it has been marked as rollback-only"));
}
Also used : Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 72 with Deployment

use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.

the class SpringTransactionIntegrationTest method testTransactionRollbackInServiceTaskWithCustomRetryCycle.

@Deployment
public void testTransactionRollbackInServiceTaskWithCustomRetryCycle() throws Exception {
    runtimeService.startProcessInstanceByKey("txRollbackServiceTaskWithCustomRetryCycle");
    waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
    Job job = managementService.createJobQuery().singleResult();
    assertNotNull(job);
    assertEquals(0, job.getRetries());
    assertEquals("Transaction rolled back because it has been marked as rollback-only", job.getExceptionMessage());
    String stacktrace = managementService.getJobExceptionStacktrace(job.getId());
    assertNotNull(stacktrace);
    assertTrue("unexpected stacktrace, was <" + stacktrace + ">", stacktrace.contains("Transaction rolled back because it has been marked as rollback-only"));
}
Also used : Job(org.camunda.bpm.engine.runtime.Job) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 73 with Deployment

use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.

the class SpringTransactionIntegrationTest method testErrorPropagationOnExceptionInTransaction.

@Deployment(resources = { "org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.testErrorPropagationOnExceptionInTransaction.bpmn20.xml", "org/camunda/bpm/engine/spring/test/transaction/SpringTransactionIntegrationTest.throwExceptionProcess.bpmn20.xml" })
public void testErrorPropagationOnExceptionInTransaction() {
    runtimeService.startProcessInstanceByKey("process");
    waitForJobExecutorToProcessAllJobs(WAIT_TIME_MILLIS);
    Incident incident = runtimeService.createIncidentQuery().activityId("servicetask").singleResult();
    assertThat(incident.getIncidentMessage(), is("error"));
}
Also used : Incident(org.camunda.bpm.engine.runtime.Incident) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 74 with Deployment

use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.

the class SpringJobExecutorTest method testRollbackJobExecutorPath.

@Deployment(resources = { "org/camunda/bpm/engine/spring/test/components/SpringTimersProcess.bpmn20.xml", "org/camunda/bpm/engine/spring/test/components/SpringJobExecutorRollBack.bpmn20.xml" })
public void testRollbackJobExecutorPath() throws Exception {
    // shutdown job executor first, otherwise waitForJobExecutorToProcessAllJobs will not actually start it....
    processEngineConfiguration.getJobExecutor().shutdown();
    ProcessInstance instance = runtimeService.startProcessInstanceByKey("errorProcess1");
    assertNotNull(instance);
    waitForJobExecutorToProcessAllJobs(10000);
    List<Task> activeTasks = taskService.createTaskQuery().processInstanceId(instance.getId()).list();
    assertTrue(activeTasks.size() == 1);
}
Also used : Task(org.camunda.bpm.engine.task.Task) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 75 with Deployment

use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.

the class DelegationAuthorizationTest method testCustomStartFormHandlerExecutesQuery.

@Deployment
public void testCustomStartFormHandlerExecutesQuery() {
    // given
    startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5);
    String processDefinitionId = selectProcessDefinitionByKey(DEFAULT_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_DEFINITION, DEFAULT_PROCESS_KEY, userId, READ);
    // when
    StartFormData startFormData = formService.getStartFormData(processDefinitionId);
    // then
    assertNotNull(startFormData);
    assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION);
    assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.getUserId());
    assertEquals(Long.valueOf(5), MyDelegationService.INSTANCES_COUNT);
}
Also used : StartFormData(org.camunda.bpm.engine.form.StartFormData) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

Deployment (org.camunda.bpm.engine.test.Deployment)3376 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1325 Task (org.camunda.bpm.engine.task.Task)788 Test (org.junit.Test)635 HashMap (java.util.HashMap)441 Job (org.camunda.bpm.engine.runtime.Job)310 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)277 VariableInstance (org.camunda.bpm.engine.runtime.VariableInstance)265 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)256 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)251 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)230 VariableInstanceQuery (org.camunda.bpm.engine.runtime.VariableInstanceQuery)206 TaskQuery (org.camunda.bpm.engine.task.TaskQuery)195 Execution (org.camunda.bpm.engine.runtime.Execution)189 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)175 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)161 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)149 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)143 ExecutionAssert.describeExecutionTree (org.camunda.bpm.engine.test.util.ExecutionAssert.describeExecutionTree)134 ExecutionTree (org.camunda.bpm.engine.test.util.ExecutionTree)134