@Test public void testDeleteDefaultRdsConfigs() { testRdsConfig.setStatus(ResourceStatus.USER_MANAGED); RDSConfig rdsConfig = new RDSConfig(); rdsConfig.setId(2L); rdsConfig.setStatus(ResourceStatus.DEFAULT); underTest.deleteDefaultRdsConfigs(Sets.newHashSet(testRdsConfig, rdsConfig)); verify(rdsConfigRepository).save(rdsConfig); verify(rdsConfigRepository, never()).delete(rdsConfig); assertEquals(ResourceStatus.USER_MANAGED, testRdsConfig.getStatus()); assertEquals(ResourceStatus.DEFAULT, rdsConfig.getStatus()); assertTrue(rdsConfig.isArchived()); }
public void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); rdsConfigs.stream() .filter(rdsConfig -> ResourceStatus.DEFAULT == rdsConfig.getStatus()) .forEach(this::delete); MDCBuilder.buildMdcContextFromMap(mdcContextMap); }
RdsConfigService extends AbstractWorkspaceAwareResourceService<RDSConfig> { public void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); rdsConfigs.stream() .filter(rdsConfig -> ResourceStatus.DEFAULT == rdsConfig.getStatus()) .forEach(this::delete); MDCBuilder.buildMdcContextFromMap(mdcContextMap); } }
RdsConfigService extends AbstractWorkspaceAwareResourceService<RDSConfig> { public void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); rdsConfigs.stream() .filter(rdsConfig -> ResourceStatus.DEFAULT == rdsConfig.getStatus()) .forEach(this::delete); MDCBuilder.buildMdcContextFromMap(mdcContextMap); }  }
RdsConfigService extends AbstractWorkspaceAwareResourceService<RDSConfig> { public void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); rdsConfigs.stream() .filter(rdsConfig -> ResourceStatus.DEFAULT == rdsConfig.getStatus()) .forEach(this::delete); MDCBuilder.buildMdcContextFromMap(mdcContextMap); }  Set<RDSConfig> findByNamesInWorkspace(Set<String> names, @NotNull Long workspaceId); Set<RDSConfig> retrieveRdsConfigsInWorkspace(Workspace workspace); RDSConfig getByNameForWorkspace(String name, Workspace workspace); RDSConfig get(Long id); RDSConfig getByStackCrnAndType(String stackCrn, DatabaseType databaseType); @Override RDSConfig delete(RDSConfig rdsConfig); RDSConfig createIfNotExists(User user, RDSConfig rdsConfig, Long workspaceId); Set<RDSConfig> findByClusterId(Long clusterId); RDSConfig findByClusterIdAndType(Long clusterId, DatabaseType databaseType); void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs); Set<RDSConfig> findAllByWorkspaceId(Long workspaceId); @Override WorkspaceResourceRepository<RDSConfig, Long> repository(); Set<Cluster> getClustersUsingResource(RDSConfig rdsConfig); RDSConfig resolveVaultValues(RDSConfig config); }
RdsConfigService extends AbstractWorkspaceAwareResourceService<RDSConfig> { public void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs) { Map<String, String> mdcContextMap = MDCBuilder.getMdcContextMap(); rdsConfigs.stream() .filter(rdsConfig -> ResourceStatus.DEFAULT == rdsConfig.getStatus()) .forEach(this::delete); MDCBuilder.buildMdcContextFromMap(mdcContextMap); }  Set<RDSConfig> findByNamesInWorkspace(Set<String> names, @NotNull Long workspaceId); Set<RDSConfig> retrieveRdsConfigsInWorkspace(Workspace workspace); RDSConfig getByNameForWorkspace(String name, Workspace workspace); RDSConfig get(Long id); RDSConfig getByStackCrnAndType(String stackCrn, DatabaseType databaseType); @Override RDSConfig delete(RDSConfig rdsConfig); RDSConfig createIfNotExists(User user, RDSConfig rdsConfig, Long workspaceId); Set<RDSConfig> findByClusterId(Long clusterId); RDSConfig findByClusterIdAndType(Long clusterId, DatabaseType databaseType); void deleteDefaultRdsConfigs(Set<RDSConfig> rdsConfigs); Set<RDSConfig> findAllByWorkspaceId(Long workspaceId); @Override WorkspaceResourceRepository<RDSConfig, Long> repository(); Set<Cluster> getClustersUsingResource(RDSConfig rdsConfig); RDSConfig resolveVaultValues(RDSConfig config);  }