@Test public void testGetRequiredHostGroups___invalidComponentCountOfZero() throws Exception { Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); Map<String, String> coreSiteMap = new HashMap<String, String>(); properties.put("core-site", coreSiteMap); coreSiteMap.put("fs.defaultFS", "localhost"); Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap()); expect(stack.getCardinality("NAMENODE")).andReturn(new Cardinality("1")).anyTimes(); Collection<String> hgComponents1 = new HashSet<String>(); hgComponents1.add("HIVE_SERVER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents1, Collections.singleton("host1")); Collection<String> hgComponents2 = new HashSet<String>(); hgComponents2.add("DATANODE"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("host2")); Collection<TestHostGroup> hostGroups = new ArrayList<TestHostGroup>(); hostGroups.add(group1); hostGroups.add(group2); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); BlueprintConfigurationProcessor updater = new BlueprintConfigurationProcessor(topology); Collection<String> requiredGroups = updater.getRequiredHostGroups(); assertEquals(0, requiredGroups.size()); }
public Collection<String> getRequiredHostGroups() { Collection<String> requiredHostGroups = new HashSet<String>(); for (Map<String, Map<String, PropertyUpdater>> updaterMap : createCollectionOfUpdaters()) { for (Map.Entry<String, Map<String, PropertyUpdater>> entry : updaterMap.entrySet()) { String type = entry.getKey(); for (Map.Entry<String, PropertyUpdater> updaterEntry : entry.getValue().entrySet()) { String propertyName = updaterEntry.getKey(); PropertyUpdater updater = updaterEntry.getValue(); Map<String, Map<String, String>> clusterProps = clusterTopology.getConfiguration().getFullProperties(); Map<String, String> typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); } for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) { Map<String, Map<String, String>> hgConfigProps = groupInfo.getConfiguration().getProperties(); Map<String, String> hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); } } } } } return requiredHostGroups; }
BlueprintConfigurationProcessor { public Collection<String> getRequiredHostGroups() { Collection<String> requiredHostGroups = new HashSet<String>(); for (Map<String, Map<String, PropertyUpdater>> updaterMap : createCollectionOfUpdaters()) { for (Map.Entry<String, Map<String, PropertyUpdater>> entry : updaterMap.entrySet()) { String type = entry.getKey(); for (Map.Entry<String, PropertyUpdater> updaterEntry : entry.getValue().entrySet()) { String propertyName = updaterEntry.getKey(); PropertyUpdater updater = updaterEntry.getValue(); Map<String, Map<String, String>> clusterProps = clusterTopology.getConfiguration().getFullProperties(); Map<String, String> typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); } for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) { Map<String, Map<String, String>> hgConfigProps = groupInfo.getConfiguration().getProperties(); Map<String, String> hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); } } } } } return requiredHostGroups; } }
BlueprintConfigurationProcessor { public Collection<String> getRequiredHostGroups() { Collection<String> requiredHostGroups = new HashSet<String>(); for (Map<String, Map<String, PropertyUpdater>> updaterMap : createCollectionOfUpdaters()) { for (Map.Entry<String, Map<String, PropertyUpdater>> entry : updaterMap.entrySet()) { String type = entry.getKey(); for (Map.Entry<String, PropertyUpdater> updaterEntry : entry.getValue().entrySet()) { String propertyName = updaterEntry.getKey(); PropertyUpdater updater = updaterEntry.getValue(); Map<String, Map<String, String>> clusterProps = clusterTopology.getConfiguration().getFullProperties(); Map<String, String> typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); } for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) { Map<String, Map<String, String>> hgConfigProps = groupInfo.getConfiguration().getProperties(); Map<String, String> hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); } } } } } return requiredHostGroups; } BlueprintConfigurationProcessor(ClusterTopology clusterTopology); }
BlueprintConfigurationProcessor { public Collection<String> getRequiredHostGroups() { Collection<String> requiredHostGroups = new HashSet<String>(); for (Map<String, Map<String, PropertyUpdater>> updaterMap : createCollectionOfUpdaters()) { for (Map.Entry<String, Map<String, PropertyUpdater>> entry : updaterMap.entrySet()) { String type = entry.getKey(); for (Map.Entry<String, PropertyUpdater> updaterEntry : entry.getValue().entrySet()) { String propertyName = updaterEntry.getKey(); PropertyUpdater updater = updaterEntry.getValue(); Map<String, Map<String, String>> clusterProps = clusterTopology.getConfiguration().getFullProperties(); Map<String, String> typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); } for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) { Map<String, Map<String, String>> hgConfigProps = groupInfo.getConfiguration().getProperties(); Map<String, String> hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); } } } } } return requiredHostGroups; } BlueprintConfigurationProcessor(ClusterTopology clusterTopology); Map<String, Map<String, PropertyUpdater>> getRemovePropertyUpdaters(); void initRemovePropertyUpdaters(); Collection<String> getRequiredHostGroups(); Set<String> doUpdateForClusterCreate(); void doUpdateForBlueprintExport(); void doNameNodeHAUpdate(); void doYarnResourceManagerHAUpdate(); void doOozieServerHAUpdate(); }
BlueprintConfigurationProcessor { public Collection<String> getRequiredHostGroups() { Collection<String> requiredHostGroups = new HashSet<String>(); for (Map<String, Map<String, PropertyUpdater>> updaterMap : createCollectionOfUpdaters()) { for (Map.Entry<String, Map<String, PropertyUpdater>> entry : updaterMap.entrySet()) { String type = entry.getKey(); for (Map.Entry<String, PropertyUpdater> updaterEntry : entry.getValue().entrySet()) { String propertyName = updaterEntry.getKey(); PropertyUpdater updater = updaterEntry.getValue(); Map<String, Map<String, String>> clusterProps = clusterTopology.getConfiguration().getFullProperties(); Map<String, String> typeMap = clusterProps.get(type); if (typeMap != null && typeMap.containsKey(propertyName) && typeMap.get(propertyName) != null) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, typeMap.get(propertyName), clusterProps, clusterTopology)); } for (HostGroupInfo groupInfo : clusterTopology.getHostGroupInfo().values()) { Map<String, Map<String, String>> hgConfigProps = groupInfo.getConfiguration().getProperties(); Map<String, String> hgTypeMap = hgConfigProps.get(type); if (hgTypeMap != null && hgTypeMap.containsKey(propertyName)) { requiredHostGroups.addAll(updater.getRequiredHostGroups( propertyName, hgTypeMap.get(propertyName), hgConfigProps, clusterTopology)); } } } } } return requiredHostGroups; } BlueprintConfigurationProcessor(ClusterTopology clusterTopology); Map<String, Map<String, PropertyUpdater>> getRemovePropertyUpdaters(); void initRemovePropertyUpdaters(); Collection<String> getRequiredHostGroups(); Set<String> doUpdateForClusterCreate(); void doUpdateForBlueprintExport(); void doNameNodeHAUpdate(); void doYarnResourceManagerHAUpdate(); void doOozieServerHAUpdate();  }