@Test public void testGroupMembersProcessed() throws Exception { Repository repo1 = mockRepo(); Repository repo2 = mockRepo(); Repository repoGroup = mockGroup(newArrayList(repo1, repo2)); when(repositoryManager.browse()).thenReturn(newArrayList(repoGroup)); taskUnderTest.execute(); verifyGroups(repoGroup); verifyRepoProcessed(repo1, 1); verifyRepoProcessed(repo2, 1); verify(removeSnapshotsFacet, times(2)).removeSnapshots(any()); }
@Override protected void execute(final Repository repository) { if (hasBeenProcessed(repository)) { log.debug("Skipping repository '{}'; it has already been processed", repository.getName()); return; } if (isGroupRepository(repository)) { markProcessed(repository); repository.facet(GroupFacet.class).members().stream().filter(this::appliesTo).forEach(this::execute); } else { log.info("Executing removal of snapshots on repository '{}'", repository.getName()); TaskConfiguration config = getConfiguration(); RemoveSnapshotsConfig removeSnapshotsConfig = new RemoveSnapshotsConfig( config.getInteger(MINIMUM_SNAPSHOT_RETAINED_COUNT, 1), config.getInteger(SNAPSHOT_RETENTION_DAYS, 30), config.getBoolean(REMOVE_IF_RELEASED, false), config.getInteger(GRACE_PERIOD, -1)); repository.facet(RemoveSnapshotsFacet.class).removeSnapshots(removeSnapshotsConfig); markProcessed(repository); } }
RemoveSnapshotsTask extends RepositoryTaskSupport { @Override protected void execute(final Repository repository) { if (hasBeenProcessed(repository)) { log.debug("Skipping repository '{}'; it has already been processed", repository.getName()); return; } if (isGroupRepository(repository)) { markProcessed(repository); repository.facet(GroupFacet.class).members().stream().filter(this::appliesTo).forEach(this::execute); } else { log.info("Executing removal of snapshots on repository '{}'", repository.getName()); TaskConfiguration config = getConfiguration(); RemoveSnapshotsConfig removeSnapshotsConfig = new RemoveSnapshotsConfig( config.getInteger(MINIMUM_SNAPSHOT_RETAINED_COUNT, 1), config.getInteger(SNAPSHOT_RETENTION_DAYS, 30), config.getBoolean(REMOVE_IF_RELEASED, false), config.getInteger(GRACE_PERIOD, -1)); repository.facet(RemoveSnapshotsFacet.class).removeSnapshots(removeSnapshotsConfig); markProcessed(repository); } } }
RemoveSnapshotsTask extends RepositoryTaskSupport { @Override protected void execute(final Repository repository) { if (hasBeenProcessed(repository)) { log.debug("Skipping repository '{}'; it has already been processed", repository.getName()); return; } if (isGroupRepository(repository)) { markProcessed(repository); repository.facet(GroupFacet.class).members().stream().filter(this::appliesTo).forEach(this::execute); } else { log.info("Executing removal of snapshots on repository '{}'", repository.getName()); TaskConfiguration config = getConfiguration(); RemoveSnapshotsConfig removeSnapshotsConfig = new RemoveSnapshotsConfig( config.getInteger(MINIMUM_SNAPSHOT_RETAINED_COUNT, 1), config.getInteger(SNAPSHOT_RETENTION_DAYS, 30), config.getBoolean(REMOVE_IF_RELEASED, false), config.getInteger(GRACE_PERIOD, -1)); repository.facet(RemoveSnapshotsFacet.class).removeSnapshots(removeSnapshotsConfig); markProcessed(repository); } } @Inject  RemoveSnapshotsTask(@Named(Maven2Format.NAME) final Format maven2Format); }
RemoveSnapshotsTask extends RepositoryTaskSupport { @Override protected void execute(final Repository repository) { if (hasBeenProcessed(repository)) { log.debug("Skipping repository '{}'; it has already been processed", repository.getName()); return; } if (isGroupRepository(repository)) { markProcessed(repository); repository.facet(GroupFacet.class).members().stream().filter(this::appliesTo).forEach(this::execute); } else { log.info("Executing removal of snapshots on repository '{}'", repository.getName()); TaskConfiguration config = getConfiguration(); RemoveSnapshotsConfig removeSnapshotsConfig = new RemoveSnapshotsConfig( config.getInteger(MINIMUM_SNAPSHOT_RETAINED_COUNT, 1), config.getInteger(SNAPSHOT_RETENTION_DAYS, 30), config.getBoolean(REMOVE_IF_RELEASED, false), config.getInteger(GRACE_PERIOD, -1)); repository.facet(RemoveSnapshotsFacet.class).removeSnapshots(removeSnapshotsConfig); markProcessed(repository); } } @Inject  RemoveSnapshotsTask(@Named(Maven2Format.NAME) final Format maven2Format); @Override String getMessage(); }
RemoveSnapshotsTask extends RepositoryTaskSupport { @Override protected void execute(final Repository repository) { if (hasBeenProcessed(repository)) { log.debug("Skipping repository '{}'; it has already been processed", repository.getName()); return; } if (isGroupRepository(repository)) { markProcessed(repository); repository.facet(GroupFacet.class).members().stream().filter(this::appliesTo).forEach(this::execute); } else { log.info("Executing removal of snapshots on repository '{}'", repository.getName()); TaskConfiguration config = getConfiguration(); RemoveSnapshotsConfig removeSnapshotsConfig = new RemoveSnapshotsConfig( config.getInteger(MINIMUM_SNAPSHOT_RETAINED_COUNT, 1), config.getInteger(SNAPSHOT_RETENTION_DAYS, 30), config.getBoolean(REMOVE_IF_RELEASED, false), config.getInteger(GRACE_PERIOD, -1)); repository.facet(RemoveSnapshotsFacet.class).removeSnapshots(removeSnapshotsConfig); markProcessed(repository); } } @Inject  RemoveSnapshotsTask(@Named(Maven2Format.NAME) final Format maven2Format); @Override String getMessage();  }