use of com.fasterxml.jackson.databind.JsonNode in project cassandra-mesos-deprecated by mesosphere.
the class SeedManagerTest method before.
@Before
public void before() {
InMemoryState state = new InMemoryState();
PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration(state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "./backup", ".", false, true, "RACK1", "DC1", Arrays.asList(ExternalDc.newBuilder().setName("dc").setUrl("http://dc").build()), "name");
seedManager = new SeedManager(config, new ObjectMapper(), new SystemClock()) {
@Override
@Nullable
protected JsonNode fetchJson(@NotNull final String url) {
try {
return new ObjectMapper().readTree(jsonResponse);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
};
}
use of com.fasterxml.jackson.databind.JsonNode in project cassandra-mesos-deprecated by mesosphere.
the class ClusterBackupControllerTest method testNamedBackup.
@Test
public void testNamedBackup() throws Exception {
// start named backup
Tuple2<Integer, JsonNode> tup = fetchJson("/cluster/backup/start?name=name", true);
assertEquals(200, tup._1.intValue());
JsonNode json = tup._2;
assertTrue(json.has("started"));
assertTrue(json.get("started").asBoolean());
// status
tup = fetchJson("/cluster/backup/status", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.get("running").asBoolean());
JsonNode status = json.get("backup");
assertEquals("name", status.get("backupName").asText());
}
use of com.fasterxml.jackson.databind.JsonNode in project cassandra-mesos-deprecated by mesosphere.
the class ClusterBackupControllerTest method testBackup.
@Test
public void testBackup() throws Exception {
threeNodeCluster();
Tuple2<Integer, JsonNode> tup = fetchJson("/cluster/backup/start", true);
assertEquals(200, tup._1.intValue());
JsonNode json = tup._2;
assertTrue(json.has("started"));
assertTrue(json.get("started").asBoolean());
// fail for backup
tup = fetchJson("/cluster/backup/start", true);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.has("started"));
assertFalse(json.get("started").asBoolean());
// status
tup = fetchJson("/cluster/backup/status", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.get("running").asBoolean());
JsonNode status = json.get("backup");
assertTrue(status.has("type"));
assertTrue(status.has("started"));
assertTrue(status.get("started").isNumber());
assertTrue(status.has("finished"));
assertTrue(status.get("finished").isNull());
assertTrue(status.has("aborted"));
assertFalse(status.get("aborted").asBoolean());
assertTrue(status.has("remainingNodes"));
assertTrue(status.get("remainingNodes").isArray());
assertTrue(status.has("currentNode"));
assertTrue(status.has("completedNodes"));
assertTrue(status.get("completedNodes").isArray());
assertTrue(status.get("backupName").asText(), status.get("backupName").asText().startsWith("backup-"));
// abort
tup = fetchJson("/cluster/backup/abort", true);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.get("aborted").asBoolean());
tup = fetchJson("/cluster/backup/status", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
status = json.get("backup");
assertTrue(status.has("aborted"));
assertTrue(status.get("aborted").asBoolean());
// last
tup = fetchJson("/cluster/backup/last", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertFalse(json.get("present").asBoolean());
assertTrue(json.get("backup").isNull());
}
use of com.fasterxml.jackson.databind.JsonNode in project cassandra-mesos-deprecated by mesosphere.
the class ClusterCleanupControllerTest method testCleanup.
@Test
public void testCleanup() throws Exception {
threeNodeCluster();
Tuple2<Integer, JsonNode> tup = fetchJson("/cluster/cleanup/start", true);
assertEquals(200, tup._1.intValue());
JsonNode json = tup._2;
assertTrue(json.has("started"));
assertTrue(json.get("started").asBoolean());
// fail for cleanup
tup = fetchJson("/cluster/repair/start", true);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.has("started"));
assertFalse(json.get("started").asBoolean());
// status
tup = fetchJson("/cluster/cleanup/status", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.get("running").asBoolean());
JsonNode status = json.get("cleanup");
assertTrue(status.has("type"));
assertTrue(status.has("started"));
assertTrue(status.get("started").isNumber());
assertTrue(status.has("finished"));
assertTrue(status.get("finished").isNull());
assertTrue(status.has("aborted"));
assertFalse(status.get("aborted").asBoolean());
assertTrue(status.has("remainingNodes"));
assertTrue(status.get("remainingNodes").isArray());
assertTrue(status.has("currentNode"));
assertTrue(status.has("completedNodes"));
assertTrue(status.get("completedNodes").isArray());
// abort
tup = fetchJson("/cluster/cleanup/abort", true);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertTrue(json.get("aborted").asBoolean());
tup = fetchJson("/cluster/cleanup/status", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
status = json.get("cleanup");
assertTrue(status.has("aborted"));
assertTrue(status.get("aborted").asBoolean());
// last
tup = fetchJson("/cluster/cleanup/last", false);
assertEquals(200, tup._1.intValue());
json = tup._2;
assertFalse(json.get("present").asBoolean());
assertTrue(json.get("cleanup").isNull());
}
use of com.fasterxml.jackson.databind.JsonNode in project JsonPath by jayway.
the class JacksonJsonNodeJsonProviderTest method longs_are_unwrapped.
@Test
public void longs_are_unwrapped() {
JsonNode node = using(JACKSON_JSON_NODE_CONFIGURATION).parse(JSON_DOCUMENT).read("$.long-max-property");
long unwrapped = using(JACKSON_JSON_NODE_CONFIGURATION).parse(JSON_DOCUMENT).read("$.long-max-property", long.class);
assertThat(unwrapped).isEqualTo(Long.MAX_VALUE);
assertThat(unwrapped).isEqualTo(node.asLong());
}
Aggregations