Exemplo n.º 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;

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId1, jobDefinitionId2);

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

            query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId1);

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

            query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn(jobDefinitionId2);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 2
0
        public virtual IList <HistoricIncidentDto> getHistoricIncidents(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            HistoricIncidentQueryDto queryDto = new HistoricIncidentQueryDto(objectMapper, uriInfo.QueryParameters);
            HistoricIncidentQuery    query    = queryDto.toQuery(processEngine);

            IList <HistoricIncident> queryResult;

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

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

            foreach (HistoricIncident historicIncident in queryResult)
            {
                HistoricIncidentDto dto = HistoricIncidentDto.fromHistoricIncident(historicIncident);
                result.Add(dto);
            }

            return(result);
        }
Exemplo n.º 3
0
        private void createHistoricIncidentMock()
        {
            HistoricIncidentQuery    mockHistoricIncidentQuery = mock(typeof(HistoricIncidentQuery));
            IList <HistoricIncident> historicIncidents         = MockProvider.createMockHistoricIncidents();

            when(mockHistoricIncidentQuery.list()).thenReturn(historicIncidents);
            when(mockHistoryService.createHistoricIncidentQuery()).thenReturn(mockHistoricIncidentQuery);
        }
Exemplo n.º 4
0
        public virtual void testQueryByOpen()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().open();

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 5
0
        public virtual void testQueryByIncidentType()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().incidentType(org.camunda.bpm.engine.runtime.Incident_Fields.FAILED_JOB_HANDLER_TYPE);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 6
0
        private HistoricIncidentQuery setUpMockHistoricIncidentQuery(IList <HistoricIncident> mockedHistoricIncidents)
        {
            HistoricIncidentQuery mockedHistoricIncidentQuery = mock(typeof(HistoricIncidentQuery));

            when(mockedHistoricIncidentQuery.list()).thenReturn(mockedHistoricIncidents);
            when(mockedHistoricIncidentQuery.count()).thenReturn((long)mockedHistoricIncidents.Count);

            when(processEngine.HistoryService.createHistoricIncidentQuery()).thenReturn(mockedHistoricIncidentQuery);

            return(mockedHistoricIncidentQuery);
        }
Exemplo n.º 7
0
        public virtual void testQueryByIncidentId()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            string incidentId = historyService.createHistoricIncidentQuery().singleResult().Id;

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().incidentId(incidentId);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 8
0
        public virtual void testQueryByConfiguration()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            string configuration = managementService.createJobQuery().singleResult().Id;

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().configuration(configuration);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 9
0
        public virtual void testQueryByExecutionId()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            ProcessInstance pi = runtimeService.createProcessInstanceQuery().singleResult();

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().executionId(pi.Id);

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 10
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()
        {
            string processDefinitionId = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).Id;

            runtimeService.startProcessInstanceById(processDefinitionId);
            testHelper.executeAvailableJobs();

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().jobDefinitionIdIn("unknown");

            assertEquals(0, query.list().size());
            assertEquals(0, query.count());
        }
Exemplo n.º 11
0
        public virtual void testQueryByDeleted()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            string processInstanceId = runtimeService.createProcessInstanceQuery().singleResult().Id;

            runtimeService.deleteProcessInstance(processInstanceId, null);

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().deleted();

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 12
0
        public virtual void testQueryByResolved()
        {
            startProcessInstance(PROCESS_DEFINITION_KEY);

            string jobId = managementService.createJobQuery().singleResult().Id;

            managementService.setJobRetries(jobId, 1);

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().resolved();

            assertEquals(1, query.list().size());
            assertEquals(1, query.count());
        }
Exemplo n.º 13
0
        public virtual void testQueryByRootCauseIncidentId()
        {
            startProcessInstance("process");

            string processInstanceId = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult().Id;

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

            HistoricIncidentQuery query = historyService.createHistoricIncidentQuery().rootCauseIncidentId(incident.Id);

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