You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/05/14 19:34:11 UTC
ambari git commit: AMBARI-11139. NPE when setting desired config via
REST API.(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/trunk e50a2ac31 -> 8263f2f1b
AMBARI-11139. NPE when setting desired config via REST API.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8263f2f1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8263f2f1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8263f2f1
Branch: refs/heads/trunk
Commit: 8263f2f1b5de393f2f3eeefb3fc1c4112f6da8d2
Parents: e50a2ac
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Sun May 10 19:14:26 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Sun May 10 19:15:03 2015 +0300
----------------------------------------------------------------------
.../AmbariManagementControllerImpl.java | 1 +
.../AmbariManagementControllerTest.java | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8263f2f1/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 09adf51..d1aebae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1282,6 +1282,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
clusterConfigProperties = clusterConfig.getProperties();
} else {
isConfigurationCreationNeeded = true;
+ break;
}
if (requestConfigProperties == null || requestConfigProperties.isEmpty()) {
Config existingConfig = cluster.getConfig(desiredConfig.getType(), desiredConfig.getVersionTag());
http://git-wip-us.apache.org/repos/asf/ambari/blob/8263f2f1/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 14dc186..00f9bed 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -5246,12 +5246,22 @@ public class AmbariManagementControllerTest {
configs.put("a", "b");
Map<String, String> configs2 = new HashMap<String, String>();
configs2.put("c", "d");
+ Map<String, String> configs3 = new HashMap<String, String>();
- ConfigurationRequest cr1,cr2,cr3;
+ ConfigurationRequest cr1,cr2,cr3,cr4;
cr1 = new ConfigurationRequest(clusterName, "core-site","version1",
configs, null);
cr2 = new ConfigurationRequest(clusterName, "hdfs-site","version1",
configs, null);
+ cr4 = new ConfigurationRequest(clusterName, "kerberos-env", "version1",
+ configs3, null);
+
+ ConfigFactory cf = injector.getInstance(ConfigFactory.class);
+ Config config1 = cf.createNew(cluster, "kerberos-env",
+ new HashMap<String, String>(), new HashMap<String, Map<String,String>>());
+ config1.setTag("version1");
+
+ cluster.addConfig(config1);
ClusterRequest crReq = new ClusterRequest(cluster.getClusterId(), clusterName, null, null);
crReq.setDesiredConfig(Collections.singletonList(cr1));
@@ -5259,12 +5269,15 @@ public class AmbariManagementControllerTest {
crReq = new ClusterRequest(cluster.getClusterId(), clusterName, null, null);
crReq.setDesiredConfig(Collections.singletonList(cr2));
controller.updateClusters(Collections.singleton(crReq), null);
+ crReq = new ClusterRequest(cluster.getClusterId(), clusterName, null, null);
+ crReq.setDesiredConfig(Collections.singletonList(cr4));
+ controller.updateClusters(Collections.singleton(crReq), null);
// Install
long requestId1 = installService(clusterName, serviceName1, true, false);
List<Stage> stages = actionDB.getAllStages(requestId1);
- Assert.assertEquals(2, stages.get(0).getOrderedHostRoleCommands().get(0)
+ Assert.assertEquals(3, stages.get(0).getOrderedHostRoleCommands().get(0)
.getExecutionCommandWrapper().getExecutionCommand()
.getConfigurationTags().size());
@@ -5320,7 +5333,7 @@ public class AmbariManagementControllerTest {
Assert.assertNotNull(hdfsCmdHost2);
ExecutionCommand execCmd = hdfsCmdHost3.getExecutionCommandWrapper()
.getExecutionCommand();
- Assert.assertEquals(2, execCmd.getConfigurationTags().size());
+ Assert.assertEquals(3, execCmd.getConfigurationTags().size());
Assert.assertEquals("version122", execCmd.getConfigurationTags().get
("core-site").get("tag"));
Assert.assertEquals("d", execCmd.getConfigurations().get("core-site")