コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByJobDefinitionId()
        public virtual void testQueryByJobDefinitionId()
        {
            string processDefinitionId1 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).Id;
            string processDefinitionId2 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).Id;

            runtimeService.startProcessInstanceById(processDefinitionId1);
            runtimeService.startProcessInstanceById(processDefinitionId2);
            testHelper.executeAvailableJobs();

            string jobDefinitionId1 = managementService.createJobQuery().processDefinitionId(processDefinitionId1).singleResult().JobDefinitionId;
            string jobDefinitionId2 = managementService.createJobQuery().processDefinitionId(processDefinitionId2).singleResult().JobDefinitionId;

            IncidentQuery query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1, jobDefinitionId2);

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

            query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1);

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

            query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId2);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
コード例 #2
0
        public virtual void testQueryByTenantId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().tenantIdIn(TENANT_ONE);

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

            query = runtimeService.createIncidentQuery().tenantIdIn(TENANT_TWO);

            assertThat(query.count(), @is(1L));
        }
コード例 #3
0
        public virtual void testQueryNoAuthenticatedTenants()
        {
            identityService.setAuthentication("user", null, null);

            IncidentQuery query = runtimeService.createIncidentQuery();

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

            IncidentQuery query = runtimeService.createIncidentQuery();

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

            IncidentQuery query = runtimeService.createIncidentQuery();

            assertThat(query.count(), @is(2L));
            assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L));
            assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L));
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByUnknownJobDefinitionId()
        public virtual void testQueryByUnknownJobDefinitionId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().jobDefinitionIdIn("unknown");

            assertEquals(0, query.count());

            IList <Incident> incidents = query.list();

            assertEquals(0, incidents.Count);
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByRootCauseIncidentIdEqualsNull()
        public virtual void testQueryByRootCauseIncidentIdEqualsNull()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().rootCauseIncidentId(null);

            assertEquals(4, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(4, incidents.Count);
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByIncidentMessage()
        public virtual void testQueryByIncidentMessage()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().incidentMessage("exception0");

            assertEquals(1, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(1, incidents.Count);
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByIncidentType()
        public virtual void testQueryByIncidentType()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().incidentType(org.camunda.bpm.engine.runtime.Incident_Fields.FAILED_JOB_HANDLER_TYPE);

            assertEquals(4, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(4, incidents.Count);
        }
コード例 #10
0
        private IncidentQuery setupMockIncidentQuery(IList <Incident> incidents)
        {
            IncidentQuery sampleQuery = mock(typeof(IncidentQuery));

            when(sampleQuery.list()).thenReturn(incidents);
            when(sampleQuery.count()).thenReturn((long)incidents.Count);

            when(processEngine.RuntimeService.createIncidentQuery()).thenReturn(sampleQuery);

            return(sampleQuery);
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByRootInvalidCauseIncidentId()
        public virtual void testQueryByRootInvalidCauseIncidentId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().rootCauseIncidentId("invalid");

            assertEquals(0, query.count());

            IList <Incident> incidents = query.list();

            assertTrue(incidents.Count == 0);
            assertEquals(0, incidents.Count);
        }
コード例 #12
0
        public virtual void testQueryByActivityId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().activityId("theServiceTask");

            assertEquals(4, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(4, incidents.Count);
        }
コード例 #13
0
        public virtual CountResultDto getIncidentsCount(UriInfo uriInfo)
        {
            IncidentQueryDto queryDto = new IncidentQueryDto(ObjectMapper, uriInfo.QueryParameters);
            IncidentQuery    query    = queryDto.toQuery(processEngine);

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

            result.Count = count;

            return(result);
        }
コード例 #14
0
        public virtual void testQueryByProcessDefinitionId()
        {
            string processDefinitionId = engineRule.RepositoryService.createProcessDefinitionQuery().singleResult().Id;

            IncidentQuery query = runtimeService.createIncidentQuery().processDefinitionId(processDefinitionId);

            assertEquals(4, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(4, incidents.Count);
        }
コード例 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByConfiguration()
        public virtual void testQueryByConfiguration()
        {
            string jobId = managementService.createJobQuery().processInstanceId(processInstanceIds[0]).singleResult().Id;

            IncidentQuery query = runtimeService.createIncidentQuery().configuration(jobId);

            assertEquals(1, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(1, incidents.Count);
        }
コード例 #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryByInvalidConfiguration()
        public virtual void testQueryByInvalidConfiguration()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().configuration("invalid");

            assertEquals(0, query.count());

            IList <Incident> incidents = query.list();

            assertTrue(incidents.Count == 0);

            Incident incident = query.singleResult();

            assertNull(incident);
        }
コード例 #17
0
        public virtual void testQueryByProcessInstanceId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().processInstanceId(processInstanceIds[0]);

            assertEquals(1, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(1, incidents.Count);

            Incident incident = query.singleResult();

            assertNotNull(incident);
        }
コード例 #18
0
        public virtual void testQueryByExecutionId()
        {
            Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceIds[0]).singleResult();

            assertNotNull(execution);

            IncidentQuery query = runtimeService.createIncidentQuery().executionId(execution.Id);

            assertEquals(1, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(1, incidents.Count);
        }
コード例 #19
0
        public virtual void testQueryByCauseIncidentId()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callFailingProcess");

            testHelper.executeAvailableJobs();

            ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.Id).singleResult();

            assertNotNull(subProcessInstance);

            Incident causeIncident = runtimeService.createIncidentQuery().processInstanceId(subProcessInstance.Id).singleResult();

            assertNotNull(causeIncident);

            IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId(causeIncident.Id);

            assertEquals(2, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(2, incidents.Count);
        }
コード例 #20
0
        public virtual void testQueryByRootCauseIncidentId()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callFailingCallActivity");

            testHelper.executeAvailableJobs();

            ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.Id).singleResult();

            assertNotNull(subProcessInstance);

            ProcessInstance failingSubProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(subProcessInstance.Id).singleResult();

            assertNotNull(subProcessInstance);

            Incident incident = runtimeService.createIncidentQuery().processInstanceId(failingSubProcessInstance.Id).singleResult();

            assertNotNull(incident);

            IncidentQuery query = runtimeService.createIncidentQuery().rootCauseIncidentId(incident.Id);

            assertEquals(3, query.count());

            IList <Incident> incidents = query.list();

            assertFalse(incidents.Count == 0);
            assertEquals(3, incidents.Count);

            try
            {
                query.singleResult();
                fail();
            }
            catch (ProcessEngineException)
            {
                // Exception is expected
            }
        }
コード例 #21
0
        public virtual void testQueryWithoutTenantId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery();

            assertThat(query.count(), @is(2L));
        }
コード例 #22
0
        public virtual void testQueryByNonExistingTenantId()
        {
            IncidentQuery query = runtimeService.createIncidentQuery().tenantIdIn("nonExisting");

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