use of io.mantisrx.shaded.com.fasterxml.jackson.databind.JsonNode in project mantis by Netflix.
the class OffsetAndMetadataDeserializer method deserialize.
@Override
public OffsetAndMetadata deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
final JsonNode node = p.getCodec().readTree(p);
final long offset = node.get("offset").longValue();
final String metadata = node.get("metadata").textValue();
return new OffsetAndMetadata(offset, metadata);
}
use of io.mantisrx.shaded.com.fasterxml.jackson.databind.JsonNode in project mantis by Netflix.
the class JobsRouteTest method validateJobResponse.
private void validateJobResponse(String resp) {
try {
assert !Strings.isNullOrEmpty(resp);
ObjectMapper mapper = new ObjectMapper();
JsonNode responseObj = mapper.readTree(resp);
assert responseObj.get("jobMetadata").get("name").asText().equals(TEST_CLUSTER);
assert responseObj.get("jobMetadata").get("jobId").asText().startsWith("sine-function-");
assert responseObj.get("jobMetadata").get("sla") != null;
assert responseObj.get("jobMetadata").get("labels") != null;
assert responseObj.get("stageMetadataList") != null;
assert responseObj.get("workerMetadataList") != null;
} catch (IOException ex) {
logger.error("Failed to validate job response: " + ex.getMessage());
assert false;
}
}
use of io.mantisrx.shaded.com.fasterxml.jackson.databind.JsonNode in project mantis by Netflix.
the class JobsRouteTest method validateJobsListResponse.
private void validateJobsListResponse(String resp, int expectedJobsCount, boolean isCompact) {
try {
assert !Strings.isNullOrEmpty(resp);
ObjectMapper mapper = new ObjectMapper();
JsonNode responseObj = mapper.readTree(resp).get("list");
assert responseObj.size() == expectedJobsCount;
for (int i = 0; i < expectedJobsCount; i++) {
validateJobsListItem(responseObj.get(i), isCompact);
}
} catch (IOException ex) {
logger.error("Failed to validate job response: " + ex.getMessage());
assert false;
}
}
use of io.mantisrx.shaded.com.fasterxml.jackson.databind.JsonNode in project mantis by Netflix.
the class JobsRouteTest method validateJobDetails.
private void validateJobDetails(String resp) {
try {
assert !Strings.isNullOrEmpty(resp);
ObjectMapper mapper = new ObjectMapper();
JsonNode responseObj = mapper.readTree(resp);
validateJobsListItem(responseObj, false);
} catch (IOException ex) {
logger.error("Failed to validate job details response: " + ex.getMessage());
assert false;
}
}
use of io.mantisrx.shaded.com.fasterxml.jackson.databind.JsonNode in project mantis by Netflix.
the class JobClustersRouteTest method compareClusterInstancePayload.
private void compareClusterInstancePayload(String clusterGetResponse) {
try {
ObjectMapper mapper = new ObjectMapper();
JsonNode requestObj = mapper.readTree(JobClusterPayloads.JOB_CLUSTER_CREATE);
JsonNode responseObj = mapper.readTree(clusterGetResponse);
assertEquals(responseObj.get("name").toString(), requestObj.get("jobDefinition").get("name").toString());
assertEquals(responseObj.get("jars").get(0).get("url").toString(), requestObj.get("jobDefinition").get("jobJarFileLocation").toString());
assertEquals(responseObj.get("jars").get(0).get("version").toString(), requestObj.get("jobDefinition").get("version").toString());
} catch (IOException ex) {
assert ex == null;
}
}
Aggregations