use of com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode in project couchbase-jvm-clients by couchbase.
the class BucketSettings method create.
/**
* Helper method to create {@link BucketSettings} from a Jackson JsonNode.
*
* @param tree the node tree to evaluate.
* @return the decoded {@link BucketSettings}.
*/
static BucketSettings create(final JsonNode tree) {
BucketSettings settings = Mapper.convertValue(tree, BucketSettings.class);
JsonNode nodes = tree.get("nodes");
if (nodes.isArray() && !nodes.isEmpty()) {
for (final JsonNode node : nodes) {
String status = node.get("status").asText();
if (!status.equals("healthy")) {
settings.healthy = false;
}
}
} else {
settings.healthy = false;
}
return settings;
}
use of com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode in project kafka-connect-couchbase by couchbase.
the class DocumentPathExtractorTest method assertJsonEquals.
private static void assertJsonEquals(String expected, String actual) throws IOException {
JsonNode parsedExpected = objectMapper.readTree(expected);
JsonNode parsedActual = objectMapper.readTree(actual);
assertEquals(parsedExpected, parsedActual);
}
Aggregations