@Test public void testGetHMSStorageServiceConfigsWhenNoStorageConfigured() { TemplatePreparationObject preparationObject = getTemplatePreparationObject(false); String inputJson = getBlueprintText("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject); assertEquals(0, serviceConfigs.size()); }
@Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { List<ApiClusterTemplateConfig> hmsConfigs = new ArrayList<>(2); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_REPLICA_DIR, location.getValue()))); return hmsConfigs; }
HiveMetastoreCloudStorageServiceConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { List<ApiClusterTemplateConfig> hmsConfigs = new ArrayList<>(2); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_REPLICA_DIR, location.getValue()))); return hmsConfigs; } }
HiveMetastoreCloudStorageServiceConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { List<ApiClusterTemplateConfig> hmsConfigs = new ArrayList<>(2); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_REPLICA_DIR, location.getValue()))); return hmsConfigs; }  }
HiveMetastoreCloudStorageServiceConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { List<ApiClusterTemplateConfig> hmsConfigs = new ArrayList<>(2); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_REPLICA_DIR, location.getValue()))); return hmsConfigs; }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); }
HiveMetastoreCloudStorageServiceConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { List<ApiClusterTemplateConfig> hmsConfigs = new ArrayList<>(2); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_EXTERNAL_DIR) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM, location.getValue()))); ConfigUtils.getStorageLocationForServiceProperty(source, HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION) .ifPresent(location -> hmsConfigs.add(config(HMS_METASTORE_REPLICA_DIR, location.getValue()))); return hmsConfigs; }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); static final String HIVE_SERVICE_CONFIG_SAFETY_VALVE; static final String HMS_METASTORE_DIR; static final String HMS_METASTORE_EXTERNAL_DIR; static final String HMS_METASTORE_REPLICA_DIR_TEMPLATE_LOCATION; static final String HMS_METASTORE_REPLICA_DIR; static final String HMS_METASTORE_DIR_TEMPLATE_PARAM; static final String HMS_METASTORE_EXTERNAL_DIR_TEMPLATE_PARAM; }