use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithUserAndPassword.
@Test
public void testPostWithUserAndPassword() {
RestClient client = new RestClientImpl("/test", "user", "", 1000, 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 testPost.
@Test
public void testPost() {
RestClient client = new RestClientImpl("/test", 1000, 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 testClose.
@Test
public void testClose() {
RestClient client = new RestClientImpl("/test", 1000, 10, 5, 200);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
client.close();
Assert.assertThrows(IllegalStateException.class, () -> {
client.post("path", "body");
});
PoolingHttpClientConnectionManager pool;
pool = Whitebox.getInternalState(client, "pool");
Assert.assertNotNull(pool);
AtomicBoolean isShutDown = Whitebox.getInternalState(pool, "isShutDown");
Assert.assertTrue(isShutDown.get());
ScheduledExecutorService cleanExecutor;
cleanExecutor = Whitebox.getInternalState(client, "cleanExecutor");
Assert.assertNotNull(cleanExecutor);
Assert.assertTrue(cleanExecutor.isShutdown());
}
use of com.baidu.hugegraph.rest.RestClient in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithToken.
@Test
public void testPostWithToken() {
RestClient client = new RestClientImpl("/test", "token", 1000, 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 testPostHttpsWithTokenAndAllParams.
@Test
public void testPostHttpsWithTokenAndAllParams() {
String trustStoreFile = "src/test/resources/cacerts.jks";
String trustStorePassword = "changeit";
RestClient client = new RestClientImpl("/test", "token", 1000, 10, 5, trustStoreFile, trustStorePassword, 200);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
}
Aggregations