use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartProcessInstanceWithLatestBindingSameVersion.
public void testStartProcessInstanceWithLatestBindingSameVersion() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementBinding("latest").endEvent().done();
deploymentForTenant(TENANT_ONE, callingProcess, SUB_PROCESS);
deploymentForTenant(TENANT_TWO, callingProcess, SUB_PROCESS);
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute();
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyCallActivityTest method testStartProcessInstanceWithVersionBinding.
public void testStartProcessInstanceWithVersionBinding() {
BpmnModelInstance callingProcess = Bpmn.createExecutableProcess("callingProcess").startEvent().callActivity().calledElement("subProcess").camundaCalledElementBinding("version").camundaCalledElementVersion("1").endEvent().done();
deploymentForTenant(TENANT_ONE, callingProcess, SUB_PROCESS);
deploymentForTenant(TENANT_TWO, callingProcess, SUB_PROCESS);
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_ONE).execute();
runtimeService.createProcessInstanceByKey("callingProcess").processDefinitionTenantId(TENANT_TWO).execute();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("subProcess");
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MessageCorrelationTest method testMessageStartEventCorrelationWithVariablesUsingFluentCorrelateSingleMessage.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/MessageCorrelationTest.testMessageStartEventCorrelation.bpmn20.xml")
@Test
public void testMessageStartEventCorrelationWithVariablesUsingFluentCorrelateSingleMessage() {
runtimeService.createMessageCorrelation("newInvoiceMessage").setVariables(Variables.createVariables().putValue("var1", "a").putValue("var2", "b")).correlate();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("messageStartEvent").variableValueEquals("var1", "a").variableValueEquals("var2", "b");
assertEquals(1, query.count());
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class MessageCorrelationTest method testMessageStartEventCorrelationWithVariablesUsingFluentCorrelateStartMessage.
@Deployment(resources = "org/camunda/bpm/engine/test/api/runtime/MessageCorrelationTest.testMessageStartEventCorrelation.bpmn20.xml")
@Test
public void testMessageStartEventCorrelationWithVariablesUsingFluentCorrelateStartMessage() {
runtimeService.createMessageCorrelation("newInvoiceMessage").setVariables(Variables.createVariables().putValue("var1", "a").putValue("var2", "b")).correlateStartMessage();
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processDefinitionKey("messageStartEvent").variableValueEquals("var1", "a").variableValueEquals("var2", "b");
assertEquals(1, query.count());
}
use of org.camunda.bpm.engine.runtime.ProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class ModificationExecutionAsyncTest method testBatchCreationWithOverlappingProcessInstanceIdsAndQuery.
@Test
public void testBatchCreationWithOverlappingProcessInstanceIdsAndQuery() {
int processInstanceCount = 15;
DeploymentWithDefinitions deployment = testRule.deploy(instance);
ProcessDefinition processDefinition = deployment.getDeployedProcessDefinitions().get(0);
List<String> processInstanceIds = helper.startInstances("process1", 15);
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(processDefinition.getId());
assertEquals(processInstanceCount, processInstanceQuery.count());
// when
Batch batch = runtimeService.createModification(processDefinition.getId()).startTransition("seq").processInstanceIds(processInstanceIds).processInstanceQuery(processInstanceQuery).executeAsync();
// then a batch is created
assertBatchCreated(batch, processInstanceCount);
}
Aggregations