Пример #1
0
        public virtual void testQueryByTenantId()
        {
            CaseExecutionQuery query = caseService.createCaseExecutionQuery().tenantIdIn(TENANT_ONE);

            assertThat(query.count(), @is(2L));

            query = caseService.createCaseExecutionQuery().tenantIdIn(TENANT_TWO);

            assertThat(query.count(), @is(2L));
        }
Пример #2
0
        public virtual void testQueryNoAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, null);

            CaseExecutionQuery query = caseService.createCaseExecutionQuery();

            assertThat(query.count(), @is(2L));
        }
Пример #3
0
        public virtual void testQueryDisabledTenantCheck()
        {
            processEngineConfiguration.TenantCheckEnabled = false;
            identityService.setAuthentication("user", null, null);

            CaseExecutionQuery query = caseService.createCaseExecutionQuery();

            assertThat(query.count(), @is(6L));
        }
Пример #4
0
        private CaseExecutionQuery setUpMockCaseExecutionQuery(IList <CaseExecution> mockedCaseExecutions)
        {
            CaseExecutionQuery query = mock(typeof(CaseExecutionQuery));

            when(processEngine.CaseService.createCaseExecutionQuery()).thenReturn(query);

            when(query.list()).thenReturn(mockedCaseExecutions);
            when(query.count()).thenReturn((long)mockedCaseExecutions.Count);

            return(query);
        }
Пример #5
0
        public virtual void testQueryAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));

            CaseExecutionQuery query = caseService.createCaseExecutionQuery();

            assertThat(query.count(), @is(6L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(2L));
            assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(2L));
            assertThat(query.withoutTenantId().count(), @is(2L));
        }
Пример #6
0
        public virtual CountResultDto queryCaseExecutionsCount(CaseExecutionQueryDto queryDto)
        {
            ProcessEngine engine = ProcessEngine;

            queryDto.ObjectMapper = ObjectMapper;
            CaseExecutionQuery query = queryDto.toQuery(engine);

            long           count  = query.count();
            CountResultDto result = new CountResultDto();

            result.Count = count;

            return(result);
        }
Пример #7
0
        public virtual void testSequenceAutoStartStage()
        {
            // given
            string caseInstanceId = createCaseInstance().Id;

            CaseExecution firstHumanTask   = queryCaseExecutionByActivityId("PI_HumanTask_1");
            string        firstHumanTaskId = firstHumanTask.Id;

            assertTrue(firstHumanTask.Active);

            CaseExecution stage   = queryCaseExecutionByActivityId("PI_Stage_1");
            string        stageId = stage.Id;

            assertTrue(stage.Available);

            // (1) then
            stage = queryCaseExecutionById(stageId);
            assertTrue(stage.Available);

            assertNull(caseService.getVariable(caseInstanceId, "enable"));
            assertNull(caseService.getVariable(caseInstanceId, "start"));

            // (2) when
            complete(firstHumanTaskId);

            // (2) then
            stage = queryCaseExecutionById(stageId);
            assertTrue(stage.Active);

            assertNull(caseService.getVariable(caseInstanceId, "enable"));
            object startVariable = caseService.getVariable(caseInstanceId, "start");

            assertNotNull(startVariable);
            assertTrue((bool?)startVariable);

            CaseExecutionQuery query = caseService.createCaseExecutionQuery().enabled();

            assertEquals(2, query.count());

            foreach (CaseExecution child in query.list())
            {
                assertEquals(stageId, child.ParentId);
            }
        }
Пример #8
0
        public virtual void testQueryByNonExistingTenantId()
        {
            CaseExecutionQuery query = caseService.createCaseExecutionQuery().tenantIdIn("nonExisting");

            assertThat(query.count(), @is(0L));
        }
Пример #9
0
        public virtual void testQueryByExecutionsWithoutTenantId()
        {
            CaseExecutionQuery query = caseService.createCaseExecutionQuery().withoutTenantId();

            assertThat(query.count(), @is(2L));
        }
Пример #10
0
        public virtual void testQueryNoTenantIdSet()
        {
            CaseExecutionQuery query = caseService.createCaseExecutionQuery();

            assertThat(query.count(), @is(6L));
        }