use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class FormAuthorizationTest method testSubmitStartForm.
public void testSubmitStartForm() {
// given
String processDefinitionId = selectProcessDefinitionByKey(FORM_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, FORM_PROCESS_KEY, userId, CREATE_INSTANCE);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, CREATE);
// when
ProcessInstance instance = formService.submitStartForm(processDefinitionId, null);
// then
assertNotNull(instance);
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class CmmnDisabledTest method testVariableInstanceQuery.
public void testVariableInstanceQuery() {
ProcessApplicationDeployment deployment = repositoryService.createDeployment(processApplication.getReference()).addClasspathResource("org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml").deploy();
VariableMap variables = Variables.createVariables().putValue("my-variable", "a-value");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", variables);
// variable instance query
List<VariableInstance> result = runtimeService.createVariableInstanceQuery().list();
assertEquals(1, result.size());
VariableInstance variableInstance = result.get(0);
assertEquals("my-variable", variableInstance.getName());
// get variable
assertNotNull(runtimeService.getVariable(processInstance.getId(), "my-variable"));
// get variable local
assertNotNull(runtimeService.getVariableLocal(processInstance.getId(), "my-variable"));
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ProcessApplicationElResolverTest method testCallActivityOutputExpression.
/**
* Tests that an expression for a call activity output parameter is resolved
* in the context of the called process definition's application.
*/
public void testCallActivityOutputExpression() {
// given an instance of the calling process that calls the called process
ProcessInstance instance = runtimeService.startProcessInstanceByKey("callingProcess");
// when the called process is completed
Task calledProcessTask = taskService.createTaskQuery().singleResult();
taskService.complete(calledProcessTask.getId());
// then the output mapping should have successfully resolved the expression
String outVariable = (String) runtimeService.getVariable(instance.getId(), "outVar");
assertEquals(CalledProcessApplication.STRING_VARIABLE_VALUE, outVariable);
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryByPriorityTest method testFilterByExternalTaskPriorityLowerAndHigher.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/externalTaskPriorityExpression.bpmn20.xml")
public void testFilterByExternalTaskPriorityLowerAndHigher() {
// given five jobs with priorities from 1 to 5
List<ProcessInstance> instances = new ArrayList<ProcessInstance>();
for (int i = 0; i < 5; i++) {
instances.add(runtimeService.startProcessInstanceByKey("twoExternalTaskWithPriorityProcess", Variables.createVariables().putValue("priority", i)));
}
// when making a external task query and filtering by external task priority
// then the correct external task is returned
ExternalTask task = externalTaskService.createExternalTaskQuery().priorityHigherThanOrEquals(2L).priorityLowerThanOrEquals(2L).singleResult();
assertNotNull(task);
assertEquals(2, task.getPriority());
assertEquals(instances.get(2).getId(), task.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryByPriorityTest method testFilterByExternalTaskPriorityLowerThanOrEquals.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/externalTaskPriorityExpression.bpmn20.xml")
public void testFilterByExternalTaskPriorityLowerThanOrEquals() {
// given five jobs with priorities from 1 to 5
// each process has two external tasks - one with priority expression and one without priority
List<ProcessInstance> instances = new ArrayList<ProcessInstance>();
for (int i = 0; i < 5; i++) {
instances.add(runtimeService.startProcessInstanceByKey("twoExternalTaskWithPriorityProcess", Variables.createVariables().putValue("priority", i)));
}
// when making a external task query and filtering by priority
// then the correct external tasks are returned
List<ExternalTask> tasks = externalTaskService.createExternalTaskQuery().priorityLowerThanOrEquals(2).list();
assertEquals(8, tasks.size());
for (ExternalTask task : tasks) {
assertTrue(task.getPriority() <= 2);
}
}
Aggregations