public virtual void testStartProcessInstanceByKeyWithoutTenantId() { deployment(PROCESS); deploymentForTenant(TENANT_ONE, PROCESS); runtimeService.createProcessInstanceByKey("testProcess").processDefinitionWithoutTenantId().execute(); ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.count(), @is(1L)); assertThat(query.singleResult().TenantId, @is(nullValue())); }
public virtual void testQueryByLeafInstancesOneLayer() { ProcessInstance process = runtimeService.startProcessInstanceByKey("simpleSubProcess"); ProcessInstanceQuery simpleSubProcessQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey("simpleSubProcess"); assertThat(runtimeService.createProcessInstanceQuery().count(), @is(1L)); assertThat(simpleSubProcessQuery.count(), @is(1L)); ProcessInstance instance = runtimeService.createProcessInstanceQuery().leafProcessInstances().singleResult(); assertThat(instance.RootProcessInstanceId, @is(process.Id)); assertThat(instance.Id, @is(simpleSubProcessQuery.singleResult().Id)); }
public virtual void testQueryByLeafInstancesTwoLayers() { /* * nested structure: * nestedSubProcess * +-- subProcess */ ProcessInstance twoLayerProcess = runtimeService.startProcessInstanceByKey("nestedSimpleSubProcess"); ProcessInstanceQuery simpleSubProcessQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey("simpleSubProcess"); assertThat(runtimeService.createProcessInstanceQuery().count(), @is(2L)); assertThat(runtimeService.createProcessInstanceQuery().processDefinitionKey("nestedSimpleSubProcess").count(), @is(1L)); assertThat(simpleSubProcessQuery.count(), @is(1L)); ProcessInstance instance = runtimeService.createProcessInstanceQuery().leafProcessInstances().singleResult(); assertThat(instance.RootProcessInstanceId, @is(twoLayerProcess.Id)); assertThat(instance.Id, @is(simpleSubProcessQuery.singleResult().Id)); }