----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/27050/#review58747 -----------------------------------------------------------
The changes look good but I want to make sure that two specific manual functional tests are done to ensure correct api behavior. 1. The above metnitioned URL http://localhost:8080/api/v1/clusters/test/hosts/c6402.ambari.apache./host_components should result in a 404 response to the user since the non-existant host is specified as a parent resource. 2. If the non-existant hostname is specified in the query string, this should return a 200 response with an empty set of host components since the provided predicate doesn't match any resources http://localhost:8080/api/v1/clusters/test/host_components?HostRoles/host_name=BAD.NAME I believe that the above two tests will exhibit the correct behavior with this patch but would like it to be confirmed. - John Speidel On Oct. 22, 2014, 8:23 p.m., Ritesh Jaltare wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/27050/ > ----------------------------------------------------------- > > (Updated Oct. 22, 2014, 8:23 p.m.) > > > Review request for Ambari. > > > Bugs: AMBARI-6700 > https://issues.apache.org/jira/browse/AMBARI-6700 > > > Repository: ambari > > > Description > ------- > > Supplying a non-existent host in the hostRole/host_name filter to the > host_components end point in the Ambari API results in a "500 Server Error" > to the client and a Null Pointer Exception in the logs. > > FIX: > > Modify ClustersImpl.getClustersForHost to throw a HostNotFoundException for a > non existent host. > > LOG: > > > 16:51:11,033 WARN [qtp2101150571-448] ServletHandler:514 - > /api/v1/clusters/PoC/host_components > java.lang.NullPointerException > at > java.util.Collections$UnmodifiableCollection.<init>(Collections.java:1051) > at java.util.Collections$UnmodifiableSet.<init>(Collections.java:1122) > at java.util.Collections.unmodifiableSet(Collections.java:1112) > at > org.apache.ambari.server.state.cluster.ClustersImpl.getClustersForHost(ClustersImpl.java:260) > at > org.apache.ambari.server.controller.AmbariManagementControllerImpl.getHostComponents(AmbariManagementControllerImpl.java:737) > at > org.apache.ambari.server.controller.AmbariManagementControllerImpl.getHostComponents(AmbariManagementControllerImpl.java:2364) > > > > > > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java > a57e9c2 > > ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java > 2baa5c5 > > Diff: https://reviews.apache.org/r/27050/diff/ > > > Testing > ------- > > Modified a test case testClusterHostMapping in ClustersTest.java which tests > the particular scenario for passing an invalid hostname to > ClustersImpl.getClustersForHost. > > > Thanks, > > Ritesh Jaltare > >
