use of org.folio.rest.support.Response 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.Response 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));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class ShelfLocationsTest method canCreateShelfLocation.
@Test
public void canCreateShelfLocation() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
Response response = LocationsTest.createLocation(null, "Main Library", instID, campID, libID, "PI/CC/ML/X");
assertThat(response.getStatusCode(), is(HttpURLConnection.HTTP_CREATED));
assertThat(response.getJson().getString("id"), notNullValue());
assertThat(response.getJson().getString("name"), is("Main Library"));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class ShelfLocationsTest method canGetAShelfLocationById.
@Test
public void canGetAShelfLocationById() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID id = UUID.randomUUID();
LocationsTest.createLocation(id, "Main Library", instID, campID, libID, "PI/CC/ML/X");
Response getResponse = getById(id);
assertThat(getResponse.getStatusCode(), is(HttpURLConnection.HTTP_OK));
JsonObject item = getResponse.getJson();
assertThat(item.getString("id"), is(id.toString()));
assertThat(item.getString("name"), is("Main Library"));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class ShelfLocationsClient method create.
public String create(String name) throws InterruptedException, ExecutionException, TimeoutException {
CompletableFuture<Response> completed = new CompletableFuture<>();
JsonObject shelfLocationRequest = new JsonObject().put("name", name);
client.post(shelfLocationsUrl, shelfLocationRequest, StorageTestSuite.TENANT_ID, ResponseHandler.json(completed));
Response response = completed.get(5, TimeUnit.SECONDS);
return response.getJson().getString("id");
}
Aggregations