Search in sources :

Example 16 with DurationReportResult

use of org.camunda.bpm.engine.history.DurationReportResult in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByStartedAfterAndStartedBeforeByMonth.

public void testReportByStartedAfterAndStartedBeforeByMonth() {
    // given
    deployment(createProcessWithUserTask("process"));
    DurationReportResultAssertion assertion = createReportScenario().periodUnit(MONTH).startAndCompleteProcessInstance("process", 2016, 1, 15, 10, // 15.02.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 2, 1, 10, // 01.03.2016 10:00
    0).done();
    createReportScenario().startAndCompleteProcessInstance("process", 2016, 3, 15, 10, // 15.04.2016 10:00
    0).done();
    Calendar calendar = Calendar.getInstance();
    calendar.set(2016, 0, 1, 0, 0, 0);
    Date after = calendar.getTime();
    calendar.set(2016, 2, 31, 23, 59, 59);
    Date before = calendar.getTime();
    // when
    List<DurationReportResult> result = historyService.createHistoricProcessInstanceReport().startedAfter(after).startedBefore(before).duration(MONTH);
    // then
    assertThat(result).matches(assertion);
}
Also used : Calendar(java.util.Calendar) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult) Date(java.util.Date)

Example 17 with DurationReportResult

use of org.camunda.bpm.engine.history.DurationReportResult in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByStartedAfterByMonth.

public void testReportByStartedAfterByMonth() {
    // given
    deployment(createProcessWithUserTask("process"));
    createReportScenario().startAndCompleteProcessInstance("process", 2015, 11, 15, 10, // 15.12.2015 10:00
    0).done();
    DurationReportResultAssertion assertion = createReportScenario().periodUnit(MONTH).startAndCompleteProcessInstance("process", 2016, 3, 1, 10, // 01.04.2016 10:00
    0).done();
    Calendar calendar = Calendar.getInstance();
    calendar.set(2016, 0, 1, 0, 0, 0);
    // when
    List<DurationReportResult> result = historyService.createHistoricProcessInstanceReport().startedAfter(calendar.getTime()).duration(MONTH);
    // then
    assertThat(result).matches(assertion);
}
Also used : Calendar(java.util.Calendar) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult)

Example 18 with DurationReportResult

use of org.camunda.bpm.engine.history.DurationReportResult in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByStartedAfterByQuarter.

public void testReportByStartedAfterByQuarter() {
    // given
    deployment(createProcessWithUserTask("process"));
    createReportScenario().startAndCompleteProcessInstance("process", 2015, 11, 15, 10, // 15.12.2015 10:00
    0).done();
    DurationReportResultAssertion assertion = createReportScenario().periodUnit(QUARTER).startAndCompleteProcessInstance("process", 2016, 3, 1, 10, // 01.04.2016 10:00
    0).done();
    Calendar calendar = Calendar.getInstance();
    calendar.set(2016, 0, 1, 0, 0, 0);
    // when
    List<DurationReportResult> result = historyService.createHistoricProcessInstanceReport().startedAfter(calendar.getTime()).duration(QUARTER);
    // then
    assertThat(result).matches(assertion);
}
Also used : Calendar(java.util.Calendar) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult)

Example 19 with DurationReportResult

use of org.camunda.bpm.engine.history.DurationReportResult in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByStartedBeforeByQuarter.

public void testReportByStartedBeforeByQuarter() {
    // given
    deployment(createProcessWithUserTask("process"));
    DurationReportResultAssertion assertion = createReportScenario().periodUnit(QUARTER).startAndCompleteProcessInstance("process", 2016, 0, 15, 10, // 15.01.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 0, 15, 10, // 15.01.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 0, 15, 10, // 15.01.2016 10:00
    0).done();
    // start a second process instance
    createReportScenario().startAndCompleteProcessInstance("process", 2016, 3, 1, 10, // 01.04.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 3, 1, 10, // 01.04.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 3, 1, 10, // 01.04.2016 10:00
    0).done();
    Calendar calendar = Calendar.getInstance();
    calendar.set(2016, 0, 16, 0, 0, 0);
    // when
    List<DurationReportResult> result = historyService.createHistoricProcessInstanceReport().startedBefore(calendar.getTime()).duration(QUARTER);
    // then
    assertThat(result).matches(assertion);
}
Also used : Calendar(java.util.Calendar) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult)

Example 20 with DurationReportResult

use of org.camunda.bpm.engine.history.DurationReportResult in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByStartedAfterAndStartedBeforeByQuarter.

public void testReportByStartedAfterAndStartedBeforeByQuarter() {
    // given
    deployment(createProcessWithUserTask("process"));
    DurationReportResultAssertion assertion = createReportScenario().periodUnit(QUARTER).startAndCompleteProcessInstance("process", 2016, 1, 15, 10, // 15.02.2016 10:00
    0).startAndCompleteProcessInstance("process", 2016, 2, 1, 10, // 01.03.2016 10:00
    0).done();
    createReportScenario().startAndCompleteProcessInstance("process", 2016, 3, 15, 10, // 15.04.2016 10:00
    0).done();
    Calendar calendar = Calendar.getInstance();
    calendar.set(2016, 0, 1, 0, 0, 0);
    Date after = calendar.getTime();
    calendar.set(2016, 2, 31, 23, 59, 59);
    Date before = calendar.getTime();
    // when
    List<DurationReportResult> result = historyService.createHistoricProcessInstanceReport().startedAfter(after).startedBefore(before).duration(QUARTER);
    // then
    assertThat(result).matches(assertion);
}
Also used : Calendar(java.util.Calendar) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult) Date(java.util.Date)

Aggregations

DurationReportResult (org.camunda.bpm.engine.history.DurationReportResult)21 Calendar (java.util.Calendar)9 Date (java.util.Date)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 HistoricProcessInstanceReport (org.camunda.bpm.engine.history.HistoricProcessInstanceReport)1 HistoricTaskInstance (org.camunda.bpm.engine.history.HistoricTaskInstance)1 HistoricTaskInstanceReport (org.camunda.bpm.engine.history.HistoricTaskInstanceReport)1 HistoricTaskInstanceReportResult (org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult)1 ReportResult (org.camunda.bpm.engine.history.ReportResult)1 MockProvider.createMockHistoricTaskInstanceReport (org.camunda.bpm.engine.rest.helper.MockProvider.createMockHistoricTaskInstanceReport)1