Package org.camunda.bpm.engine.management

Examples of org.camunda.bpm.engine.management.ProcessDefinitionStatistics


        .includeIncidentsForType("failedJob")
        .list();

    Assert.assertEquals(2, statistics.size());

    ProcessDefinitionStatistics definitionResult = statistics.get(0);
    Assert.assertEquals(1, definitionResult.getInstances());
    Assert.assertEquals(0, definitionResult.getFailedJobs());

    assertTrue(definitionResult.getIncidentStatistics().isEmpty());

    definitionResult = statistics.get(1);
    Assert.assertEquals(1, definitionResult.getInstances());
    Assert.assertEquals(0, definitionResult.getFailedJobs());

    assertTrue(definitionResult.getIncidentStatistics().isEmpty());

    repositoryService.deleteDeployment(deployment.getId(), true);
  }
View Full Code Here


        .includeFailedJobs()
        .list();

    Assert.assertEquals(2, statistics.size());

    ProcessDefinitionStatistics callExampleSubProcessStaticstics = null;
    ProcessDefinitionStatistics exampleSubProcessStaticstics = null;

    for (ProcessDefinitionStatistics current : statistics) {
      if (current.getKey().equals("callExampleSubProcess")) {
        callExampleSubProcessStaticstics = current;
      } else if (current.getKey().equals("ExampleProcess")) {
        exampleSubProcessStaticstics = current;
      } else {
        fail(current.getKey() + " was not expected.");
      }
    }

    assertNotNull(callExampleSubProcessStaticstics);
    assertNotNull(exampleSubProcessStaticstics);

    // "super" process definition
    assertEquals(1, callExampleSubProcessStaticstics.getInstances());
    assertEquals(0, callExampleSubProcessStaticstics.getFailedJobs());

    assertFalse(callExampleSubProcessStaticstics.getIncidentStatistics().isEmpty());
    assertEquals(1, callExampleSubProcessStaticstics.getIncidentStatistics().size());

    IncidentStatistics incidentStatistics = callExampleSubProcessStaticstics.getIncidentStatistics().get(0);
    assertEquals(FailedJobIncidentHandler.INCIDENT_HANDLER_TYPE, incidentStatistics.getIncidentType());
    assertEquals(1, incidentStatistics.getIncidentCount());

    // "called" process definition
    assertEquals(1, exampleSubProcessStaticstics.getInstances());
    assertEquals(1, exampleSubProcessStaticstics.getFailedJobs());

    assertFalse(exampleSubProcessStaticstics.getIncidentStatistics().isEmpty());
    assertEquals(1, exampleSubProcessStaticstics.getIncidentStatistics().size());

    incidentStatistics = exampleSubProcessStaticstics.getIncidentStatistics().get(0);
    assertEquals(FailedJobIncidentHandler.INCIDENT_HANDLER_TYPE, incidentStatistics.getIncidentType());
    assertEquals(1, incidentStatistics.getIncidentCount());
  }
View Full Code Here

    return mock;
  }

  // statistics
  public static List<ProcessDefinitionStatistics> createMockProcessDefinitionStatistics() {
    ProcessDefinitionStatistics statistics = mock(ProcessDefinitionStatistics.class);
    when(statistics.getFailedJobs()).thenReturn(EXAMPLE_FAILED_JOBS);
    when(statistics.getInstances()).thenReturn(EXAMPLE_INSTANCES);
    when(statistics.getId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
    when(statistics.getName()).thenReturn(EXAMPLE_PROCESS_DEFINITION_NAME);
    when(statistics.getKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY);

    IncidentStatistics incidentStaticits = mock(IncidentStatistics.class);
    when(incidentStaticits.getIncidentType()).thenReturn(EXAMPLE_INCIDENT_TYPE);
    when(incidentStaticits.getIncidentCount()).thenReturn(EXAMPLE_INCIDENT_COUNT);

    List<IncidentStatistics> exampleIncidentList = new ArrayList<IncidentStatistics>();
    exampleIncidentList.add(incidentStaticits);
    when(statistics.getIncidentStatistics()).thenReturn(exampleIncidentList);

    ProcessDefinitionStatistics anotherStatistics = mock(ProcessDefinitionStatistics.class);
    when(anotherStatistics.getFailedJobs()).thenReturn(ANOTHER_EXAMPLE_FAILED_JOBS);
    when(anotherStatistics.getInstances()).thenReturn(ANOTHER_EXAMPLE_INSTANCES);
    when(anotherStatistics.getId()).thenReturn(ANOTHER_EXAMPLE_PROCESS_DEFINITION_ID);
    when(anotherStatistics.getName()).thenReturn(EXAMPLE_PROCESS_DEFINITION_NAME);
    when(anotherStatistics.getKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY);

    IncidentStatistics anotherIncidentStaticits = mock(IncidentStatistics.class);
    when(anotherIncidentStaticits.getIncidentType()).thenReturn(ANOTHER_EXAMPLE_INCIDENT_TYPE);
    when(anotherIncidentStaticits.getIncidentCount()).thenReturn(ANOTHER_EXAMPLE_INCIDENT_COUNT);

    List<IncidentStatistics> anotherExampleIncidentList = new ArrayList<IncidentStatistics>();
    anotherExampleIncidentList.add(anotherIncidentStaticits);
    when(anotherStatistics.getIncidentStatistics()).thenReturn(anotherExampleIncidentList);

    List<ProcessDefinitionStatistics> processDefinitionResults = new ArrayList<ProcessDefinitionStatistics>();
    processDefinitionResults.add(statistics);
    processDefinitionResults.add(anotherStatistics);
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.management.ProcessDefinitionStatistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.