This is an automated email from the ASF dual-hosted git repository.
mpapirkovskyy pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new eaae0af AMBARI-24930. Recommendation configs request was failed with
custom config group. (#2637)
eaae0af is described below
commit eaae0af01789cab9e169221ec21e80b472aa2938
Author: Myroslav Papirkovskyi <[email protected]>
AuthorDate: Tue Nov 27 16:44:14 2018 +0200
AMBARI-24930. Recommendation configs request was failed with custom config
group. (#2637)
* AMBARI-24930. Recommendation configs request was failed with custom
config group. (mpapirkovskyy)
* AMBARI-24930. Recommendation configs request was failed with custom
config group. (mpapirkovskyy)
* AMBARI-24930. Recommendation configs request was failed with custom
config group. (mpapirkovskyy)
* AMBARI-24930. Recommendation configs request was failed with custom
config group. (mpapirkovskyy)
---
.../StackAdvisorBlueprintProcessor.java | 50 ++++++------
.../services/stackadvisor/StackAdvisorRequest.java | 52 ++++++------
...igurationDependenciesRecommendationCommand.java | 5 +-
.../ConfigurationRecommendationCommand.java | 5 +-
.../stackadvisor/commands/StackAdvisorCommand.java | 8 +-
.../recommendations/RecommendationResponse.java | 30 +++++++
.../server/controller/KerberosHelperImpl.java | 21 +++--
...erverStackAdvisorAwareConfigurationHandler.java | 10 +--
.../internal/StackAdvisorResourceProvider.java | 92 ++++++++++------------
.../org/apache/ambari/server/state/Cluster.java | 4 +-
.../ambari/server/state/cluster/ClusterImpl.java | 8 +-
.../server/controller/KerberosHelperTest.java | 7 +-
.../AmbariServerSSOConfigurationHandlerTest.java | 8 +-
.../internal/StackAdvisorResourceProviderTest.java | 9 +--
.../ambari/server/state/cluster/ClusterTest.java | 10 +--
15 files changed, 160 insertions(+), 159 deletions(-)
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
index 54b7e1f..6084711 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
@@ -19,13 +19,11 @@
package org.apache.ambari.server.api.services.stackadvisor;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
import org.apache.ambari.server.AmbariException;
import
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest.StackAdvisorRequestType;
@@ -47,6 +45,7 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.inject.Singleton;
/**
@@ -66,10 +65,10 @@ public class StackAdvisorBlueprintProcessor {
stackAdvisorHelper = instance;
}
- private static final SortedMap<String, String> userContext;
+ private static final Map<String, String> userContext;
static
{
- userContext = new TreeMap<>();
+ userContext = new HashMap<>();
userContext.put("operation", "ClusterCreate");
}
@@ -92,10 +91,10 @@ public class StackAdvisorBlueprintProcessor {
private StackAdvisorRequest createStackAdvisorRequest(ClusterTopology
clusterTopology, StackAdvisorRequestType requestType) {
Stack stack = clusterTopology.getBlueprint().getStack();
- SortedMap<String, SortedSet<String>> hgComponentsMap =
gatherHostGroupComponents(clusterTopology);
- SortedMap<String, SortedSet<String>> hgHostsMap =
gatherHostGroupBindings(clusterTopology);
- SortedMap<String, SortedSet<String>> componentHostsMap =
gatherComponentsHostsMap(hgComponentsMap,
- hgHostsMap);
+ Map<String, Set<String>> hgComponentsMap =
gatherHostGroupComponents(clusterTopology);
+ Map<String, Set<String>> hgHostsMap =
gatherHostGroupBindings(clusterTopology);
+ Map<String, Set<String>> componentHostsMap =
gatherComponentsHostsMap(hgComponentsMap,
+ hgHostsMap);
return StackAdvisorRequest.StackAdvisorRequestBuilder
.forStack(stack.getName(), stack.getVersion())
.forServices(new
ArrayList<>(clusterTopology.getBlueprint().getServices()))
@@ -109,47 +108,46 @@ public class StackAdvisorBlueprintProcessor {
.build();
}
- private SortedMap<String, SortedSet<String>>
gatherHostGroupBindings(ClusterTopology clusterTopology) {
- SortedMap<String, SortedSet<String>> hgBindngs = Maps.newTreeMap();
+ private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology
clusterTopology) {
+ Map<String, Set<String>> hgBindngs = Maps.newHashMap();
for (Map.Entry<String, HostGroupInfo> hgEnrty:
clusterTopology.getHostGroupInfo().entrySet()) {
- hgBindngs.put(hgEnrty.getKey(), new
TreeSet<>(hgEnrty.getValue().getHostNames()));
+ hgBindngs.put(hgEnrty.getKey(),
Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getHostNames()));
}
return hgBindngs;
}
- private SortedMap<String, SortedSet<String>>
gatherHostGroupComponents(ClusterTopology clusterTopology) {
- SortedMap<String, SortedSet<String>> hgComponentsMap = Maps.newTreeMap();
+ private Map<String, Set<String>> gatherHostGroupComponents(ClusterTopology
clusterTopology) {
+ Map<String, Set<String>> hgComponentsMap = Maps.newHashMap();
for (Map.Entry<String, HostGroup> hgEnrty:
clusterTopology.getBlueprint().getHostGroups().entrySet()) {
- hgComponentsMap.put(hgEnrty.getKey(), new
TreeSet<>(hgEnrty.getValue().getComponentNames()));
+ hgComponentsMap.put(hgEnrty.getKey(),
Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getComponentNames()));
}
return hgComponentsMap;
}
- private SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculateConfigs(ClusterTopology clusterTopology) {
- SortedMap<String, SortedMap<String, SortedMap<String, String>>> result =
Maps.newTreeMap();
+ private Map<String, Map<String, Map<String, String>>>
calculateConfigs(ClusterTopology clusterTopology) {
+ Map<String, Map<String, Map<String, String>>> result = Maps.newHashMap();
Map<String, Map<String, String>> fullProperties =
clusterTopology.getConfiguration().getFullProperties();
for (Map.Entry<String, Map<String, String>> siteEntry :
fullProperties.entrySet()) {
- SortedMap<String, SortedMap<String, String>> propsMap =
Maps.newTreeMap();
- propsMap.put("properties", new TreeMap<>(siteEntry.getValue()));
+ Map<String, Map<String, String>> propsMap = Maps.newHashMap();
+ propsMap.put("properties", siteEntry.getValue());
result.put(siteEntry.getKey(), propsMap);
}
return result;
}
- private SortedMap<String, SortedSet<String>>
gatherComponentsHostsMap(SortedMap<String, SortedSet<String>> hostGroups,
-
SortedMap<String, SortedSet<String>> bindingHostGroups) {
- SortedMap<String, SortedSet<String>> componentHostsMap = new TreeMap<>();
+ private Map<String, Set<String>> gatherComponentsHostsMap(Map<String,
Set<String>> hostGroups, Map<String, Set<String>> bindingHostGroups) {
+ Map<String, Set<String>> componentHostsMap = new HashMap<>();
if (null != bindingHostGroups && null != hostGroups) {
- for (Map.Entry<String, SortedSet<String>> hgComponents :
hostGroups.entrySet()) {
+ for (Map.Entry<String, Set<String>> hgComponents :
hostGroups.entrySet()) {
String hgName = hgComponents.getKey();
Set<String> components = hgComponents.getValue();
Set<String> hosts = bindingHostGroups.get(hgName);
if (hosts != null) {
for (String component : components) {
- SortedSet<String> componentHosts =
componentHostsMap.get(component);
+ Set<String> componentHosts = componentHostsMap.get(component);
if (componentHosts == null) { // if was not initialized
- componentHosts = new TreeSet<>();
+ componentHosts = new HashSet<>();
componentHostsMap.put(component, componentHosts);
}
componentHosts.addAll(hosts);
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
index de6448b..98c75f4 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
@@ -21,11 +21,11 @@ package org.apache.ambari.server.api.services.stackadvisor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
+import java.util.Map;
+import java.util.Set;
import
org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
import org.apache.ambari.server.state.ChangedConfigInfo;
@@ -45,14 +45,14 @@ public class StackAdvisorRequest {
private StackAdvisorRequestType requestType;
private List<String> hosts = new ArrayList<>();
private Collection<String> services = new ArrayList<>();
- private SortedMap<String, SortedSet<String>> componentHostsMap = new
TreeMap<>();
- private SortedMap<String, SortedSet<String>> hostComponents = new
TreeMap<>();
- private SortedMap<String, SortedSet<String>> hostGroupBindings = new
TreeMap<>();
- private SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations = new TreeMap<>();
+ private Map<String, Set<String>> componentHostsMap = new HashMap<>();
+ private Map<String, Set<String>> hostComponents = new HashMap<>();
+ private Map<String, Set<String>> hostGroupBindings = new HashMap<>();
+ private Map<String, Map<String, Map<String, String>>> configurations = new
HashMap<>();
private List<ChangedConfigInfo> changedConfigurations = new LinkedList<>();
- private SortedSet<RecommendationResponse.ConfigGroup> configGroups;
- private SortedMap<String, String> userContext = new TreeMap<>();
- private SortedMap<String, Object> ldapConfig = new TreeMap<>();
+ private Set<RecommendationResponse.ConfigGroup> configGroups;
+ private Map<String, String> userContext = new HashMap<>();
+ private Map<String, Object> ldapConfig = new HashMap<>();
private Boolean gplLicenseAccepted;
private Boolean configsResponse = false;
@@ -76,7 +76,7 @@ public class StackAdvisorRequest {
return services;
}
- public SortedMap<String, SortedSet<String>> getComponentHostsMap() {
+ public Map<String, Set<String>> getComponentHostsMap() {
return componentHostsMap;
}
@@ -88,19 +88,19 @@ public class StackAdvisorRequest {
return StringUtils.join(services, ",");
}
- public SortedMap<String, SortedSet<String>> getHostComponents() {
+ public Map<String, Set<String>> getHostComponents() {
return hostComponents;
}
- public SortedMap<String, SortedSet<String>> getHostGroupBindings() {
+ public Map<String, Set<String>> getHostGroupBindings() {
return hostGroupBindings;
}
- public SortedMap<String, SortedMap<String, SortedMap<String, String>>>
getConfigurations() {
+ public Map<String, Map<String, Map<String, String>>> getConfigurations() {
return configurations;
}
- public SortedMap<String, Object> getLdapConfig() { return ldapConfig; }
+ public Map<String, Object> getLdapConfig() { return ldapConfig; }
public List<ChangedConfigInfo> getChangedConfigurations() {
return changedConfigurations;
@@ -110,19 +110,19 @@ public class StackAdvisorRequest {
this.changedConfigurations = changedConfigurations;
}
- public SortedMap<String, String> getUserContext() {
+ public Map<String, String> getUserContext() {
return this.userContext;
}
- public void setUserContext(SortedMap<String, String> userContext) {
+ public void setUserContext(Map<String, String> userContext) {
this.userContext = userContext;
}
- public SortedSet<RecommendationResponse.ConfigGroup> getConfigGroups() {
+ public Set<RecommendationResponse.ConfigGroup> getConfigGroups() {
return configGroups;
}
- public void setConfigGroups(SortedSet<RecommendationResponse.ConfigGroup>
configGroups) {
+ public void setConfigGroups(Set<RecommendationResponse.ConfigGroup>
configGroups) {
this.configGroups = configGroups;
}
@@ -177,24 +177,24 @@ public class StackAdvisorRequest {
}
public StackAdvisorRequestBuilder withComponentHostsMap(
- SortedMap<String, SortedSet<String>> componentHostsMap) {
+ Map<String, Set<String>> componentHostsMap) {
this.instance.componentHostsMap = componentHostsMap;
return this;
}
- public StackAdvisorRequestBuilder forHostComponents(SortedMap<String,
SortedSet<String>> hostComponents) {
+ public StackAdvisorRequestBuilder forHostComponents(Map<String,
Set<String>> hostComponents) {
this.instance.hostComponents = hostComponents;
return this;
}
public StackAdvisorRequestBuilder forHostsGroupBindings(
- SortedMap<String, SortedSet<String>> hostGroupBindings) {
+ Map<String, Set<String>> hostGroupBindings) {
this.instance.hostGroupBindings = hostGroupBindings;
return this;
}
public StackAdvisorRequestBuilder withConfigurations(
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations) {
+ Map<String, Map<String, Map<String, String>>> configurations) {
this.instance.configurations = configurations;
return this;
}
@@ -206,13 +206,13 @@ public class StackAdvisorRequest {
}
public StackAdvisorRequestBuilder withUserContext(
- SortedMap<String, String> userContext) {
+ Map<String, String> userContext) {
this.instance.userContext = userContext;
return this;
}
public StackAdvisorRequestBuilder withConfigGroups(
- SortedSet<RecommendationResponse.ConfigGroup> configGroups) {
+ Set<RecommendationResponse.ConfigGroup> configGroups) {
this.instance.configGroups = configGroups;
return this;
}
@@ -228,7 +228,7 @@ public class StackAdvisorRequest {
return this;
}
- public StackAdvisorRequestBuilder withLdapConfig(SortedMap<String, Object>
ldapConfig) {
+ public StackAdvisorRequestBuilder withLdapConfig(Map<String, Object>
ldapConfig) {
Preconditions.checkNotNull(ldapConfig);
this.instance.ldapConfig = ldapConfig;
return this;
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
index 4d43c80..209cab9 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.SortedSet;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
@@ -78,7 +77,7 @@ public class ConfigurationDependenciesRecommendationCommand
extends
protected Set<HostGroup> processHostGroups(StackAdvisorRequest request) {
Set<HostGroup> resultSet = new HashSet<>();
- for (Map.Entry<String, SortedSet<String>> componentHost :
request.getHostComponents().entrySet()) {
+ for (Map.Entry<String, Set<String>> componentHost :
request.getHostComponents().entrySet()) {
String hostGroupName = componentHost.getKey();
Set<String> components = componentHost.getValue();
if (hostGroupName != null && components != null) {
@@ -99,7 +98,7 @@ public class ConfigurationDependenciesRecommendationCommand
extends
private Set<BindingHostGroup> processHostGroupBindings(StackAdvisorRequest
request) {
Set<BindingHostGroup> resultSet = new HashSet<>();
- for (Map.Entry<String, SortedSet<String>> hostBinding :
request.getHostGroupBindings().entrySet()) {
+ for (Map.Entry<String, Set<String>> hostBinding :
request.getHostGroupBindings().entrySet()) {
String hostGroupName = hostBinding.getKey();
Set<String> hosts = hostBinding.getValue();
if (hostGroupName != null && hosts != null) {
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
index 76f5fa7..5bd7cae 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java
@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.SortedSet;
import org.apache.ambari.server.api.services.AmbariMetaInfo;
import
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
@@ -86,7 +85,7 @@ public class ConfigurationRecommendationCommand extends
StackAdvisorCommand<Reco
protected Set<HostGroup> processHostGroups(StackAdvisorRequest request) {
Set<HostGroup> resultSet = new HashSet<>();
- for (Map.Entry<String, SortedSet<String>> componentHost :
request.getHostComponents().entrySet()) {
+ for (Map.Entry<String, Set<String>> componentHost :
request.getHostComponents().entrySet()) {
String hostGroupName = componentHost.getKey();
Set<String> components = componentHost.getValue();
if (hostGroupName != null && components != null) {
@@ -107,7 +106,7 @@ public class ConfigurationRecommendationCommand extends
StackAdvisorCommand<Reco
private Set<BindingHostGroup> processHostGroupBindings(StackAdvisorRequest
request) {
Set<BindingHostGroup> resultSet = new HashSet<>();
- for (Map.Entry<String, SortedSet<String>> hostBinding :
request.getHostGroupBindings().entrySet()) {
+ for (Map.Entry<String, Set<String>> hostBinding :
request.getHostGroupBindings().entrySet()) {
String hostGroupName = hostBinding.getKey();
Set<String> hosts = hostBinding.getValue();
if (hostGroupName != null && hosts != null) {
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
index 0028872..0006458 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
@@ -31,8 +31,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
@@ -215,13 +213,13 @@ public abstract class StackAdvisorCommand<T extends
StackAdvisorResponse> extend
private void populateConfigurations(ObjectNode root,
StackAdvisorRequest request) {
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations =
+ Map<String, Map<String, Map<String, String>>> configurations =
request.getConfigurations();
ObjectNode configurationsNode = root.putObject(CONFIGURATIONS_PROPERTY);
for (String siteName : configurations.keySet()) {
ObjectNode siteNode = configurationsNode.putObject(siteName);
- SortedMap<String, SortedMap<String, String>> siteMap =
configurations.get(siteName);
+ Map<String, Map<String, String>> siteMap = configurations.get(siteName);
for (String properties : siteMap.keySet()) {
ObjectNode propertiesNode = siteNode.putObject(properties);
@@ -262,7 +260,7 @@ public abstract class StackAdvisorCommand<T extends
StackAdvisorResponse> extend
}
}
- private void populateComponentHostsMap(ObjectNode root, SortedMap<String,
SortedSet<String>> componentHostsMap) {
+ private void populateComponentHostsMap(ObjectNode root, Map<String,
Set<String>> componentHostsMap) {
ArrayNode services = (ArrayNode) root.get(SERVICES_PROPERTY);
Iterator<JsonNode> servicesIter = services.getElements();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
index 0743e6c..d0d8601 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
@@ -21,6 +21,7 @@ package
org.apache.ambari.server.api.services.stackadvisor.recommendations;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse;
@@ -163,6 +164,20 @@ public class RecommendationResponse extends
StackAdvisorResponse {
public void setPropertyAttributes(Map<String, ValueAttributesInfo>
propertyAttributes) {
this.propertyAttributes = propertyAttributes;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ BlueprintConfigurations that = (BlueprintConfigurations) o;
+ return Objects.equals(properties, that.properties) &&
+ Objects.equals(propertyAttributes, that.propertyAttributes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(properties, propertyAttributes);
+ }
}
public static class HostGroup {
@@ -268,6 +283,21 @@ public class RecommendationResponse extends
StackAdvisorResponse {
public void setDependentConfigurations(Map<String,
BlueprintConfigurations> dependentConfigurations) {
this.dependentConfigurations = dependentConfigurations;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ConfigGroup that = (ConfigGroup) o;
+ return Objects.equals(hosts, that.hosts) &&
+ Objects.equals(configurations, that.configurations) &&
+ Objects.equals(dependentConfigurations,
that.dependentConfigurations);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(hosts, configurations, dependentConfigurations);
+ }
}
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index 008ee47..23a0d96 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -35,7 +35,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.regex.Matcher;
@@ -685,19 +684,19 @@ public class KerberosHelperImpl implements KerberosHelper
{
// This could happen when enabling Kerberos while installing a cluster via
Blueprints due to the
// way hosts are discovered during the install process.
if (!hostNames.isEmpty()) {
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
requestConfigurations = new TreeMap<>();
+ Map<String, Map<String, Map<String, String>>> requestConfigurations =
new HashMap<>();
if (existingConfigurations != null) {
for (Map.Entry<String, Map<String, String>> configuration :
existingConfigurations.entrySet()) {
- SortedMap<String, SortedMap<String, String>> properties = new
TreeMap<>();
+ Map<String, Map<String, String>> properties = new HashMap<>();
String configType = configuration.getKey();
- SortedMap<String, String> configurationProperties = new
TreeMap<>(configuration.getValue());
+ Map<String, String> configurationProperties =
configuration.getValue();
if (configurationProperties == null) {
- configurationProperties = Collections.emptySortedMap();
+ configurationProperties = Collections.emptyMap();
}
if ("cluster-env".equals(configType)) {
- configurationProperties = new TreeMap<>(configurationProperties);
+ configurationProperties = new HashMap<>(configurationProperties);
configurationProperties.put("security_enabled", (kerberosEnabled)
? "true" : "false");
}
@@ -712,18 +711,18 @@ public class KerberosHelperImpl implements KerberosHelper
{
Map<String, String> configurationProperties = configuration.getValue();
if ((configurationProperties != null) &&
!configurationProperties.isEmpty()) {
- SortedMap<String, SortedMap<String, String>> requestConfiguration =
requestConfigurations.get(configType);
+ Map<String, Map<String, String>> requestConfiguration =
requestConfigurations.get(configType);
if (requestConfiguration == null) {
- requestConfiguration = new TreeMap<>();
+ requestConfiguration = new HashMap<>();
requestConfigurations.put(configType, requestConfiguration);
}
- SortedMap<String, String> requestConfigurationProperties =
requestConfiguration.get("properties");
+ Map<String, String> requestConfigurationProperties =
requestConfiguration.get("properties");
if (requestConfigurationProperties == null) {
- requestConfigurationProperties = new TreeMap<>();
+ requestConfigurationProperties = new HashMap<>();
} else {
- requestConfigurationProperties = new
TreeMap<>(requestConfigurationProperties);
+ requestConfigurationProperties = new
HashMap<>(requestConfigurationProperties);
}
requestConfigurationProperties.putAll(configurationProperties);
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerStackAdvisorAwareConfigurationHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerStackAdvisorAwareConfigurationHandler.java
index e9763ca..c910e54 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerStackAdvisorAwareConfigurationHandler.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariServerStackAdvisorAwareConfigurationHandler.java
@@ -25,8 +25,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
import java.util.stream.Collectors;
import org.apache.ambari.server.AmbariException;
@@ -187,16 +185,16 @@ class AmbariServerStackAdvisorAwareConfigurationHandler
extends AmbariServerConf
* @return a map of services and their configurations
* @throws AmbariException
*/
- private SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculateExistingConfigurations(Cluster cluster) throws AmbariException {
+ private Map<String, Map<String, Map<String, String>>>
calculateExistingConfigurations(Cluster cluster) throws AmbariException {
Map<String, Map<String, String>> configurationTags =
configHelper.getEffectiveDesiredTags(cluster, null);
Map<String, Map<String, String>> effectiveConfigs =
configHelper.getEffectiveConfigProperties(cluster, configurationTags);
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
requestConfigurations = new TreeMap<>();
+ Map<String, Map<String, Map<String, String>>> requestConfigurations = new
HashMap<>();
if (effectiveConfigs != null) {
for (Map.Entry<String, Map<String, String>> configuration :
effectiveConfigs.entrySet()) {
- SortedMap<String, SortedMap<String, String>> properties = new
TreeMap<>();
+ Map<String, Map<String, String>> properties = new HashMap<>();
String configType = configuration.getKey();
- SortedMap<String, String> configurationProperties = new
TreeMap<>(configuration.getValue());
+ Map<String, String> configurationProperties = new
HashMap<>(configuration.getValue());
if (configurationProperties == null) {
configurationProperties = Collections.emptySortedMap();
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
index 8a8a2eb..0dd48e7 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java
@@ -27,10 +27,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.ws.rs.WebApplicationException;
@@ -148,11 +144,11 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
List<String> hosts;
List<String> services;
- SortedMap<String, SortedSet<String>> hgComponentsMap;
- SortedMap<String, SortedSet<String>> hgHostsMap;
- SortedMap<String, SortedSet<String>> componentHostsMap;
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations;
- SortedSet<RecommendationResponse.ConfigGroup> configGroups;
+ Map<String, Set<String>> hgComponentsMap;
+ Map<String, Set<String>> hgHostsMap;
+ Map<String, Set<String>> componentHostsMap;
+ Map<String, Map<String, Map<String, String>>> configurations;
+ Set<RecommendationResponse.ConfigGroup> configGroups;
// In auto complete case all required fields will be filled will cluster
current info
if (autoComplete) {
@@ -202,7 +198,7 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
configurations = calculateConfigurations(request);
configGroups = calculateConfigGroups(request);
}
- SortedMap<String, String> userContext = readUserContext(request);
+ Map<String, String> userContext = readUserContext(request);
Boolean gplLicenseAccepted = configuration.getGplLicenseAccepted();
List<ChangedConfigInfo> changedConfigurations =
requestType == StackAdvisorRequestType.CONFIGURATION_DEPENDENCIES ?
@@ -240,10 +236,10 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
* @return host-group to components map
*/
@SuppressWarnings("unchecked")
- private SortedMap<String, SortedSet<String>>
calculateHostGroupComponentsMap(Request request) {
+ private Map<String, Set<String>> calculateHostGroupComponentsMap(Request
request) {
Set<Map<String, Object>> hostGroups = (Set<Map<String, Object>>)
getRequestProperty(request,
BLUEPRINT_HOST_GROUPS_PROPERTY);
- SortedMap<String, SortedSet<String>> map = new TreeMap<>();
+ Map<String, Set<String>> map = new HashMap<>();
if (hostGroups != null) {
for (Map<String, Object> hostGroup : hostGroups) {
String hostGroupName = (String)
hostGroup.get(BLUEPRINT_HOST_GROUPS_NAME_PROPERTY);
@@ -251,7 +247,7 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
Set<Map<String, Object>> componentsSet = (Set<Map<String, Object>>)
hostGroup
.get(BLUEPRINT_HOST_GROUPS_COMPONENTS_PROPERTY);
- SortedSet<String> components = new TreeSet<>();
+ Set<String> components = new HashSet<>();
for (Map<String, Object> component : componentsSet) {
components.add((String)
component.get(BLUEPRINT_HOST_GROUPS_COMPONENTS_NAME_PROPERTY));
}
@@ -268,14 +264,14 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
* @param cluster cluster for calculating components mapping by host groups
* @return map "host group name" -> ["component name1", "component name 2",
...]
*/
- private SortedMap<String, SortedSet<String>>
calculateHostGroupComponentsMap(Cluster cluster) {
- SortedMap<String, SortedSet<String>> map = new TreeMap<>();
+ private Map<String, Set<String>> calculateHostGroupComponentsMap(Cluster
cluster) {
+ Map<String, Set<String>> map = new HashMap<>();
List<Host> hosts = new ArrayList<>(cluster.getHosts());
if (!hosts.isEmpty()) {
for (Host host : hosts) {
String hostGroupName = host.getHostName();
- SortedSet<String> components = new TreeSet<>();
+ Set<String> components = new HashSet<>();
for (ServiceComponentHost sch :
cluster.getServiceComponentHosts(host.getHostName())) {
components.add(sch.getServiceComponentName());
}
@@ -293,10 +289,10 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
* @return host-group to hosts map
*/
@SuppressWarnings("unchecked")
- private SortedMap<String, SortedSet<String>>
calculateHostGroupHostsMap(Request request) {
+ private Map<String, Set<String>> calculateHostGroupHostsMap(Request request)
{
Set<Map<String, Object>> bindingHostGroups = (Set<Map<String, Object>>)
getRequestProperty(
request, BINDING_HOST_GROUPS_PROPERTY);
- SortedMap<String, SortedSet<String>> map = new TreeMap<>();
+ Map<String, Set<String>> map = new HashMap<>();
if (bindingHostGroups != null) {
for (Map<String, Object> hostGroup : bindingHostGroups) {
String hostGroupName = (String)
hostGroup.get(BINDING_HOST_GROUPS_NAME_PROPERTY);
@@ -304,7 +300,7 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
Set<Map<String, Object>> hostsSet = (Set<Map<String, Object>>)
hostGroup
.get(BINDING_HOST_GROUPS_HOSTS_PROPERTY);
- SortedSet<String> hosts = new TreeSet<>();
+ Set<String> hosts = new HashSet<>();
for (Map<String, Object> host : hostsSet) {
hosts.add((String)
host.get(BINDING_HOST_GROUPS_HOSTS_NAME_PROPERTY));
}
@@ -321,13 +317,13 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
* @param cluster cluster for calculating hosts mapping by host groups
* @return map "host group name" -> ["host name 1"]
*/
- private SortedMap<String, SortedSet<String>>
calculateHostGroupHostsMap(Cluster cluster) {
- SortedMap<String, SortedSet<String>> map = new TreeMap<>();
+ private Map<String, Set<String>> calculateHostGroupHostsMap(Cluster cluster)
{
+ Map<String, Set<String>> map = new HashMap<>();
List<Host> hosts = new ArrayList<>(cluster.getHosts());
if (!hosts.isEmpty()) {
for (Host host : hosts) {
- map.put(host.getHostName(), new
TreeSet<String>(){{add(host.getHostName());}});
+ map.put(host.getHostName(), Collections.singleton(host.getHostName()));
}
}
@@ -346,10 +342,10 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
return configs;
}
- protected SortedSet<RecommendationResponse.ConfigGroup>
calculateConfigGroups(Request request) {
+ protected Set<RecommendationResponse.ConfigGroup>
calculateConfigGroups(Request request) {
- SortedSet<RecommendationResponse.ConfigGroup> configGroups =
- new TreeSet<>();
+ Set<RecommendationResponse.ConfigGroup> configGroups =
+ new HashSet<>();
Set<HashMap<String, Object>> configGroupsProperties =
(HashSet<HashMap<String, Object>>) getRequestProperty(request,
CONFIG_GROUPS_PROPERTY);
@@ -380,10 +376,9 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
return configGroups;
}
- protected SortedSet<RecommendationResponse.ConfigGroup>
calculateConfigGroups(Cluster cluster, Request request) {
+ protected Set<RecommendationResponse.ConfigGroup>
calculateConfigGroups(Cluster cluster, Request request) {
- SortedSet<RecommendationResponse.ConfigGroup> configGroups =
- new TreeSet<>();
+ Set<RecommendationResponse.ConfigGroup> configGroups = new HashSet<>();
Set<HashMap<String, Object>> configGroupsProperties =
(HashSet<HashMap<String, Object>>) getRequestProperty(request,
CONFIG_GROUPS_PROPERTY);
@@ -421,8 +416,8 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
* @param request
* @return
*/
- protected SortedMap<String, String> readUserContext(Request request) {
- SortedMap<String, String> userContext = new TreeMap<>();
+ protected Map<String, String> readUserContext(Request request) {
+ Map<String, String> userContext = new HashMap<>();
if (null != getRequestProperty(request, USER_CONTEXT_OPERATION_PROPERTY)) {
userContext.put(OPERATION_PROPERTY,
(String) getRequestProperty(request,
USER_CONTEXT_OPERATION_PROPERTY));
@@ -436,8 +431,8 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
protected static final String CONFIGURATIONS_PROPERTY_ID =
"recommendations/blueprint/configurations/";
- protected SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculateConfigurations(Request request) {
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations = new TreeMap<>();
+ protected Map<String, Map<String, Map<String, String>>>
calculateConfigurations(Request request) {
+ Map<String, Map<String, Map<String, String>>> configurations = new
HashMap<>();
Map<String, Object> properties = request.getProperties().iterator().next();
for (String property : properties.keySet()) {
if (property.startsWith(CONFIGURATIONS_PROPERTY_ID)) {
@@ -448,15 +443,15 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
String propertiesProperty = propertyPath[1];
String propertyName = propertyPath[2];
- SortedMap<String, SortedMap<String, String>> siteMap =
configurations.get(siteName);
+ Map<String, Map<String, String>> siteMap =
configurations.get(siteName);
if (siteMap == null) {
- siteMap = new TreeMap<>();
+ siteMap = new HashMap<>();
configurations.put(siteName, siteMap);
}
- SortedMap<String, String> propertiesMap =
siteMap.get(propertiesProperty);
+ Map<String, String> propertiesMap = siteMap.get(propertiesProperty);
if (propertiesMap == null) {
- propertiesMap = new TreeMap<>();
+ propertiesMap = new HashMap<>();
siteMap.put(propertiesProperty, propertiesMap);
}
@@ -475,9 +470,9 @@ public abstract class StackAdvisorResourceProvider extends
ReadOnlyResourceProvi
return configurations;
}
- protected SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculateConfigurations(Cluster cluster, String serviceName)
+ protected Map<String, Map<String, Map<String, String>>>
calculateConfigurations(Cluster cluster, String serviceName)
throws AmbariException {
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
configurations = new TreeMap<>();
+ Map<String, Map<String, Map<String, String>>> configurations = new
HashMap<>();
Service service = cluster.getService(serviceName);
StackId stackId = service.getDesiredStackId();
@@ -494,31 +489,30 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
}
for (Map.Entry<String, DesiredConfig> requiredDesiredConfigEntry :
requiredDesiredConfigs.entrySet()) {
Config config = cluster.getConfig(requiredDesiredConfigEntry.getKey(),
requiredDesiredConfigEntry.getValue().getTag());
- configurations.put(requiredDesiredConfigEntry.getKey(),
- new TreeMap<String, SortedMap<String, String>>(){{put("properties",
new TreeMap<>(config.getProperties()));}});
+ configurations.put(requiredDesiredConfigEntry.getKey(),
Collections.singletonMap("properties", config.getProperties()));
}
return configurations;
}
@SuppressWarnings("unchecked")
- private SortedMap<String, SortedSet<String>>
calculateComponentHostsMap(SortedMap<String, SortedSet<String>> hostGroups,
-
SortedMap<String, SortedSet<String>> bindingHostGroups) {
+ private Map<String, Set<String>> calculateComponentHostsMap(Map<String,
Set<String>> hostGroups,
+ Map<String,
Set<String>> bindingHostGroups) {
/*
* ClassCastException may occur in case of body inconsistency: property
* missed, etc.
*/
- SortedMap<String, SortedSet<String>> componentHostsMap = new TreeMap<>();
+ Map<String, Set<String>> componentHostsMap = new HashMap<>();
if (null != bindingHostGroups && null != hostGroups) {
- for (Map.Entry<String, SortedSet<String>> hgComponents :
hostGroups.entrySet()) {
+ for (Map.Entry<String, Set<String>> hgComponents :
hostGroups.entrySet()) {
String hgName = hgComponents.getKey();
Set<String> components = hgComponents.getValue();
Set<String> hosts = bindingHostGroups.get(hgName);
for (String component : components) {
- SortedSet<String> componentHosts = componentHostsMap.get(component);
+ Set<String> componentHosts = componentHostsMap.get(component);
if (componentHosts == null) { // if was not initialized
- componentHosts = new TreeSet<>();
+ componentHosts = new HashSet<>();
componentHostsMap.put(component, componentHosts);
}
componentHosts.addAll(hosts);
@@ -530,16 +524,16 @@ public abstract class StackAdvisorResourceProvider
extends ReadOnlyResourceProvi
}
@SuppressWarnings("unchecked")
- private SortedMap<String, SortedSet<String>>
calculateComponentHostsMap(Cluster cluster) {
+ private Map<String, Set<String>> calculateComponentHostsMap(Cluster cluster)
{
/*
* ClassCastException may occur in case of body inconsistency: property
* missed, etc.
*/
- SortedMap<String, SortedSet<String>> componentHostsMap = new TreeMap<>();
+ Map<String, Set<String>> componentHostsMap = new HashMap<>();
List<ServiceComponentHost> schs = cluster.getServiceComponentHosts();
for (ServiceComponentHost sch : schs) {
- componentHostsMap.putIfAbsent(sch.getServiceComponentName(), new
TreeSet<>());
+ componentHostsMap.putIfAbsent(sch.getServiceComponentName(), new
HashSet<>());
componentHostsMap.get(sch.getServiceComponentName()).add(sch.getHostName());
}
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 817563d..1745640 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -24,8 +24,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.controller.ClusterResponse;
@@ -111,7 +109,7 @@ public interface Cluster {
* @param serviceNames
* @return a map of (filtered) components to hosts
*/
- SortedMap<String, SortedSet<String>> getServiceComponentHostMap(Set<String>
hostNames, Set<String> serviceNames);
+ Map<String, Set<String>> getServiceComponentHostMap(Set<String> hostNames,
Set<String> serviceNames);
/**
* Get all ServiceComponentHosts for a given service and optional component
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 06a6067..72e508b 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -33,8 +33,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
@@ -809,8 +807,8 @@ public class ClusterImpl implements Cluster {
}
@Override
- public SortedMap<String, SortedSet<String>>
getServiceComponentHostMap(Set<String> hostNames, Set<String> serviceNames) {
- SortedMap<String, SortedSet<String>> componentHostMap = new TreeMap<>();
+ public Map<String, Set<String>> getServiceComponentHostMap(Set<String>
hostNames, Set<String> serviceNames) {
+ Map<String, Set<String>> componentHostMap = new TreeMap<>();
Collection<Host> hosts = getHosts();
@@ -827,7 +825,7 @@ public class ClusterImpl implements Cluster {
// If the service for this ServiceComponentHost is not filtered
out, continue processing
if ((serviceNames == null) ||
serviceNames.contains(sch.getServiceName())) {
String component = sch.getServiceComponentName();
- SortedSet<String> componentHosts =
componentHostMap.get(component);
+ Set<String> componentHosts = componentHostMap.get(component);
if (componentHosts == null) {
componentHosts = new TreeSet<>();
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
index ba3bdb2..2366bb4 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/controller/KerberosHelperTest.java
@@ -52,9 +52,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
@@ -2000,7 +1997,7 @@ public class KerberosHelperTest extends EasyMockSupport {
serviceNames.add("EXISTING_SERVICE");
serviceNames.add("PRECONFIGURE_SERVICE");
- SortedMap<String, SortedSet<String>> hostMap = new TreeMap<>();
+ Map<String, Set<String>> hostMap = new HashMap<>();
Map<String, Service> services = new HashMap<>();
@@ -2383,7 +2380,7 @@ public class KerberosHelperTest extends EasyMockSupport {
services.put("SERVICE2", service2);
services.put("SERVICE3", service3);
- SortedMap<String, SortedSet<String>> serviceComponentHostMap = new
TreeMap<>();
+ Map<String, Set<String>> serviceComponentHostMap = new HashMap<>();
serviceComponentHostMap.put("COMPONENT1A", new
TreeSet<>(Arrays.asList("hostA")));
serviceComponentHostMap.put("COMPONENT1B", new
TreeSet<>(Arrays.asList("hostB", "hostC")));
serviceComponentHostMap.put("COMPONENT2A", new
TreeSet<>(Arrays.asList("hostA")));
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariServerSSOConfigurationHandlerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariServerSSOConfigurationHandlerTest.java
index 861c176..9c93cd3 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariServerSSOConfigurationHandlerTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariServerSSOConfigurationHandlerTest.java
@@ -30,10 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
+import java.util.Set;
import org.apache.ambari.server.AmbariException;
import
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException;
@@ -105,8 +102,7 @@ public class AmbariServerSSOConfigurationHandlerTest
extends EasyMockSupport {
StackId stackId = new StackId("HDP-3.0");
- SortedMap<String, SortedSet<String>> serviceComponentHostMap =
- new TreeMap<String, SortedSet<String>>(){{put("ATLAS_COMPONENT", new
TreeSet<String>(){{add("host1");}});}};
+ Map<String, Set<String>> serviceComponentHostMap =
Collections.singletonMap("ATLAS_COMPONENT", Collections.singleton("host1"));
Host host = createMock(Host.class);
expect(host.getHostName()).andReturn("host1").once();
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java
index 61d99c7..a6c7d42 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java
@@ -34,7 +34,6 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
import javax.annotation.Nonnull;
@@ -56,11 +55,11 @@ public class StackAdvisorResourceProviderTest {
CONFIGURATIONS_PROPERTY_ID + "site/properties/string_prop", "string",
CONFIGURATIONS_PROPERTY_ID + "site/properties/array_prop",
Lists.newArrayList("array1", "array2"));
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculatedConfigurations = provider.calculateConfigurations(request);
+ Map<String, Map<String, Map<String, String>>> calculatedConfigurations =
provider.calculateConfigurations(request);
assertNotNull(calculatedConfigurations);
assertEquals(1, calculatedConfigurations.size());
- SortedMap<String, SortedMap<String, String>> site =
calculatedConfigurations.get("site");
+ Map<String, Map<String, String>> site =
calculatedConfigurations.get("site");
assertNotNull(site);
assertEquals(1, site.size());
Map<String, String> properties = site.get("properties");
@@ -113,11 +112,11 @@ public class StackAdvisorResourceProviderTest {
CONFIGURATIONS_PROPERTY_ID + "site/properties/string_prop", null,
CONFIGURATIONS_PROPERTY_ID + "site/properties/array_prop",
Lists.newArrayList("array1", "array2"));
- SortedMap<String, SortedMap<String, SortedMap<String, String>>>
calculatedConfigurations = provider.calculateConfigurations(request);
+ Map<String, Map<String, Map<String, String>>> calculatedConfigurations =
provider.calculateConfigurations(request);
assertNotNull(calculatedConfigurations);
assertEquals(1, calculatedConfigurations.size());
- SortedMap<String, SortedMap<String, String>> site =
calculatedConfigurations.get("site");
+ Map<String, Map<String, String>> site =
calculatedConfigurations.get("site");
assertNotNull(site);
assertEquals(1, site.size());
Map<String, String> properties = site.get("properties");
diff --git
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
index 655b703..da75ed2 100644
---
a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
+++
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
@@ -42,8 +42,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
import javax.persistence.EntityManager;
@@ -749,7 +747,7 @@ public class ClusterTest {
ServiceComponentHost scDNH2 = serviceComponentHostFactory.createNew(scDN,
"h2");
scDN.addServiceComponentHost(scDNH2);
- SortedMap<String, SortedSet<String>> componentHostMap;
+ Map<String, Set<String>> componentHostMap;
componentHostMap = c1.getServiceComponentHostMap(null, null);
Assert.assertEquals(2, componentHostMap.size());
@@ -791,7 +789,7 @@ public class ClusterTest {
ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT,
"h1");
scJT.addServiceComponentHost(schJTH1);
- SortedMap<String, SortedSet<String>> componentHostMap;
+ Map<String, Set<String>> componentHostMap;
componentHostMap = c1.getServiceComponentHostMap(null,
Collections.singleton("HDFS"));
Assert.assertEquals(2, componentHostMap.size());
@@ -849,7 +847,7 @@ public class ClusterTest {
ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT,
"h1");
scJT.addServiceComponentHost(schJTH1);
- SortedMap<String, SortedSet<String>> componentHostMap;
+ Map<String, Set<String>> componentHostMap;
componentHostMap =
c1.getServiceComponentHostMap(Collections.singleton("h1"), null);
Assert.assertEquals(3, componentHostMap.size());
@@ -908,7 +906,7 @@ public class ClusterTest {
ServiceComponentHost schJTH1 = serviceComponentHostFactory.createNew(scJT,
"h1");
scJT.addServiceComponentHost(schJTH1);
- SortedMap<String, SortedSet<String>> componentHostMap;
+ Map<String, Set<String>> componentHostMap;
componentHostMap =
c1.getServiceComponentHostMap(Collections.singleton("h1"),
Collections.singleton("HDFS"));
Assert.assertEquals(2, componentHostMap.size());