Search in sources :

Example 66 with HistoricActivityInstance

use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testCaseCallActivity.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testCaseCallActivity.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCaseCallActivity() {
    runtimeService.startProcessInstanceByKey("process");
    String subCaseInstanceId = caseService.createCaseInstanceQuery().singleResult().getId();
    HistoricActivityInstance historicCallActivity = historyService.createHistoricActivityInstanceQuery().activityId("callActivity").singleResult();
    assertEquals(subCaseInstanceId, historicCallActivity.getCalledCaseInstanceId());
    assertNull(historicCallActivity.getEndTime());
    String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
    caseService.completeCaseExecution(humanTaskId);
    historicCallActivity = historyService.createHistoricActivityInstanceQuery().activityId("callActivity").singleResult();
    assertEquals(subCaseInstanceId, historicCallActivity.getCalledCaseInstanceId());
    assertNotNull(historicCallActivity.getEndTime());
}
Also used : HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 67 with HistoricActivityInstance

use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testSignalEventSubprocess.

@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.startEventTypesForEventSubprocess.bpmn20.xml")
public void testSignalEventSubprocess() {
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("shouldThrowError", false);
    runtimeService.startProcessInstanceByKey("process", vars);
    runtimeService.signalEventReceived("newSignal");
    HistoricActivityInstance historicActivity = historyService.createHistoricActivityInstanceQuery().activityId("signalStartEvent").singleResult();
    assertEquals("signalStartEvent", historicActivity.getActivityType());
}
Also used : HashMap(java.util.HashMap) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 68 with HistoricActivityInstance

use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testScopeActivity.

@Deployment
public void testScopeActivity() {
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    query.activityId("userTask");
    assertEquals(1, query.count());
    HistoricActivityInstance historicActivityInstance = query.singleResult();
    assertEquals(pi.getId(), historicActivityInstance.getParentActivityInstanceId());
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId());
    assertProcessEnded(pi.getId());
}
Also used : HistoricActivityInstanceQuery(org.camunda.bpm.engine.history.HistoricActivityInstanceQuery) Task(org.camunda.bpm.engine.task.Task) HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 69 with HistoricActivityInstance

use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testProcessDefinitionKeyProperty.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testProcessDefinitionKeyProperty() {
    // given
    String key = "oneTaskProcess";
    String processInstanceId = runtimeService.startProcessInstanceByKey(key).getId();
    // when
    HistoricActivityInstance activityInstance = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityId("theTask").singleResult();
    // then
    assertNotNull(activityInstance.getProcessDefinitionKey());
    assertEquals(key, activityInstance.getProcessDefinitionKey());
}
Also used : HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 70 with HistoricActivityInstance

use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceTest method testMessageEventSubprocess.

@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.startEventTypesForEventSubprocess.bpmn20.xml")
public void testMessageEventSubprocess() {
    Map<String, Object> vars = new HashMap<String, Object>();
    vars.put("shouldThrowError", false);
    runtimeService.startProcessInstanceByKey("process", vars);
    runtimeService.correlateMessage("newMessage");
    HistoricActivityInstance historicActivity = historyService.createHistoricActivityInstanceQuery().activityId("messageStartEvent").singleResult();
    assertEquals("messageStartEvent", historicActivity.getActivityType());
}
Also used : HashMap(java.util.HashMap) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)80 Deployment (org.camunda.bpm.engine.test.Deployment)56 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)45 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)24 Task (org.camunda.bpm.engine.task.Task)19 Test (org.junit.Test)17 HistoricActivityInstanceQuery (org.camunda.bpm.engine.history.HistoricActivityInstanceQuery)13 HashMap (java.util.HashMap)12 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)8 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)6 Date (java.util.Date)5 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)5 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)5 HistoricTaskInstance (org.camunda.bpm.engine.history.HistoricTaskInstance)4 ArrayList (java.util.ArrayList)3 HistoryService (org.camunda.bpm.engine.HistoryService)3 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)3 Response (com.jayway.restassured.response.Response)2 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)2 HistoricVariableInstanceQuery (org.camunda.bpm.engine.history.HistoricVariableInstanceQuery)2