ConfigurationManagementServiceImpl implements ConfigurationManagementService { @Override public void removeRepositoryFromAssociatedGroups(String storageId, String repositoryId) throws IOException { modifyInLock(configuration -> { List<Repository> includedInGroupRepositories = getConfiguration().getGroupRepositoriesContaining( storageId, repositoryId); if (!includedInGroupRepositories.isEmpty()) { for (Repository repository : includedInGroupRepositories) { configuration.getStorage(repository.getStorage().getId()) .getRepository(repository.getId()) .getGroupRepositories().remove(repositoryId); } } }); }  @PostConstruct void init(); @Override MutableConfiguration getMutableConfigurationClone(); @Override Configuration getConfiguration(); @Override void setConfiguration(MutableConfiguration newConf); @Override void setInstanceName(String instanceName); @Override void setBaseUrl(String baseUrl); @Override void setPort(int port); @Override void setProxyConfiguration(String storageId,
                                      String repositoryId,
                                      MutableProxyConfiguration proxyConfiguration); @Override void saveStorage(StorageDto storage); @Override void addStorageIfNotExists(StorageDto storage); @Override void removeStorage(String storageId); @Override void saveRepository(String storageId,
                               RepositoryDto repository); @Override void removeRepositoryFromAssociatedGroups(String storageId,
                                                     String repositoryId); @Override void removeRepository(String storageId,
                                 String repositoryId); @Override void setProxyRepositoryMaxConnections(String storageId,
                                                 String repositoryId,
                                                 int numberOfConnections); @Override MutableRoutingRules getRoutingRules(); @Override MutableRoutingRule getRoutingRule(UUID uuid); @Override boolean updateRoutingRule(UUID uuid,
                                     MutableRoutingRule routingRule); @Override boolean addRoutingRule(MutableRoutingRule routingRule); @Override boolean removeRoutingRule(UUID uuid); @Override void addRepositoryToGroup(String storageId,
                                     String repositoryId,
                                     String repositoryGroupMemberId); @Override void setRepositoryArtifactCoordinateValidators(); @Override void putInService(final String storageId,
                             final String repositoryId); @Override void putOutOfService(final String storageId,
                                final String repositoryId); @Override void setArtifactMaxSize(final String storageId,
                                   final String repositoryId,
                                   final long value); @Override void set(final MutableRemoteRepositoryRetryArtifactDownloadConfiguration remoteRepositoryRetryArtifactDownloadConfiguration); @Override void addRepositoryArtifactCoordinateValidator(final String storageId,
                                                         final String repositoryId,
                                                         final String alias); @Override boolean removeRepositoryArtifactCoordinateValidator(final String storageId,
                                                               final String repositoryId,
                                                               final String alias); @Override void setCorsAllowedOrigins(final List<String> allowedOrigins); @Override void setSmtpSettings(MutableSmtpConfiguration smtpConfiguration);  }
@ExtendWith(RepositoryManagementTestExecutionListener.class) @Test public void testRemoveRepositoryFromAssociatedGroups(@RawRepository(repositoryId = REPOSITORY_RELEASES_1) Repository releases1, @Group(repositories = REPOSITORY_RELEASES_1) @RawRepository(repositoryId = REPOSITORY_GROUP_1) Repository releasesGroup1, @Group(repositories = REPOSITORY_RELEASES_1) @RawRepository(repositoryId = REPOSITORY_GROUP_2) Repository releasesGroup2) throws IOException { final String storageId = releases1.getStorage().getId(); final String releases1Id = releases1.getId(); assertThat(configurationManagementService.getConfiguration() .getGroupRepositoriesContaining(storageId, releases1Id)) .as("Failed to add repository to group!") .hasSize(2); configurationManagementService.removeRepositoryFromAssociatedGroups(storageId, releases1Id); assertThat(configurationManagementService.getConfiguration() .getGroupRepositoriesContaining(storageId, releases1Id)) .as("Failed to remove repository from all associated groups!") .isEmpty(); }