use of org.folio.rest.support.HttpClient in project mod-inventory-storage by folio-org.
the class StorageTestSuite method deleteAll.
static void deleteAll(URL rootUrl) {
HttpClient client = new HttpClient(getVertx());
CompletableFuture<Response> deleteAllFinished = new CompletableFuture<>();
try {
client.delete(rootUrl, TENANT_ID, ResponseHandler.any(deleteAllFinished));
Response response = deleteAllFinished.get(5, TimeUnit.SECONDS);
if (response.getStatusCode() != 204) {
Assert.fail("Delete all preparation failed: " + response.getBody());
}
} catch (Exception e) {
Assert.fail("WARNING!!!!! Unable to delete all: " + e.getMessage());
}
}
use of org.folio.rest.support.HttpClient in project mod-inventory-storage by folio-org.
the class TestBase method testBaseBeforeClass.
@BeforeClass
public static void testBaseBeforeClass() throws Exception {
Vertx vertx = StorageTestSuite.getVertx();
if (vertx == null) {
invokeStorageTestSuiteAfter = true;
StorageTestSuite.before();
vertx = StorageTestSuite.getVertx();
}
client = new HttpClient(vertx);
instancesClient = ResourceClient.forInstances(client);
holdingsClient = ResourceClient.forHoldings(client);
}
use of org.folio.rest.support.HttpClient in project mod-inventory-storage by folio-org.
the class StorageTestSuite method removeTenant.
private static void removeTenant(String tenantId) throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
CompletableFuture<Response> tenantDeleted = new CompletableFuture<>();
HttpClient client = new HttpClient(vertx);
client.delete(storageUrl("/_/tenant"), tenantId, ResponseHandler.any(tenantDeleted));
Response response = tenantDeleted.get(20, TimeUnit.SECONDS);
String failureMessage = String.format("Tenant cleanup failed: %s: %s", response.getStatusCode(), response.getBody());
assertThat(failureMessage, response.getStatusCode(), is(204));
}
use of org.folio.rest.support.HttpClient in project mod-inventory-storage by folio-org.
the class StorageTestSuite method prepareTenant.
private static void prepareTenant(String tenantId) throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
CompletableFuture<Response> tenantPrepared = new CompletableFuture<>();
HttpClient client = new HttpClient(vertx);
client.post(storageUrl("/_/tenant"), null, tenantId, ResponseHandler.any(tenantPrepared));
Response response = tenantPrepared.get(20, TimeUnit.SECONDS);
String failureMessage = String.format("Tenant preparation failed: %s: %s", response.getStatusCode(), response.getBody());
assertThat(failureMessage, response.getStatusCode(), is(201));
}
Aggregations