@Test(expectedExceptions = NullPointerException.class) public void testNullJsonThrows() { assertThat(ambariServer.getHosts().apply(null), sizeEquals(0)); }
Function<JsonElement, List<String>> getHosts() { Function<JsonElement, List<String>> path = new Function<JsonElement, List<String>>() { @Nullable @Override public List<String> apply(@Nullable JsonElement jsonElement) { try { String jsonString = jsonElement.toString(); return JsonPath.read(jsonString, "$.items[*].Hosts.host_name"); } catch (PathNotFoundException e) { return ImmutableList.of(); } } }; return path; }
AmbariServerImpl extends SoftwareProcessImpl implements AmbariServer { Function<JsonElement, List<String>> getHosts() { Function<JsonElement, List<String>> path = new Function<JsonElement, List<String>>() { @Nullable @Override public List<String> apply(@Nullable JsonElement jsonElement) { try { String jsonString = jsonElement.toString(); return JsonPath.read(jsonString, "$.items[*].Hosts.host_name"); } catch (PathNotFoundException e) { return ImmutableList.of(); } } }; return path; } }
AmbariServerImpl extends SoftwareProcessImpl implements AmbariServer { Function<JsonElement, List<String>> getHosts() { Function<JsonElement, List<String>> path = new Function<JsonElement, List<String>>() { @Nullable @Override public List<String> apply(@Nullable JsonElement jsonElement) { try { String jsonString = jsonElement.toString(); return JsonPath.read(jsonString, "$.items[*].Hosts.host_name"); } catch (PathNotFoundException e) { return ImmutableList.of(); } } }; return path; }  }
AmbariServerImpl extends SoftwareProcessImpl implements AmbariServer { Function<JsonElement, List<String>> getHosts() { Function<JsonElement, List<String>> path = new Function<JsonElement, List<String>>() { @Nullable @Override public List<String> apply(@Nullable JsonElement jsonElement) { try { String jsonString = jsonElement.toString(); return JsonPath.read(jsonString, "$.items[*].Hosts.host_name"); } catch (PathNotFoundException e) { return ImmutableList.of(); } } }; return path; }  @Override Class<AmbariServerDriver> getDriverInterface(); @Override void disconnectSensors(); @Override RecommendationWrappers getRecommendations(String stackName, String stackVersion, List<String> hosts, List<String> services); @Override Request deployCluster(String clusterName, String blueprintName, RecommendationWrapper recommendationWrapper, Map config); @Override void addHostToCluster(@EffectorParam(name = "Cluster name") String cluster,
                                 @EffectorParam(name = "Host FQDN") String hostName); @Override void createCluster(@EffectorParam(name = "Cluster Name") String clusterName,
                              @EffectorParam(name = "Blueprint Name") String blueprintName,
                              @EffectorParam(name = "Stack Name") String stackName,
                              @EffectorParam(name = "Stack version") String stackVersion,
                              @EffectorParam(name = "Hosts", description = "List of FQDNs to add to cluster") List<String> hosts,
                              @EffectorParam(name = "Services", description = "List of services to install on cluster") List<String> services,
                              @EffectorParam(name = "Configurations", description = "Map of configurations to apply to blueprint") Map<String, Map> config); @Override void updateStackRepository(@EffectorParam(name = "Stack Name") String stackName, @EffectorParam(name = "Stack Version") String stackVersion, @EffectorParam(name = "Operating System") String os, @EffectorParam(name = "Repository Name") String repoName, @EffectorParam(name = "Repository URL") String url); @Override void addServiceToCluster(@EffectorParam(name = "cluster", description = "Cluster name") final String cluster,
                                    @EffectorParam(name = "service", description = "Service name") final String service,
                                    @EffectorParam(name = "mappings", description = "Mappings of component to host") Map<String, String> mappings,
                                    @EffectorParam(name = "configuration", description = "Services Configuration", nullable = true, defaultValue = EffectorParam.MAGIC_STRING_MEANING_NULL) Map<String, Map<Object, Object>> configuration); @Override void createServiceConfiguration(@EffectorParam(name = "Cluster name") String cluster,
                                           @EffectorParam(name = "Component configuration key") String configurationKey,
                                           @EffectorParam(name = "Component configuration") Map<Object, Object> configuration); @Override void addHostsToHostGroup(final String blueprintName, final String hostgroupName, final List<String> hosts, final String cluster); @Override void addAlertNotification(String name, String description, Boolean global, String notificationType,
                                     List<String> alertStates, List<String> ambariDispatchRecipients,
                                     String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void editAlertNotification(String name, String description, Boolean global, String notificationType,
                                      List<String> alertStates, List<String> ambariDispatchRecipients,
                                      String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void deleteAlertNotification(String name); @Override void addAlertGroup(@EffectorParam(name = "Name") String name,
                              @EffectorParam(name = "Definitions") List<Integer> definitions); @Override void startService(@EffectorParam(name = "Cluster name") String cluster,
                             @EffectorParam(name = "Service name") final String service); @Override boolean agentOnServer(); @Override String getFqdn(); @Override void setFqdn(String fqdn); void setRestAdapter(RestAdapter restAdapter); @Override void postStart(); }
AmbariServerImpl extends SoftwareProcessImpl implements AmbariServer { Function<JsonElement, List<String>> getHosts() { Function<JsonElement, List<String>> path = new Function<JsonElement, List<String>>() { @Nullable @Override public List<String> apply(@Nullable JsonElement jsonElement) { try { String jsonString = jsonElement.toString(); return JsonPath.read(jsonString, "$.items[*].Hosts.host_name"); } catch (PathNotFoundException e) { return ImmutableList.of(); } } }; return path; }  @Override Class<AmbariServerDriver> getDriverInterface(); @Override void disconnectSensors(); @Override RecommendationWrappers getRecommendations(String stackName, String stackVersion, List<String> hosts, List<String> services); @Override Request deployCluster(String clusterName, String blueprintName, RecommendationWrapper recommendationWrapper, Map config); @Override void addHostToCluster(@EffectorParam(name = "Cluster name") String cluster,
                                 @EffectorParam(name = "Host FQDN") String hostName); @Override void createCluster(@EffectorParam(name = "Cluster Name") String clusterName,
                              @EffectorParam(name = "Blueprint Name") String blueprintName,
                              @EffectorParam(name = "Stack Name") String stackName,
                              @EffectorParam(name = "Stack version") String stackVersion,
                              @EffectorParam(name = "Hosts", description = "List of FQDNs to add to cluster") List<String> hosts,
                              @EffectorParam(name = "Services", description = "List of services to install on cluster") List<String> services,
                              @EffectorParam(name = "Configurations", description = "Map of configurations to apply to blueprint") Map<String, Map> config); @Override void updateStackRepository(@EffectorParam(name = "Stack Name") String stackName, @EffectorParam(name = "Stack Version") String stackVersion, @EffectorParam(name = "Operating System") String os, @EffectorParam(name = "Repository Name") String repoName, @EffectorParam(name = "Repository URL") String url); @Override void addServiceToCluster(@EffectorParam(name = "cluster", description = "Cluster name") final String cluster,
                                    @EffectorParam(name = "service", description = "Service name") final String service,
                                    @EffectorParam(name = "mappings", description = "Mappings of component to host") Map<String, String> mappings,
                                    @EffectorParam(name = "configuration", description = "Services Configuration", nullable = true, defaultValue = EffectorParam.MAGIC_STRING_MEANING_NULL) Map<String, Map<Object, Object>> configuration); @Override void createServiceConfiguration(@EffectorParam(name = "Cluster name") String cluster,
                                           @EffectorParam(name = "Component configuration key") String configurationKey,
                                           @EffectorParam(name = "Component configuration") Map<Object, Object> configuration); @Override void addHostsToHostGroup(final String blueprintName, final String hostgroupName, final List<String> hosts, final String cluster); @Override void addAlertNotification(String name, String description, Boolean global, String notificationType,
                                     List<String> alertStates, List<String> ambariDispatchRecipients,
                                     String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void editAlertNotification(String name, String description, Boolean global, String notificationType,
                                      List<String> alertStates, List<String> ambariDispatchRecipients,
                                      String mailSmtpHost, Integer mailSmtpPort, String mailSmtpFrom, Boolean mailSmtpAuth); @Override void deleteAlertNotification(String name); @Override void addAlertGroup(@EffectorParam(name = "Name") String name,
                              @EffectorParam(name = "Definitions") List<Integer> definitions); @Override void startService(@EffectorParam(name = "Cluster name") String cluster,
                             @EffectorParam(name = "Service name") final String service); @Override boolean agentOnServer(); @Override String getFqdn(); @Override void setFqdn(String fqdn); void setRestAdapter(RestAdapter restAdapter); @Override void postStart(); static final Logger LOG; static final Map<String, String> BASE_BLUEPRINTS; static final List<? extends Map<?, ?>> CONFIGURATIONS; }