use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskServiceTest method testAddGroupIdentityLinkUnexistingTask.
public void testAddGroupIdentityLinkUnexistingTask() {
User user = identityService.newUser("user");
identityService.saveUser(user);
try {
taskService.addGroupIdentityLink("unexistingTaskId", user.getId(), IdentityLinkType.CANDIDATE);
fail("ActivitiException expected");
} catch (ActivitiObjectNotFoundException ae) {
assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
assertEquals(Task.class, ae.getObjectClass());
}
identityService.deleteUser(user.getId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class RuntimeVariablesTest method testGetVariablesByExecutionIdsForSerializableType.
@Deployment(resources = { "org/activiti/engine/test/api/runtime/RuntimeVariablesTest.testGetVariablesByExecutionIds.bpmn20.xml" })
public void testGetVariablesByExecutionIdsForSerializableType() {
ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task1 = taskService.createTaskQuery().processInstanceId(processInstance1.getId()).singleResult();
StringBuilder sb = new StringBuilder("a");
for (int i = 0; i < 4001; i++) {
sb.append("a");
}
String serializableTypeVar = sb.toString();
// Execution variables
taskService.setVariable(task1.getId(), "executionVar1", serializableTypeVar);
// only 1 process
Set<String> executionIds = new HashSet<String>();
executionIds.add(task1.getExecutionId());
List<VariableInstance> variables = runtimeService.getVariableInstancesByExecutionIds(executionIds);
assertEquals(serializableTypeVar, variables.get(0).getValue());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskServiceTest method testAddUserIdentityLinkUnexistingTask.
public void testAddUserIdentityLinkUnexistingTask() {
User user = identityService.newUser("user");
identityService.saveUser(user);
try {
taskService.addUserIdentityLink("unexistingTaskId", user.getId(), IdentityLinkType.CANDIDATE);
fail("ActivitiException expected");
} catch (ActivitiObjectNotFoundException ae) {
assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
assertEquals(Task.class, ae.getObjectClass());
}
identityService.deleteUser(user.getId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class TaskServiceTest method testAddCandidateUserUnexistingTask.
public void testAddCandidateUserUnexistingTask() {
User user = identityService.newUser("user");
identityService.saveUser(user);
try {
taskService.addCandidateUser("unexistingTaskId", user.getId());
fail("ActivitiException expected");
} catch (ActivitiObjectNotFoundException ae) {
assertTextPresent("Cannot find task with id unexistingTaskId", ae.getMessage());
assertEquals(Task.class, ae.getObjectClass());
}
identityService.deleteUser(user.getId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class FullHistoryTest method testHistoricFormPropertiesOnReEnteringActivity.
/**
* Test created to validate ACT-621 fix.
*/
@Deployment
public void testHistoricFormPropertiesOnReEnteringActivity() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("comeBack", Boolean.TRUE);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("HistoricFormPropertiesProcess", variables);
assertNotNull(processInstance);
// Submit form on task
Map<String, String> data = new HashMap<String, String>();
data.put("formProp1", "Property value");
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
formService.submitTaskFormData(task.getId(), data);
// Historic property should be available
List<HistoricDetail> details = historyService.createHistoricDetailQuery().formProperties().processInstanceId(processInstance.getId()).list();
assertNotNull(details);
assertEquals(1, details.size());
// Task should be active in the same activity as the previous one
task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
formService.submitTaskFormData(task.getId(), data);
details = historyService.createHistoricDetailQuery().formProperties().processInstanceId(processInstance.getId()).list();
assertNotNull(details);
assertEquals(2, details.size());
// Should have 2 different historic activity instance ID's, with the same activityId
assertNotSame(details.get(0).getActivityInstanceId(), details.get(1).getActivityInstanceId());
HistoricActivityInstance historicActInst1 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(details.get(0).getActivityInstanceId()).singleResult();
HistoricActivityInstance historicActInst2 = historyService.createHistoricActivityInstanceQuery().activityInstanceId(details.get(1).getActivityInstanceId()).singleResult();
assertEquals(historicActInst1.getActivityId(), historicActInst2.getActivityId());
}
Aggregations