@Test public void testAddingNewRootMap() { Map<String, Map> rootMap = ambariCluster.mergeMaps(testMap, newRootMap); assertEquals(rootMap.get("oozie-site").get("oozie.service.ProxyUserService.proxyuser.hue.hosts"), "*"); assertEquals(rootMap.get("hdfs-site").get("dfs.webhdfs.enabled"), "true"); }
protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }
AmbariClusterImpl extends BasicStartableImpl implements AmbariCluster { protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; } }
AmbariClusterImpl extends BasicStartableImpl implements AmbariCluster { protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }  }
AmbariClusterImpl extends BasicStartableImpl implements AmbariCluster { protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }  @Override void init(); @Override void start(Collection<? extends Location> locations); @Override Iterable<AmbariNode> getAmbariNodes(); @Override Iterable<AmbariAgent> getAmbariAgents(); @Override Iterable<AmbariServer> getAmbariServers(); @Override AmbariServer getMasterAmbariServer(); @Override List<String> getExtraStackDefinitionsUrls(); @Override void addHostsToHostGroup(String hostgroupName, List<AmbariAgent> hosts); @Override void addAlertNotification(String name, String description, Boolean global, String notificationType,
                                     List<String> alertStates, List<String> ambariDispatchRecipients,
                                     String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void editAlertNotification(String name, String description, Boolean global, String notificationType,
                                      List<String> alertStates, List<String> ambariDispatchRecipients,
                                      String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); void deleteAlertNotification(String name); @Override void addAlertGroup(String name,List<Integer> definitions); @Override void deployCluster(); @Override void postDeployCluster(); @Override boolean isClusterComplete(); }
AmbariClusterImpl extends BasicStartableImpl implements AmbariCluster { protected Map<String, Map> mergeMaps(Map<String, Map> configuration, Map<String, Map> servicesConfig) { if (servicesConfig == null) { return configuration; } MutableMap<String, Map> newConfigurationMap = MutableMap.copyOf(configuration); for (Map.Entry<String, Map> stringMapEntry : servicesConfig.entrySet()) { if(!newConfigurationMap.containsKey(stringMapEntry.getKey())) { newConfigurationMap.put(stringMapEntry.getKey(), stringMapEntry.getValue()); } else { if(stringMapEntry.getValue() != null) { MutableMap<String, Map> tmpMap = MutableMap.copyOf(stringMapEntry.getValue()); tmpMap.putAll(newConfigurationMap.get(stringMapEntry.getKey())); newConfigurationMap.put(stringMapEntry.getKey(), ImmutableMap.copyOf(tmpMap)); } } } return newConfigurationMap; }  @Override void init(); @Override void start(Collection<? extends Location> locations); @Override Iterable<AmbariNode> getAmbariNodes(); @Override Iterable<AmbariAgent> getAmbariAgents(); @Override Iterable<AmbariServer> getAmbariServers(); @Override AmbariServer getMasterAmbariServer(); @Override List<String> getExtraStackDefinitionsUrls(); @Override void addHostsToHostGroup(String hostgroupName, List<AmbariAgent> hosts); @Override void addAlertNotification(String name, String description, Boolean global, String notificationType,
                                     List<String> alertStates, List<String> ambariDispatchRecipients,
                                     String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void editAlertNotification(String name, String description, Boolean global, String notificationType,
                                      List<String> alertStates, List<String> ambariDispatchRecipients,
                                      String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); void deleteAlertNotification(String name); @Override void addAlertGroup(String name,List<Integer> definitions); @Override void deployCluster(); @Override void postDeployCluster(); @Override boolean isClusterComplete(); static final ImmutableList<String> DEFAULT_SERVICES; static final ImmutableMap<String, Map> DEFAULT_CONFIG_MAP; }