@Test void testOperationTimeWithTwoSubProcesses() { Map<String, ProcessTime> processTimes = new HashMap<>(); processTimes.put(CORRELATION_ID, createProcessTime(100, 200)); processTimes.put("id-1", createProcessTime(50, 100)); processTimes.put("id-2", createProcessTime(70, 300)); ProcessTime overallProcessTime = operationTimeAggregator.computeOverallProcessTime(CORRELATION_ID, processTimes); assertEquals(100, overallProcessTime.getProcessDuration()); assertEquals(600, overallProcessTime.getDelayBetweenSteps()); }
public ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes) { ProcessTime rootProcessTime = processTimes.get(correlationId); long overallDelayBetweenSteps = processTimes.values() .stream() .mapToLong(ProcessTime::getDelayBetweenSteps) .sum(); return ImmutableProcessTime.copyOf(rootProcessTime) .withDelayBetweenSteps(overallDelayBetweenSteps); }
OperationTimeAggregator { public ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes) { ProcessTime rootProcessTime = processTimes.get(correlationId); long overallDelayBetweenSteps = processTimes.values() .stream() .mapToLong(ProcessTime::getDelayBetweenSteps) .sum(); return ImmutableProcessTime.copyOf(rootProcessTime) .withDelayBetweenSteps(overallDelayBetweenSteps); } }
OperationTimeAggregator { public ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes) { ProcessTime rootProcessTime = processTimes.get(correlationId); long overallDelayBetweenSteps = processTimes.values() .stream() .mapToLong(ProcessTime::getDelayBetweenSteps) .sum(); return ImmutableProcessTime.copyOf(rootProcessTime) .withDelayBetweenSteps(overallDelayBetweenSteps); } @Inject  OperationTimeAggregator(FlowableFacade flowableFacade); }
OperationTimeAggregator { public ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes) { ProcessTime rootProcessTime = processTimes.get(correlationId); long overallDelayBetweenSteps = processTimes.values() .stream() .mapToLong(ProcessTime::getDelayBetweenSteps) .sum(); return ImmutableProcessTime.copyOf(rootProcessTime) .withDelayBetweenSteps(overallDelayBetweenSteps); } @Inject  OperationTimeAggregator(FlowableFacade flowableFacade); Map<String, ProcessTime> collectProcessTimes(String correlationId); ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes); }
OperationTimeAggregator { public ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes) { ProcessTime rootProcessTime = processTimes.get(correlationId); long overallDelayBetweenSteps = processTimes.values() .stream() .mapToLong(ProcessTime::getDelayBetweenSteps) .sum(); return ImmutableProcessTime.copyOf(rootProcessTime) .withDelayBetweenSteps(overallDelayBetweenSteps); } @Inject  OperationTimeAggregator(FlowableFacade flowableFacade); Map<String, ProcessTime> collectProcessTimes(String correlationId); ProcessTime computeOverallProcessTime(String correlationId, Map<String, ProcessTime> processTimes);  }