ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [1/2] ambari git commit: AMBARI-19183. Ambari allows creation of invalid config type. (mpapirkovskyy)
Date Tue, 03 Jan 2017 19:10:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 060e8424a -> 160027748


AMBARI-19183. Ambari allows creation of invalid config type. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cddd64a3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cddd64a3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cddd64a3

Branch: refs/heads/trunk
Commit: cddd64a358832fcda8969e6ce95f1946748efb06
Parents: 060e842
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Tue Jan 3 19:53:24 2017 +0200
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Tue Jan 3 20:58:43 2017 +0200

----------------------------------------------------------------------
 .../server/controller/internal/ConfigGroupResourceProvider.java  | 4 ++--
 .../controller/internal/ConfigGroupResourceProviderTest.java     | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cddd64a3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index 2373068..17924cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -579,6 +579,8 @@ public class ConfigGroupResourceProvider extends
           getManagementController().getAuthName(), request.getGroupName(), request.getTag(),
           cluster.getClusterName());
 
+      verifyConfigs(request.getConfigs(), cluster.getClusterName());
+
       ConfigGroup configGroup = configGroupFactory.createNew(cluster,
         request.getGroupName(),
         request.getTag(), request.getDescription(),
@@ -586,8 +588,6 @@ public class ConfigGroupResourceProvider extends
 
       configGroup.setServiceName(serviceName);
 
-      verifyConfigs(configGroup.getConfigurations(), cluster.getClusterName());
-
       cluster.addConfigGroup(configGroup);
       if (serviceName != null) {
         cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/cddd64a3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
index 1d7a50b..671d0fd 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
@@ -21,6 +21,7 @@ import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertTrue;
 import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.createNiceMock;
@@ -160,6 +161,8 @@ public class ConfigGroupResourceProviderTest {
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     expect(clusters.getHost("h1")).andReturn(h1);
     expect(clusters.getHost("h2")).andReturn(h2);
+    expect(cluster.getClusterName()).andReturn("Cluster100").anyTimes();
+    expect(cluster.isConfigTypeExists(anyString())).andReturn(true).anyTimes();
     expect(managementController.getConfigGroupFactory()).andReturn(configGroupFactory);
     expect(managementController.getAuthName()).andReturn("admin").anyTimes();
     expect(hostDAO.findByName("h1")).andReturn(hostEntity1).atLeastOnce();


Mime
View raw message