use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class EventSubscriptionQueryTest method testQueryByExecutionId.
@Deployment
public void testQueryByExecutionId() {
// starting two instances:
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("catchSignal");
runtimeService.startProcessInstanceByKey("catchSignal");
// test query by process instance id
EventSubscriptionEntity subscription = newEventSubscriptionQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(subscription);
Execution executionWaitingForSignal = runtimeService.createExecutionQuery().activityId("signalEvent").processInstanceId(processInstance.getId()).singleResult();
// test query by execution id
EventSubscriptionEntity signalSubscription = newEventSubscriptionQuery().executionId(executionWaitingForSignal.getId()).singleResult();
assertNotNull(signalSubscription);
assertEquals(signalSubscription, subscription);
cleanDb();
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class ProcessInstanceIdentityLinkTest method testSetAuthenticatedUserAndCompleteLastTask.
// Test specific for fix introduced by https://activiti.atlassian.net/browse/ACT-1591
// (Referential integrity constraint violation on PROC_INST and IDENTITY_LINK)
@Deployment
public void testSetAuthenticatedUserAndCompleteLastTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("identityLinktest");
// There are two tasks
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(task.getId());
identityService.setAuthenticatedUserId("kermit");
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(task.getId());
identityService.setAuthenticatedUserId(null);
assertProcessEnded(processInstance.getId());
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class ProcessInstanceIdentityLinkTest method testSetAuthenticatedUserWithNoWaitStates.
// Test specific for fix introduced by https://activiti.atlassian.net/browse/ACT-1591
// (Referential integrity constraint violation on PROC_INST and IDENTITY_LINK)
@Deployment
public void testSetAuthenticatedUserWithNoWaitStates() {
identityService.setAuthenticatedUserId("kermit");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("identityLinktest");
assertProcessEnded(processInstance.getId());
identityService.setAuthenticatedUserId(null);
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class TaskDueDateExtensionsTest method testRelativeDueDateStringExtension.
@Deployment
public void testRelativeDueDateStringExtension() throws Exception {
Clock clock = processEngineConfiguration.getClock();
clock.setCurrentCalendar(new GregorianCalendar(2015, 0, 1));
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dateVariable", "P2DT5H40M");
// Start process-instance, passing ISO8601 duration formatted String that should be used to calculate dueDate
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dueDateExtension", variables);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task.getDueDate());
Period period = new Period(task.getCreateTime().getTime(), task.getDueDate().getTime());
assertEquals(2, period.getDays());
assertEquals(5, period.getHours());
assertEquals(40, period.getMinutes());
clock.reset();
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class TaskDueDateExtensionsTest method testRelativeDueDateStringWithCalendarNameExtension.
@Deployment
public void testRelativeDueDateStringWithCalendarNameExtension() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dateVariable", "P2DT5H40M");
// Start process-instance, passing ISO8601 duration formatted String that should be used to calculate dueDate
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("dueDateExtension", variables);
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task.getDueDate());
assertThat(task.getDueDate(), is(new Date(0)));
}
Aggregations