use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testDeleteWithParams.
@Test
public void testDeleteWithParams() {
RestClient client = new RestClientImpl("/test", 1000, 204);
Map<String, Object> params = ImmutableMap.of("param1", "value1");
RestResult restResult = client.delete("path", params);
Assert.assertEquals(204, restResult.status());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testDeleteWithException.
@Test
public void testDeleteWithException() {
RestClient client = new RestClientImpl("/test", 1000, 400);
Assert.assertThrows(ClientException.class, () -> {
client.delete("path", "id1");
});
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithException.
@Test
public void testPostWithException() {
RestClient client = new RestClientImpl("/test", 1000, 400);
Assert.assertThrows(ClientException.class, () -> {
client.post("path", "body");
});
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testGetWithParams.
@Test
public void testGetWithParams() {
RestClient client = new RestClientImpl("/test", 1000, 200);
Map<String, Object> params = new HashMap<>();
params.put("key1", ImmutableList.of("value1-1", "value1-2"));
params.put("key2", "value2");
RestResult restResult = client.get("path", params);
Assert.assertEquals(200, restResult.status());
}
Aggregations