@Test public void testProcessDefinitionStatisticsWithRootIncidents() { given().queryParam("rootIncidents", "true") .then().expect() .statusCode(Status.OK.getStatusCode()) .when().get(PROCESS_DEFINITION_STATISTICS_URL); InOrder inOrder = Mockito.inOrder(processDefinitionStatisticsQueryMock);; inOrder.verify(processDefinitionStatisticsQueryMock).includeRootIncidents(); inOrder.verify(processDefinitionStatisticsQueryMock).list(); } }
query.includeIncidentsForType(includeIncidentsForType); } else if (includeRootIncidents != null && includeRootIncidents) { query.includeRootIncidents();
query.includeIncidentsForType(includeIncidentsForType); } else if (includeRootIncidents != null && includeRootIncidents) { query.includeRootIncidents();
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml") public void testIncludeRootIncidentsFails() { runtimeService.startProcessInstanceByKey("callExampleSubProcess"); executeAvailableJobs(); try { managementService .createProcessDefinitionStatisticsQuery() .includeIncidents() .includeRootIncidents() .list(); } catch (ProcessEngineException e) { Assert.assertThat(e.getMessage(), containsString("It is not possible to use includeIncident() and includeRootIncidents() to execute one query")); } }
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml") public void testIncludeRootIncidentsOnly() { runtimeService.startProcessInstanceByKey("callExampleSubProcess"); executeAvailableJobs(); List<ProcessDefinitionStatistics> statistics = managementService .createProcessDefinitionStatisticsQuery() .includeRootIncidents() .list(); // two process definitions assertEquals(2, statistics.size()); for (ProcessDefinitionStatistics definitionResult : statistics) { if (definitionResult.getKey().equals("callExampleSubProcess")) { // there is no root incidents assertTrue(definitionResult.getIncidentStatistics().isEmpty()); } else if (definitionResult.getKey().equals("ExampleProcess")) { // there is one root incident assertFalse(definitionResult.getIncidentStatistics().isEmpty()); assertEquals(1, definitionResult.getIncidentStatistics().size()); assertEquals(1, definitionResult.getIncidentStatistics().get(0).getIncidentCount()); } else { // fail if the process definition key does not match fail(); } } }
query.includeIncidentsForType(includeIncidentsForType); } else if (includeRootIncidents != null && includeRootIncidents) { query.includeRootIncidents();
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml") public void testIncludeRootIncidentsFails() { runtimeService.startProcessInstanceByKey("callExampleSubProcess"); executeAvailableJobs(); try { managementService .createProcessDefinitionStatisticsQuery() .includeIncidents() .includeRootIncidents() .list(); } catch (ProcessEngineException e) { Assert.assertThat(e.getMessage(), containsString("It is not possible to use includeIncident() and includeRootIncidents() to execute one query")); } }
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml") public void testIncludeRootIncidentsOnly() { runtimeService.startProcessInstanceByKey("callExampleSubProcess"); executeAvailableJobs(); List<ProcessDefinitionStatistics> statistics = managementService .createProcessDefinitionStatisticsQuery() .includeRootIncidents() .list(); // two process definitions assertEquals(2, statistics.size()); for (ProcessDefinitionStatistics definitionResult : statistics) { if (definitionResult.getKey().equals("callExampleSubProcess")) { // there is no root incidents assertTrue(definitionResult.getIncidentStatistics().isEmpty()); } else if (definitionResult.getKey().equals("ExampleProcess")) { // there is one root incident assertFalse(definitionResult.getIncidentStatistics().isEmpty()); assertEquals(1, definitionResult.getIncidentStatistics().size()); assertEquals(1, definitionResult.getIncidentStatistics().get(0).getIncidentCount()); } else { // fail if the process definition key does not match fail(); } } }