You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2014/10/30 04:31:28 UTC
Review Request 27372: Alerts: Creating WEB Alert Definitions via REST
API Drops URI
-----------------------------------------------------------
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
Re: Review Request 27372: Alerts: Creating WEB Alert Definitions via
REST API Drops URI
Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27372/#review59182
-----------------------------------------------------------
Ship it!
Ship It!
- Nate Cole
On Oct. 29, 2014, 11:31 p.m., Jonathan Hurley wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/27372/
> -----------------------------------------------------------
>
> (Updated Oct. 29, 2014, 11:31 p.m.)
>
>
> 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
>
>