@Test public void getRoleConfigWhenIdBrokerAndWasbIntegratedFileSystem() { BaseFileSystemConfigurationsView fileSystemConfigurationsView = mock(BaseFileSystemConfigurationsView.class); when(fileSystemConfigurationsView.getType()).thenReturn("WASB_INTEGRATED"); TemplatePreparationObject tpo = new Builder() .withCloudPlatform(CloudPlatform.AZURE) .withFileSystemConfigurationView(fileSystemConfigurationsView) .withAccountMappingView(new AccountMappingView(GROUP_MAPPINGS, USER_MAPPINGS)) .withProductDetails(generateCMRepo(CMRepositoryVersionUtil.CLOUDERAMANAGER_VERSION_7_1_0), null) .build(); List<ApiClusterTemplateConfig> result = underTest.getRoleConfigs(IDBROKER, tpo); Map<String, String> configNameToValueMap = getConfigNameToValueMap(result); assertThat(configNameToValueMap).containsOnly( Map.entry(IDBROKER_AZURE_USER_MAPPING, USER_MAPPINGS_STR), Map.entry(IDBROKER_AZURE_GROUP_MAPPING, GROUP_MAPPINGS_STR) ); Map<String, String> configNameToVariableNameMap = getConfigNameToVariableNameMap(result); assertThat(configNameToVariableNameMap).isEmpty(); }
@Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case IDBROKER: List<ApiClusterTemplateConfig> config; AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView(); String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings()); String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings()); switch (getCloudPlatform(source)) { case AWS: config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings)); break; case AZURE: config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings))); ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm(); if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) { String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView()); if (Objects.nonNull(idBrokerManagedIdentity)) { config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity)); } } break; case GCP: config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings)); break; default: config = List.of(); break; } return config; default: return List.of(); } }
KnoxIdBrokerConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case IDBROKER: List<ApiClusterTemplateConfig> config; AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView(); String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings()); String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings()); switch (getCloudPlatform(source)) { case AWS: config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings)); break; case AZURE: config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings))); ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm(); if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) { String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView()); if (Objects.nonNull(idBrokerManagedIdentity)) { config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity)); } } break; case GCP: config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings)); break; default: config = List.of(); break; } return config; default: return List.of(); } } }
KnoxIdBrokerConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case IDBROKER: List<ApiClusterTemplateConfig> config; AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView(); String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings()); String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings()); switch (getCloudPlatform(source)) { case AWS: config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings)); break; case AZURE: config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings))); ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm(); if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) { String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView()); if (Objects.nonNull(idBrokerManagedIdentity)) { config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity)); } } break; case GCP: config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings)); break; default: config = List.of(); break; } return config; default: return List.of(); } }  }
KnoxIdBrokerConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case IDBROKER: List<ApiClusterTemplateConfig> config; AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView(); String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings()); String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings()); switch (getCloudPlatform(source)) { case AWS: config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings)); break; case AZURE: config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings))); ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm(); if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) { String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView()); if (Objects.nonNull(idBrokerManagedIdentity)) { config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity)); } } break; case GCP: config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings)); break; default: config = List.of(); break; } return config; default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); }
KnoxIdBrokerConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case IDBROKER: List<ApiClusterTemplateConfig> config; AccountMappingView accountMappingView = source.getAccountMappingView() == null ? AccountMappingView.EMPTY_MAPPING : source.getAccountMappingView(); String userMappings = getAccountMappingSetting(accountMappingView.getUserMappings()); String groupMappings = getAccountMappingSetting(accountMappingView.getGroupMappings()); switch (getCloudPlatform(source)) { case AWS: config = List.of(config("idbroker_aws_user_mapping", userMappings), config("idbroker_aws_group_mapping", groupMappings)); break; case AZURE: config = new ArrayList<>(List.of(config("idbroker_azure_user_mapping", userMappings), config("idbroker_azure_group_mapping", groupMappings))); ClouderaManagerRepo cmRepo = source.getProductDetailsView().getCm(); if (CMRepositoryVersionUtil.isIdBrokerManagedIdentitySupported(cmRepo)) { String idBrokerManagedIdentity = getIdBrokerManagedIdentity(source.getFileSystemConfigurationView()); if (Objects.nonNull(idBrokerManagedIdentity)) { config.add(config("idbroker_azure_vm_assumer_identity", idBrokerManagedIdentity)); } } break; case GCP: config = List.of(config("idbroker_gcp_user_mapping", userMappings), config("idbroker_gcp_group_mapping", groupMappings)); break; default: config = List.of(); break; } return config; default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes();  }