@Test public void ignoreRepositoryWhenCancelled() throws Exception { doAnswer(i -> { when(cancelledCheck.getAsBoolean()).thenReturn(true); return deletionProgress; }).when(cleanupMethod).run(repository1, ImmutableList.of(component1, component2), cancelledCheck); underTest.cleanup(cancelledCheck); verify(cleanupMethod).run(repository1, ImmutableList.of(component1, component2), cancelledCheck); verify(cleanupMethod, never()).run(repository2, ImmutableList.of(component3), cancelledCheck); }
@Override public void cleanup(final BooleanSupplier cancelledCheck) { AtomicLong totalDeletedCount = new AtomicLong(0L); repositoryManager.browse().forEach(repository -> { if (!cancelledCheck.getAsBoolean() && !repository.getType().equals(groupType)) { totalDeletedCount.addAndGet(this.cleanup(repository, cancelledCheck)); } }); log.info("{} components cleaned up across all repositories", totalDeletedCount.get()); }
OrientCleanupServiceImpl extends ComponentSupport implements CleanupService { @Override public void cleanup(final BooleanSupplier cancelledCheck) { AtomicLong totalDeletedCount = new AtomicLong(0L); repositoryManager.browse().forEach(repository -> { if (!cancelledCheck.getAsBoolean() && !repository.getType().equals(groupType)) { totalDeletedCount.addAndGet(this.cleanup(repository, cancelledCheck)); } }); log.info("{} components cleaned up across all repositories", totalDeletedCount.get()); } }
OrientCleanupServiceImpl extends ComponentSupport implements CleanupService { @Override public void cleanup(final BooleanSupplier cancelledCheck) { AtomicLong totalDeletedCount = new AtomicLong(0L); repositoryManager.browse().forEach(repository -> { if (!cancelledCheck.getAsBoolean() && !repository.getType().equals(groupType)) { totalDeletedCount.addAndGet(this.cleanup(repository, cancelledCheck)); } }); log.info("{} components cleaned up across all repositories", totalDeletedCount.get()); } @Inject  OrientCleanupServiceImpl(final RepositoryManager repositoryManager,
                            final OrientCleanupComponentBrowse browseService,
                            final CleanupPolicyStorage cleanupPolicyStorage,
                            final CleanupMethod cleanupMethod,
                            final GroupType groupType,
                            @Named("${nexus.cleanup.retries:-3}") final int cleanupRetryLimit); }
OrientCleanupServiceImpl extends ComponentSupport implements CleanupService { @Override public void cleanup(final BooleanSupplier cancelledCheck) { AtomicLong totalDeletedCount = new AtomicLong(0L); repositoryManager.browse().forEach(repository -> { if (!cancelledCheck.getAsBoolean() && !repository.getType().equals(groupType)) { totalDeletedCount.addAndGet(this.cleanup(repository, cancelledCheck)); } }); log.info("{} components cleaned up across all repositories", totalDeletedCount.get()); } @Inject  OrientCleanupServiceImpl(final RepositoryManager repositoryManager,
                            final OrientCleanupComponentBrowse browseService,
                            final CleanupPolicyStorage cleanupPolicyStorage,
                            final CleanupMethod cleanupMethod,
                            final GroupType groupType,
                            @Named("${nexus.cleanup.retries:-3}") final int cleanupRetryLimit); @Override void cleanup(final BooleanSupplier cancelledCheck); }
OrientCleanupServiceImpl extends ComponentSupport implements CleanupService { @Override public void cleanup(final BooleanSupplier cancelledCheck) { AtomicLong totalDeletedCount = new AtomicLong(0L); repositoryManager.browse().forEach(repository -> { if (!cancelledCheck.getAsBoolean() && !repository.getType().equals(groupType)) { totalDeletedCount.addAndGet(this.cleanup(repository, cancelledCheck)); } }); log.info("{} components cleaned up across all repositories", totalDeletedCount.get()); } @Inject  OrientCleanupServiceImpl(final RepositoryManager repositoryManager,
                            final OrientCleanupComponentBrowse browseService,
                            final CleanupPolicyStorage cleanupPolicyStorage,
                            final CleanupMethod cleanupMethod,
                            final GroupType groupType,
                            @Named("${nexus.cleanup.retries:-3}") final int cleanupRetryLimit); @Override void cleanup(final BooleanSupplier cancelledCheck); static final String CLEANUP_ATTRIBUTES_KEY; static final String CLEANUP_NAME_KEY; }