use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostHttpsWithAllParams.
@Test
public void testPostHttpsWithAllParams() {
String trustStoreFile = "src/test/resources/cacerts.jks";
String trustStorePassword = "changeit";
RestClient client = new RestClientImpl("/test", "user", "", 1000, 10, 5, trustStoreFile, trustStorePassword, 200);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testGet.
@Test
public void testGet() {
RestClient client = new RestClientImpl("/test", 1000, 200);
RestResult restResult = client.get("path");
Assert.assertEquals(200, restResult.status());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithAllParams.
@Test
public void testPostWithAllParams() {
RestClient client = new RestClientImpl("/test", "user", "", 1000, 10, 5, 200);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPut.
@Test
public void testPut() {
RestClient client = new RestClientImpl("/test", 1000, 200);
RestResult restResult = client.put("path", "id1", "body");
Assert.assertEquals(200, restResult.status());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithHeaderAndContent.
@Test
public void testPostWithHeaderAndContent() {
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
headers.add("key1", "value1-1");
headers.add("key1", "value1-2");
headers.add("Content-Encoding", "gzip");
String content = "{\"names\": [\"marko\", \"josh\", \"lop\"]}";
RestClient client = new RestClientImpl("/test", 1000, 200, headers, content);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
Assert.assertEquals(headers, restResult.headers());
Assert.assertEquals(content, restResult.content());
Assert.assertEquals(ImmutableList.of("marko", "josh", "lop"), restResult.readList("names", String.class));
}
Aggregations