use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonConvTest method testTransitionResultDigest.
@Test
public void testTransitionResultDigest() {
String json = JsonConv.digest(tresult).toJson();
logger.info(json);
JsonPath jp = from(json);
}
use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonConvTest method testManagedAclDigest.
@Test
public void testManagedAclDigest() {
String json = JsonConv.digest(macl).toJson();
JsonPath jp = from(json);
logger.info(json);
assertEquals(2, ((Map) jp.get()).size());
assertEquals(new Integer(1), jp.get("id"));
assertEquals("Public", jp.get("name"));
}
use of com.jayway.restassured.path.json.JsonPath in project opencast by opencast.
the class JsonsTest method testComposition3.
@Test
public void testComposition3() {
final Jsons.Obj j = obj(p("person", obj(p("name", "Karl"), p("city", "Paris"), p("age", 79))));
final JsonPath p = JsonPath.from(toJson(j));
assertEquals(new Integer(79), p.get("person.age"));
assertEquals("Karl", p.get("person.name"));
assertEquals("Paris", p.get("person.city"));
}
use of com.jayway.restassured.path.json.JsonPath in project joynr by bmwcarit.
the class ClusteredBounceProxyControllerTest method testBounceProxyRegistrationAtBpc1.
@Test
@Ignore("Ignore until servers are started in a separate JVM. Guice static problem")
public void testBounceProxyRegistrationAtBpc1() throws Exception {
RestAssured.baseURI = bpcUrl1;
Response responseRegister = given().log().all().queryParam("url4cc", "http://testurl/url4cc").and().queryParam("url4bpc", "http://testurl/url4bpc").when().put("bounceproxies/?bpid=0.0");
assertEquals(201, /* Created */
responseRegister.getStatusCode());
waitForReplication();
RestAssured.baseURI = bpcUrl2;
JsonPath listBps = given().log().all().get("bounceproxies").body().jsonPath();
assertThat(listBps, containsBounceProxy("0.0", "ALIVE"));
}
use of com.jayway.restassured.path.json.JsonPath in project joynr by bmwcarit.
the class ChannelServiceResponseMatchers method numberOfChannels.
public static Matcher<JsonPath> numberOfChannels(final int size) {
return new BaseMatcher<JsonPath>() {
@Override
public boolean matches(Object item) {
JsonPath jsonPath = (JsonPath) item;
List<String> channelIds = jsonPath.getList("name");
return channelIds.size() == size;
}
@Override
public void describeTo(Description description) {
description.appendText("contains " + size + " channels");
}
@Override
public void describeMismatch(Object item, Description description) {
JsonPath jsonPath = (JsonPath) item;
List<String> channelIds = jsonPath.getList("name");
description.appendText("contains " + channelIds.size() + " channels");
}
};
}
Aggregations