ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-9495. Call to save configs of different services together should 400 return code not 500 (aonishuk)
Date Thu, 05 Feb 2015 16:54:15 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk c7db1c5c6 -> c52f70bcf


AMBARI-9495. Call to save configs of different services together should 400 return code not
500 (aonishuk)


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

Branch: refs/heads/trunk
Commit: c52f70bcfdc207e7ea2dd4a5e8966855d631e61f
Parents: c7db1c5
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Feb 5 18:54:06 2015 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Feb 5 18:54:06 2015 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/ambari/server/state/Cluster.java    | 4 ++--
 .../org/apache/ambari/server/state/cluster/ClusterImpl.java  | 8 ++++----
 .../org/apache/ambari/server/state/cluster/ClusterTest.java  | 4 ++--
 .../server/state/svccomphost/ServiceComponentHostTest.java   | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c52f70bc/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
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 514c8e0..6b8a917 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
@@ -279,7 +279,7 @@ public interface Cluster {
    * @return <code>true</code> if the config was added, or <code>false</code>
    * if the config is already set as the current
    */
-  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs)
throws AmbariException;
+  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs);
 
   /**
    * Adds and sets a DESIRED configuration to be applied to a cluster.  There
@@ -290,7 +290,7 @@ public interface Cluster {
    * @return <code>true</code> if the config was added, or <code>false</code>
    * if the config is already set as the current
    */
-  ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs, String
serviceConfigVersionNote) throws AmbariException;
+  ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs, String
serviceConfigVersionNote);
 
   ServiceConfigVersionResponse createServiceConfigVersion(String serviceName, String user,
String note,
                                                           ConfigGroup configGroup);

http://git-wip-us.apache.org/repos/asf/ambari/blob/c52f70bc/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
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 4a8c020..3710872 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
@@ -1753,12 +1753,12 @@ public class ClusterImpl implements Cluster {
   }
 
   @Override
-  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs)
throws AmbariException {
+  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs)
{
     return addDesiredConfig(user, configs, null);
   }
 
   @Override
-  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs,
String serviceConfigVersionNote) throws AmbariException {
+  public ServiceConfigVersionResponse addDesiredConfig(String user, Set<Config> configs,
String serviceConfigVersionNote) {
     if (null == user) {
       throw new NullPointerException("User must be specified.");
     }
@@ -2161,7 +2161,7 @@ public class ClusterImpl implements Cluster {
   }
 
   @Transactional
-  ServiceConfigVersionResponse applyConfigs(Set<Config> configs, String user, String
serviceConfigVersionNote) throws AmbariException {
+  ServiceConfigVersionResponse applyConfigs(Set<Config> configs, String user, String
serviceConfigVersionNote) {
 
     String serviceName = null;
     for (Config config : configs) {
@@ -2173,7 +2173,7 @@ public class ClusterImpl implements Cluster {
           } else if (!serviceName.equals(entry.getKey())) {
             String error = "Updating configs for multiple services by a " +
                 "single API request isn't supported";
-            AmbariException exception = new AmbariException(error);
+            IllegalArgumentException exception = new IllegalArgumentException(error);
             LOG.error(error + ", config version not created");
             throw exception;
           } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c52f70bc/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java
----------------------------------------------------------------------
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 bb6a713..c4dfdb8 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
@@ -388,7 +388,7 @@ public class ClusterTest {
 
 
   @Test
-  public void testGetAndSetConfigs() throws AmbariException {
+  public void testGetAndSetConfigs() {
 
     Map<String, Map<String, String>> c1PropAttributes = new HashMap<String,
Map<String,String>>();
     c1PropAttributes.put("final", new HashMap<String, String>());
@@ -724,7 +724,7 @@ public class ClusterTest {
   }
 
   @Test
-  public void testSingleServiceVersionForMultipleConfigs() throws AmbariException {
+  public void testSingleServiceVersionForMultipleConfigs() {
     Config config1 = configFactory.createNew(c1, "hdfs-site",
       new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>());
     config1.setTag("version1");

http://git-wip-us.apache.org/repos/asf/ambari/blob/c52f70bc/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
index f65bbd9..8ebf2ce 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java
@@ -1061,7 +1061,7 @@ public class ServiceComponentHostTest {
    * @param tag the config tag
    * @param values the values for the config
    */
-  private void makeConfig(Cluster cluster, String type, String tag, Map<String, String>
values, Map<String, Map<String, String>> attributes) throws AmbariException {
+  private void makeConfig(Cluster cluster, String type, String tag, Map<String, String>
values, Map<String, Map<String, String>> attributes) {
     Config config = configFactory.createNew(cluster, type, values, attributes);
     config.setTag(tag);
     config.persist();


Mime
View raw message