@Test void testExecute() { prepareMocksWithProcesses(List.of(new CustomProcess("foo", true), new CustomProcess("bar", true))); abortedOperationsCleaner.execute(new Date()); Mockito.verify(flowableFacade, Mockito.times(2)) .getProcessInstance(anyString()); Mockito.verify(flowableFacade) .deleteProcessInstance("foo", Operation.State.ABORTED.name()); Mockito.verify(flowableFacade) .deleteProcessInstance("bar", Operation.State.ABORTED.name()); }
@Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); }
AbortedOperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); } }
AbortedOperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); } @Inject  AbortedOperationsCleaner(HistoricOperationEventService historicOperationEventService, FlowableFacade flowableFacade); }
AbortedOperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); } @Inject  AbortedOperationsCleaner(HistoricOperationEventService historicOperationEventService, FlowableFacade flowableFacade); @Override void execute(Date expirationTime); }
AbortedOperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { Instant instant = Instant.now() .minus(30, ChronoUnit.MINUTES); List<HistoricOperationEvent> abortedOperations = historicOperationEventService.createQuery() .type(HistoricOperationEvent.EventType.ABORTED) .olderThan(new Date(instant.toEpochMilli())) .list(); abortedOperations.stream() .map(HistoricOperationEvent::getProcessId) .distinct() .filter(this::isInActiveState) .forEach(this::deleteProcessInstance); } @Inject  AbortedOperationsCleaner(HistoricOperationEventService historicOperationEventService, FlowableFacade flowableFacade); @Override void execute(Date expirationTime);  }