Search in sources :

Example 31 with HistoricProcessInstance

use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.

the class PlaybackRunTest method checkStatus.

private void checkStatus(ProcessEngine processEngine) {
    HistoryService historyService = processEngine.getHistoryService();
    final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().includeProcessVariables().singleResult();
    assertNotNull(historicProcessInstance);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(historicProcessInstance.getProcessDefinitionId()).singleResult();
    assertEquals(SIMPLEST_PROCESS, processDefinition.getKey());
    assertEquals(1, historicProcessInstance.getProcessVariables().size());
    assertEquals(TEST_VALUE, historicProcessInstance.getProcessVariables().get(TEST_VARIABLE));
    assertEquals(BUSINESS_KEY, historicProcessInstance.getBusinessKey());
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition)

Example 32 with HistoricProcessInstance

use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.

the class SimpleSimulationRunTest method checkStatus.

private void checkStatus(HistoryService historyService) {
    final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().singleResult();
    assertNotNull(historicProcessInstance);
    assertEquals("oneTaskProcessBusinessKey", historicProcessInstance.getBusinessKey());
    HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
    assertEquals("user1", historicTaskInstance.getAssignee());
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance)

Example 33 with HistoricProcessInstance

use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.

the class FullHistoryTest method testQueryHistoricProcessInstanceIncludeBinaryVariable.

/**
    * Test confirming fix for ACT-1731
    */
@Deployment(resources = { "org/activiti/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testQueryHistoricProcessInstanceIncludeBinaryVariable() throws Exception {
    // Start process with a binary variable
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", Collections.singletonMap("binaryVariable", (Object) "It is I, le binary".getBytes()));
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
    assertNotNull(task);
    // Complete task to end process
    taskService.complete(task.getId());
    // Query task, including processVariables
    HistoricProcessInstance historicProcess = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).includeProcessVariables().singleResult();
    assertNotNull(historicProcess);
    assertNotNull(historicProcess.getProcessVariables());
    byte[] bytes = (byte[]) historicProcess.getProcessVariables().get("binaryVariable");
    assertEquals("It is I, le binary", new String(bytes));
}
Also used : Task(org.activiti.engine.task.Task) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Deployment(org.activiti.engine.test.Deployment)

Example 34 with HistoricProcessInstance

use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.

the class HistoricProcessInstanceQueryEscapeClauseTest method testQueryByProcessInstanceNameLike.

@Test
public void testQueryByProcessInstanceNameLike() {
    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
        // processInstanceNameLike
        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceNameLike("%\\%%").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance1.getId(), historicProcessInstance.getId());
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceNameLike("%\\_%").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance2.getId(), historicProcessInstance.getId());
        // orQuery
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceNameLike("%\\%%").processDefinitionId("undefined").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance1.getId(), historicProcessInstance.getId());
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceNameLike("%\\_%").processDefinitionId("undefined").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance2.getId(), historicProcessInstance.getId());
    }
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) Test(org.junit.Test)

Example 35 with HistoricProcessInstance

use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.

the class HistoricProcessInstanceQueryEscapeClauseTest method testQueryByTenantIdLike.

@Test
public void testQueryByTenantIdLike() {
    if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
        // tenantIdLike
        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceTenantIdLike("%\\%%").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance1.getId(), historicProcessInstance.getId());
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceTenantIdLike("%\\_%").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance2.getId(), historicProcessInstance.getId());
        // orQuery
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceTenantIdLike("%\\%%").processDefinitionId("undefined").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance1.getId(), historicProcessInstance.getId());
        historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceTenantIdLike("%\\_%").processDefinitionId("undefined").singleResult();
        assertNotNull(historicProcessInstance);
        assertEquals(processInstance2.getId(), historicProcessInstance.getId());
    }
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) Test(org.junit.Test)

Aggregations

HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)74 Deployment (org.activiti.engine.test.Deployment)34 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)29 Task (org.activiti.engine.task.Task)14 HistoricProcessInstanceQuery (org.activiti.engine.history.HistoricProcessInstanceQuery)9 Item (com.vaadin.data.Item)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 HistoricActivityInstance (org.activiti.engine.history.HistoricActivityInstance)6 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)6 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)6 Test (org.junit.Test)6 Property (com.vaadin.data.Property)4 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)4 Table (com.vaadin.ui.Table)4 Calendar (java.util.Calendar)4 Date (java.util.Date)4 HashSet (java.util.HashSet)4 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3