@Test void testExpiredOperationsAreDeleted() { when(operationService.createQuery()).thenReturn(operationQuery); OperationQuery mock = new MockBuilder<>(operationQuery).on(query -> query.startedBefore(EXPIRATION_TIME)) .build(); cleaner.execute(EXPIRATION_TIME); verify(mock).delete(); }
@Override public void execute(Date expirationTime) { LOGGER.debug(CleanUpJob.LOG_MARKER, format(Messages.DELETING_OPERATIONS_STARTED_BEFORE_0, expirationTime)); int abortedOperations = abortActiveOperations(expirationTime); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.ABORTED_OPERATIONS_0, abortedOperations)); int deletedOperations = operationService.createQuery() .startedBefore(expirationTime) .inFinalState() .delete(); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.DELETED_OPERATIONS_0, deletedOperations)); }
OperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { LOGGER.debug(CleanUpJob.LOG_MARKER, format(Messages.DELETING_OPERATIONS_STARTED_BEFORE_0, expirationTime)); int abortedOperations = abortActiveOperations(expirationTime); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.ABORTED_OPERATIONS_0, abortedOperations)); int deletedOperations = operationService.createQuery() .startedBefore(expirationTime) .inFinalState() .delete(); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.DELETED_OPERATIONS_0, deletedOperations)); } }
OperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { LOGGER.debug(CleanUpJob.LOG_MARKER, format(Messages.DELETING_OPERATIONS_STARTED_BEFORE_0, expirationTime)); int abortedOperations = abortActiveOperations(expirationTime); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.ABORTED_OPERATIONS_0, abortedOperations)); int deletedOperations = operationService.createQuery() .startedBefore(expirationTime) .inFinalState() .delete(); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.DELETED_OPERATIONS_0, deletedOperations)); } @Inject  OperationsCleaner(OperationService operationService, ProcessActionRegistry processActionRegistry); }
OperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { LOGGER.debug(CleanUpJob.LOG_MARKER, format(Messages.DELETING_OPERATIONS_STARTED_BEFORE_0, expirationTime)); int abortedOperations = abortActiveOperations(expirationTime); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.ABORTED_OPERATIONS_0, abortedOperations)); int deletedOperations = operationService.createQuery() .startedBefore(expirationTime) .inFinalState() .delete(); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.DELETED_OPERATIONS_0, deletedOperations)); } @Inject  OperationsCleaner(OperationService operationService, ProcessActionRegistry processActionRegistry); OperationsCleaner withPageSize(int pageSize); @Override void execute(Date expirationTime); }
OperationsCleaner implements Cleaner { @Override public void execute(Date expirationTime) { LOGGER.debug(CleanUpJob.LOG_MARKER, format(Messages.DELETING_OPERATIONS_STARTED_BEFORE_0, expirationTime)); int abortedOperations = abortActiveOperations(expirationTime); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.ABORTED_OPERATIONS_0, abortedOperations)); int deletedOperations = operationService.createQuery() .startedBefore(expirationTime) .inFinalState() .delete(); LOGGER.info(CleanUpJob.LOG_MARKER, format(Messages.DELETED_OPERATIONS_0, deletedOperations)); } @Inject  OperationsCleaner(OperationService operationService, ProcessActionRegistry processActionRegistry); OperationsCleaner withPageSize(int pageSize); @Override void execute(Date expirationTime);  }