Exemple #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());
        }
Exemple #2
0
        public virtual IList <IncidentDto> getIncidents(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            IncidentQueryDto queryDto = new IncidentQueryDto(ObjectMapper, uriInfo.QueryParameters);
            IncidentQuery    query    = queryDto.toQuery(processEngine);

            IList <Incident> queryResult;

            if (firstResult != null || maxResults != null)
            {
                queryResult = executePaginatedQuery(query, firstResult, maxResults);
            }
            else
            {
                queryResult = query.list();
            }

            IList <IncidentDto> result = new List <IncidentDto>();

            foreach (Incident incident in queryResult)
            {
                IncidentDto dto = IncidentDto.fromIncident(incident);
                result.Add(dto);
            }

            return(result);
        }
Exemple #3
0
        private void createIncidentMock()
        {
            IncidentQuery    mockIncidentQuery = mock(typeof(IncidentQuery));
            IList <Incident> incidents         = MockProvider.createMockIncidents();

            when(mockIncidentQuery.list()).thenReturn(incidents);
            when(mockRuntimeService.createIncidentQuery()).thenReturn(mockIncidentQuery);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
Exemple #10
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);
        }
Exemple #11
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);
        }
Exemple #12
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);
        }
Exemple #13
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);
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
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
            }
        }