@Test public void testGetSparkOnYarnRoleConfigsWhenNoStorageConfigured() { TemplatePreparationObject preparationObject = getTemplatePreparationObject(); String inputJson = getBlueprintText("input/clouderamanager-ds.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject); List<ApiClusterTemplateConfig> sparkOnYarnConfigs = roleConfigs.get("spark_on_yarn-GATEWAY-BASE"); assertEquals(0, sparkOnYarnConfigs.size()); }
@Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case SparkRoles.GATEWAY: return ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .map(location -> ConfigUtils.getBasePathFromStorageLocation(location.getValue())) .map(basePath -> List.of(config(SPARK_CONF_CLIENT_SAFETY_VALVE, SPARK_YARN_ACCESS_DIR_PARAM + basePath))) .orElseGet(List::of); default: return List.of(); } }
SparkOnYarnRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case SparkRoles.GATEWAY: return ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .map(location -> ConfigUtils.getBasePathFromStorageLocation(location.getValue())) .map(basePath -> List.of(config(SPARK_CONF_CLIENT_SAFETY_VALVE, SPARK_YARN_ACCESS_DIR_PARAM + basePath))) .orElseGet(List::of); default: return List.of(); } } }
SparkOnYarnRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case SparkRoles.GATEWAY: return ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .map(location -> ConfigUtils.getBasePathFromStorageLocation(location.getValue())) .map(basePath -> List.of(config(SPARK_CONF_CLIENT_SAFETY_VALVE, SPARK_YARN_ACCESS_DIR_PARAM + basePath))) .orElseGet(List::of); default: return List.of(); } }  }
SparkOnYarnRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case SparkRoles.GATEWAY: return ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .map(location -> ConfigUtils.getBasePathFromStorageLocation(location.getValue())) .map(basePath -> List.of(config(SPARK_CONF_CLIENT_SAFETY_VALVE, SPARK_YARN_ACCESS_DIR_PARAM + basePath))) .orElseGet(List::of); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); }
SparkOnYarnRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case SparkRoles.GATEWAY: return ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .map(location -> ConfigUtils.getBasePathFromStorageLocation(location.getValue())) .map(basePath -> List.of(config(SPARK_CONF_CLIENT_SAFETY_VALVE, SPARK_YARN_ACCESS_DIR_PARAM + basePath))) .orElseGet(List::of); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source);  }