ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajit Kumar <ajit.ku...@hortonworks.com>
Subject Review Request 42917: Return 409 instead of 500 for duplicate setting creation.
Date Thu, 28 Jan 2016 20:35:38 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42917/
-----------------------------------------------------------

Review request for Ambari, Jayush Luniya and Nahappan Somasundaram.


Bugs: AMBARI-14835
    https://issues.apache.org/jira/browse/AMBARI-14835


Repository: ambari


Description
-------

Currently ambari service is throwing 500 error when user tries to create a new setting with
a name which is already present in DB. Setting name is unique and two settings cannot share
same name. Instead of returning 500 error,  return 409.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AdminSettingResourceProvider.java
f62958fe058b6ee2b07bf8d4e964b154208ccee5 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AdminSettingResourceProviderTest.java
68eaf28e7bd6e34fcab51e38c8eb18c264220811 
  ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AdminSettingDAOTest.java eabbb771172161859431e59e69d423aff446a274


Diff: https://reviews.apache.org/r/42917/diff/


Testing
-------

Manual testing and unit test cases


curl -u admin:admin  -H 'X-Requested-By: ambari' -X POST  http://c6401.ambari.apache.org:8080/api/v1/admin-settings
-d '{"AdminSettings" : {
        "content" : "{tag : some_tage, text: other_text}",
        "name" : "motd",
        "setting_type" : "ambari-server",
        "updated_by" : "admin"
      }}'
{
  "status" : 409,
  "message" : "Attempted to create a setting which already exists, setting name : motd"
}

mvn clean install

[INFO] Ambari Main ....................................... SUCCESS [9.242s]
[INFO] Apache Ambari Project POM ......................... SUCCESS [0.037s]
[INFO] Ambari Web ........................................ SUCCESS [5:10.581s]
[INFO] Ambari Views ...................................... SUCCESS [4.186s]
[INFO] Ambari Admin View ................................. SUCCESS [14.730s]
[INFO] ambari-metrics .................................... SUCCESS [1.025s]
[INFO] Ambari Metrics Common ............................. SUCCESS [2.967s]
[INFO] Ambari Metrics Hadoop Sink ........................ SUCCESS [5.402s]
[INFO] Ambari Metrics Flume Sink ......................... SUCCESS [3.209s]
[INFO] Ambari Metrics Kafka Sink ......................... SUCCESS [5.232s]
[INFO] Ambari Metrics Storm Sink ......................... SUCCESS [2.599s]
[INFO] Ambari Metrics Collector .......................... SUCCESS [1:00.716s]
[INFO] Ambari Metrics Monitor ............................ SUCCESS [3.473s]
[INFO] Ambari Metrics Assembly ........................... SUCCESS [1:00.073s]
[INFO] Ambari Server ..................................... SUCCESS [1:05:00.365s]
[INFO] Ambari Functional Tests ........................... SUCCESS [2:20.719s]
[INFO] Ambari Agent ...................................... SUCCESS [16.068s]
[INFO] Ambari Client ..................................... SUCCESS [0.096s]
[INFO] Ambari Python Client .............................. SUCCESS [2.688s]
[INFO] Ambari Groovy Client .............................. SUCCESS [12.018s]
[INFO] Ambari Shell ...................................... SUCCESS [0.087s]
[INFO] Ambari Python Shell ............................... SUCCESS [1.351s]
[INFO] Ambari Groovy Shell ............................... SUCCESS [9.456s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:16:09.706s
[INFO] Finished at: Thu Jan 28 12:26:19 PST 2016
[INFO] Final Memory: 223M/1295M
[INFO] ------------------------------------------------------------------------


Thanks,

Ajit Kumar


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message