use of com.baidu.hugegraph.rest.RestResult in project hugegraph-common by hugegraph.
the class RestClientTest method testPostWithTokenAndAllParams.
@Test
public void testPostWithTokenAndAllParams() {
RestClient client = new RestClientImpl("/test", "token", 1000, 10, 5, 200);
RestResult restResult = client.post("path", "body");
Assert.assertEquals(200, restResult.status());
}
use of com.baidu.hugegraph.rest.RestResult 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.RestResult 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.RestResult 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.RestResult 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());
}
Aggregations