示例#1
0
        public virtual void testQueryByTenantId()
        {
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn(TENANT_ONE);

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

            query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn(TENANT_TWO);

            assertThat(query.count(), @is(2L));
        }
示例#2
0
        public virtual void testQueryByVariableTypeInWithCapitalLetter()
        {
            // given
            IDictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["stringVar"] = "test";
            variables1["boolVar"]   = true;
            runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("Boolean");

            // then
            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
            HistoricDetail historicDetail = query.list().get(0);

            if (historicDetail is HistoricVariableUpdate)
            {
                HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate)historicDetail;
                assertEquals(variableUpdate.VariableName, "boolVar");
                assertEquals(variableUpdate.TypeName, "boolean");
            }
            else
            {
                fail("Historic detail should be a variable update!");
            }
        }
示例#3
0
        public virtual void testQueryNoAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, null);

            HistoricDetailQuery query = historyService.createHistoricDetailQuery();

            assertThat(query.count(), @is(0L));
        }
示例#4
0
        public virtual void testQueryDisabledTenantCheck()
        {
            processEngineConfiguration.TenantCheckEnabled = false;
            identityService.setAuthentication("user", null, null);

            HistoricDetailQuery query = historyService.createHistoricDetailQuery();

            assertThat(query.count(), @is(4L));
        }
示例#5
0
        public virtual void testQueryAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));

            HistoricDetailQuery query = historyService.createHistoricDetailQuery();

            assertThat(query.count(), @is(4L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(2L));
            assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(2L));
        }
示例#6
0
        public virtual CountResultDto getHistoricDetailsCount(UriInfo uriInfo)
        {
            HistoricDetailQueryDto queryDto = new HistoricDetailQueryDto(objectMapper, uriInfo.QueryParameters);
            HistoricDetailQuery    query    = queryDto.toQuery(processEngine);

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

            result.Count = count;

            return(result);
        }
示例#7
0
        public virtual void testQueryByNonExistingProcessInstanceId()
        {
            // given
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["stringVar"] = "test";
            runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().processInstanceIdIn("foo");

            // then
            assertEquals(0, query.count());
        }
示例#8
0
        public virtual void testQueryBySingleProcessInstanceId()
        {
            // given
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["stringVar"] = "test";
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().processInstanceIdIn(processInstance.ProcessInstanceId);

            // then
            assertEquals(1, query.count());
            assertEquals(query.list().get(0).ProcessInstanceId, processInstance.Id);
        }
示例#9
0
        public virtual void testQueryByInvalidExecutionId()
        {
            startProcessInstance(PROCESS_KEY);

            string taskId = taskService.createTaskQuery().singleResult().Id;

            // when
            taskService.resolveTask(taskId, Variables);

            //then
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().executionId("invalid");

            assertEquals(0, query.list().size());
            assertEquals(0, query.count());
        }
示例#10
0
        public virtual void testQueryByUserOperationId()
        {
            startProcessInstance(PROCESS_KEY);

            identityService.AuthenticatedUserId = "demo";

            string taskId = taskService.createTaskQuery().singleResult().Id;

            // when
            taskService.resolveTask(taskId, Variables);

            //then
            string userOperationId = historyService.createHistoricDetailQuery().singleResult().UserOperationId;

            HistoricDetailQuery query = historyService.createHistoricDetailQuery().userOperationId(userOperationId);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
示例#11
0
        public virtual void testQueryByInvalidVariableTypeIn()
        {
            // given
            IDictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["stringVar"] = "test";
            variables1["boolVar"]   = true;
            variables1["intVar"]    = 5;
            runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("invalid");

            // then
            assertEquals(0, query.count());

            try
            {
                // when
                query.variableTypeIn(null);
                fail("A ProcessEngineException was expected.");
            }
            catch (ProcessEngineException)
            {
                // then fails
            }

            try
            {
                // when
                query.variableTypeIn((string)null);
                fail("A ProcessEngineException was expected.");
            }
            catch (ProcessEngineException)
            {
                // then fails
            }
        }
示例#12
0
        public virtual void testQueryBySeveralProcessInstanceIds()
        {
            // given
            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["stringVar"] = "test";
            ProcessInstance processInstance  = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);
            ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);

            runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().processInstanceIdIn(processInstance.ProcessInstanceId, processInstance2.ProcessInstanceId);

            // then
            ISet <string> expectedProcessInstanceIds = new HashSet <string>();

            expectedProcessInstanceIds.Add(processInstance.Id);
            expectedProcessInstanceIds.Add(processInstance2.Id);
            assertEquals(2, query.count());
            assertTrue(expectedProcessInstanceIds.Contains(query.list().get(0).ProcessInstanceId));
            assertTrue(expectedProcessInstanceIds.Contains(query.list().get(1).ProcessInstanceId));
        }
示例#13
0
        public virtual void testQueryByInvalidUserOperationId()
        {
            startProcessInstance(PROCESS_KEY);

            string taskId = taskService.createTaskQuery().singleResult().Id;

            // when
            taskService.resolveTask(taskId, Variables);

            //then
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().userOperationId("invalid");

            assertEquals(0, query.list().size());
            assertEquals(0, query.count());

            try
            {
                query.userOperationId(null);
                fail("It was possible to set a null value as userOperationId.");
            }
            catch (ProcessEngineException)
            {
            }
        }
示例#14
0
        public virtual void testQueryByVariableTypeInWithSeveralTypes()
        {
            // given
            IDictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["stringVar"] = "test";
            variables1["boolVar"]   = true;
            variables1["intVar"]    = 5;
            variables1["nullVar"]   = null;
            variables1["pojoVar"]   = new TestPojo("str", .0);
            runtimeService.startProcessInstanceByKey("oneTaskProcess", variables1);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableTypeIn("boolean", "integer", "Serializable");

            // then
            assertEquals(3, query.list().size());
            assertEquals(3, query.count());
            ISet <string> allowedVariableTypes = new HashSet <string>();

            allowedVariableTypes.Add("boolean");
            allowedVariableTypes.Add("integer");
            allowedVariableTypes.Add("object");
            foreach (HistoricDetail detail in query.list())
            {
                if (detail is HistoricVariableUpdate)
                {
                    HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate)detail;
                    assertTrue(allowedVariableTypes.Contains(variableUpdate.TypeName));
                }
                else
                {
                    fail("Historic detail should be a variable update!");
                }
            }
        }
示例#15
0
        public virtual void testQueryByNonExistingTenantId()
        {
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates().tenantIdIn("nonExisting");

            assertThat(query.count(), @is(0L));
        }
示例#16
0
        public virtual void testQueryByTenantIds()
        {
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields().tenantIdIn(TENANT_ONE, TENANT_TWO);

            assertThat(query.count(), @is(2L));
        }
示例#17
0
        public virtual void testQueryWithoutTenantId()
        {
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().variableUpdates();

            assertThat(query.count(), @is(4L));
        }
示例#18
0
        public virtual void testQueryWithoutTenantId()
        {
            HistoricDetailQuery query = historyService.createHistoricDetailQuery().formFields();

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