ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hurley" <jhur...@hortonworks.com>
Subject Review Request 27372: Alerts: Creating WEB Alert Definitions via REST API Drops URI
Date Thu, 30 Oct 2014 03:31:28 GMT

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

Review request for Ambari and Nate Cole.


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


Repository: ambari


Description
-------

When creating an AlertDefinition via the REST APIs, the ResourceProvider takes the JSON payload
and converts it to a flattened list of properties (such as AlertDefinition/source/reporting/critical/text
= 'foo').

This causes a problem when attempting to convert and serialize the Source field since this
is a first-class object (such as MetricSource). Each of the flat properties has to be converted
into appropriate JSON to be serialized to the database. Although this was working for the
"reporting" structure, it was not working for the updated URI structure or the JMX property
structure.

I could have gone through and created keys for all of the missing flattened properties, but
then adding a new property in the future would have a similar problem.

Instead, I recursively builds JsonObject instances based on the flat set of properties.


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java
e1c0082 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java
a82e8c4 

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


Testing
-------

Created several different types of AlertDefinitions (Metric, Web, etc) including exampels
of failing AlertDefinitions. Verified that they are created successfully and the returned
JSON from the GET is correct.

Updated test cases to reflect the changes and to further exercise the uri and reporting structures.


Thanks,

Jonathan Hurley


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