Github user grkvlt commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/317#discussion_r20188599
--- Diff:
software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
---
@@ -392,29 +387,19 @@ public Boolean call() throws Exception {
}
}
- private Iterable<String> getNodesHostAndPort() {
- Function<JsonElement, Iterable<String>> getNodesAsList = new
Function<JsonElement, Iterable<String>>() {
- @Override public Iterable<String> apply(JsonElement input) {
- if (input == null) {
- return Collections.emptyList();
- }
- Collection<String> names = Lists.newArrayList();
- JsonArray nodes = input.getAsJsonArray();
- for (JsonElement element : nodes) {
- // NOTE: the 'hostname' element also includes the port
-
names.add(element.getAsJsonObject().get("hostname").toString().replace("\"",
""));
- }
- return names;
- }
- };
- HttpToolResponse nodesResponse =
getApiResponse(String.format("http://%s:%s/pools/nodes", getHostname(),
getWebPort()));
- return Functionals.chain(
- HttpValueFunctions.jsonContents(),
- JsonFunctions.walkN("nodes"),
- getNodesAsList
- ).apply(nodesResponse);
+ private Iterable<HostAndPort> getNodesHostAndPort() {
+ Group group = Iterables.getFirst(getEntity().getGroups(), null);
+ if (group == null) return Lists.newArrayList();
+ return
Iterables.transform(group.getAttribute(CouchbaseCluster.COUCHBASE_CLUSTER_UP_NODES),
+ new Function<Entity, HostAndPort>() {
+ @Nullable
+ @Override
+ public HostAndPort apply(@Nullable Entity input) {
--- End diff --
Not actually `@Nullable` so remove annotation
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---