use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class HistoricProcessInstanceTest method testHistoricProcessInstanceName.
@Deployment(resources = { "org/activiti/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testHistoricProcessInstanceName() {
String piName = "Customized Process Instance Name";
ProcessInstanceBuilder builder = runtimeService.createProcessInstanceBuilder();
builder.processDefinitionKey("oneTaskProcess");
builder.processInstanceName(piName);
ProcessInstance processInstance1 = builder.start();
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance1.getProcessInstanceId()).singleResult();
assertEquals(piName, historicProcessInstance.getName());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceName(piName).list().size());
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class ProcessInstanceMigrationTest method testSetProcessDefinitionVersion.
@Deployment
public void testSetProcessDefinitionVersion() {
// start process instance
ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask");
// check that receive task has been reached
Execution execution = runtimeService.createExecutionQuery().processInstanceId(pi.getId()).activityId("waitState1").singleResult();
assertNotNull(execution);
// deploy new version of the process definition
org.activiti.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource(TEST_PROCESS).deploy();
assertEquals(2, repositoryService.createProcessDefinitionQuery().count());
// migrate process instance to new process definition version
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
commandExecutor.execute(new SetProcessDefinitionVersionCmd(pi.getId(), 2));
// signal process instance
runtimeService.signal(execution.getId());
// check that the instance now uses the new process definition version
ProcessDefinition newProcessDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionVersion(2).singleResult();
pi = runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult();
assertEquals(newProcessDefinition.getId(), pi.getProcessDefinitionId());
// check history
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstance historicPI = historyService.createHistoricProcessInstanceQuery().processInstanceId(pi.getId()).singleResult();
assertEquals(newProcessDefinition.getId(), historicPI.getProcessDefinitionId());
List<HistoricActivityInstance> historicActivities = historyService.createHistoricActivityInstanceQuery().processInstanceId(pi.getId()).unfinished().list();
assertEquals(1, historicActivities.size());
assertEquals(newProcessDefinition.getId(), historicActivities.get(0).getProcessDefinitionId());
}
// undeploy "manually" deployed process definition
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class PlaybackProcessStartTest method demoCheckStatus.
public void demoCheckStatus() {
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());
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class PlaybackProcessStartTest method messageProcessStartCheckStatus.
public void messageProcessStartCheckStatus() {
final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().singleResult();
assertNotNull(historicProcessInstance);
assertTrue(startsWith(historicProcessInstance.getProcessDefinitionId(), "messageStartEventProcess"));
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class PlaybackProcessStartTest method userTaskCheckStatus.
public void userTaskCheckStatus() {
final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().singleResult();
assertNotNull(historicProcessInstance);
assertEquals("oneTaskProcessBusinessKey", historicProcessInstance.getBusinessKey());
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
assertEquals("user1", historicTaskInstance.getAssignee());
}
Aggregations