You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/09/14 16:27:42 UTC
ambari git commit: AMBARI-21960. Cluster provision should allow repo
version and repo version id be null to allow default stack version deployment
(ncole)
Repository: ambari
Updated Branches:
refs/heads/branch-2.6 6407f9329 -> bf3a485e4
AMBARI-21960. Cluster provision should allow repo version and repo version id be null to allow default stack version deployment (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf3a485e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf3a485e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf3a485e
Branch: refs/heads/branch-2.6
Commit: bf3a485e4b9f2eace27dc2a088f5d120285bb845
Parents: 6407f93
Author: Nate Cole <nc...@hortonworks.com>
Authored: Thu Sep 14 11:09:16 2017 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Thu Sep 14 12:07:10 2017 -0400
----------------------------------------------------------------------
.../ambari/server/topology/TopologyManager.java | 30 +++++++++-----------
.../server/topology/TopologyManagerTest.java | 2 +-
2 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bf3a485e/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 092339b..140bcb6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -106,14 +106,14 @@ public class TopologyManager {
private final ExecutorService executor = Executors.newSingleThreadExecutor();
private final Executor taskExecutor; // executes TopologyTasks
private final boolean parallelTaskCreationEnabled;
- private Collection<String> hostsToIgnore = new HashSet<String>();
- private final List<HostImpl> availableHosts = new LinkedList<HostImpl>();
- private final Map<String, LogicalRequest> reservedHosts = new HashMap<String, LogicalRequest>();
- private final Map<Long, LogicalRequest> allRequests = new HashMap<Long, LogicalRequest>();
+ private Collection<String> hostsToIgnore = new HashSet<>();
+ private final List<HostImpl> availableHosts = new LinkedList<>();
+ private final Map<String, LogicalRequest> reservedHosts = new HashMap<>();
+ private final Map<Long, LogicalRequest> allRequests = new HashMap<>();
// priority is given to oldest outstanding requests
- private final Collection<LogicalRequest> outstandingRequests = new ArrayList<LogicalRequest>();
+ private final Collection<LogicalRequest> outstandingRequests = new ArrayList<>();
//todo: currently only support a single cluster
- private Map<Long, ClusterTopology> clusterTopologyMap = new HashMap<Long, ClusterTopology>();
+ private Map<Long, ClusterTopology> clusterTopologyMap = new HashMap<>();
@Inject
private StackAdvisorBlueprintProcessor stackAdvisorBlueprintProcessor;
@@ -274,10 +274,6 @@ public class TopologyManager {
SecurityType securityType = null;
Credential credential = null;
- if (null == repoVersion && null == repoVersionID) {
- throw new AmbariException("Repository should be created and the version passed in the request.");
- }
-
SecurityConfiguration securityConfiguration = processSecurityConfiguration(request);
if (securityConfiguration != null && securityConfiguration.getType() == SecurityType.KERBEROS) {
@@ -603,7 +599,7 @@ public class TopologyManager {
PersistedTopologyRequest persistedRequest = persistedState.persistTopologyRequest(request);
LogicalRequest logicalRequest = createLogicalRequest(persistedRequest, topology, logicalRequestId);
-
+
return logicalRequest;
}
@@ -716,7 +712,7 @@ public class TopologyManager {
if (requestIds.isEmpty()) {
return allRequests.values();
} else {
- Collection<LogicalRequest> matchingRequests = new ArrayList<LogicalRequest>();
+ Collection<LogicalRequest> matchingRequests = new ArrayList<>();
for (long id : requestIds) {
LogicalRequest request = allRequests.get(id);
if (request != null) {
@@ -733,7 +729,7 @@ public class TopologyManager {
*/
public Collection<StageEntity> getStages() {
ensureInitialized();
- Collection<StageEntity> stages = new ArrayList<StageEntity>();
+ Collection<StageEntity> stages = new ArrayList<>();
for (LogicalRequest logicalRequest : allRequests.values()) {
stages.addAll(logicalRequest.getStageEntities());
}
@@ -748,7 +744,7 @@ public class TopologyManager {
public Collection<HostRoleCommand> getTasks(Collection<Long> requestIds) {
ensureInitialized();
- Collection<HostRoleCommand> tasks = new ArrayList<HostRoleCommand>();
+ Collection<HostRoleCommand> tasks = new ArrayList<>();
for (long id : requestIds) {
tasks.addAll(getTasks(id));
}
@@ -771,7 +767,7 @@ public class TopologyManager {
public Collection<RequestStatusResponse> getRequestStatus(Collection<Long> ids) {
ensureInitialized();
- List<RequestStatusResponse> requestStatusResponses = new ArrayList<RequestStatusResponse>();
+ List<RequestStatusResponse> requestStatusResponses = new ArrayList<>();
for (long id : ids) {
RequestStatusResponse response = getRequestStatus(id);
if (response != null) {
@@ -797,7 +793,7 @@ public class TopologyManager {
*/
public Map<String, Collection<String>> getPendingHostComponents() {
ensureInitialized();
- Map<String, Collection<String>> hostComponentMap = new HashMap<String, Collection<String>>();
+ Map<String, Collection<String>> hostComponentMap = new HashMap<>();
for (LogicalRequest logicalRequest : allRequests.values()) {
Map<Long, HostRoleCommandStatusSummaryDTO> summary = logicalRequest.getStageSummaries();
@@ -817,7 +813,7 @@ public class TopologyManager {
String host = entry.getKey();
Collection<String> hostComponents = hostComponentMap.get(host);
if (hostComponents == null) {
- hostComponents = new HashSet<String>();
+ hostComponents = new HashSet<>();
hostComponentMap.put(host, hostComponents);
}
hostComponents.addAll(entry.getValue());
http://git-wip-us.apache.org/repos/asf/ambari/blob/bf3a485e/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
index 8d891b9..863fae1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
@@ -118,6 +118,7 @@ public class TopologyManagerTest {
@Mock(type = MockType.NICE)
private ProvisionClusterRequest request;
+
private final PersistedTopologyRequest persistedTopologyRequest = new PersistedTopologyRequest(1, request);
@Mock(type = MockType.STRICT)
private LogicalRequestFactory logicalRequestFactory;
@@ -283,7 +284,6 @@ public class TopologyManagerTest {
expect(request.getDescription()).andReturn("Provision Cluster Test").anyTimes();
expect(request.getConfiguration()).andReturn(topoConfiguration).anyTimes();
expect(request.getHostGroupInfo()).andReturn(groupInfoMap).anyTimes();
- expect(request.getRepositoryVersion()).andReturn("1").anyTimes();
expect(request.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.NEVER_APPLY).anyTimes();
expect(request.getSecurityConfiguration()).andReturn(null).anyTimes();