use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method canDeleteAnInst.
@Test
public void canDeleteAnInst() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID id = UUID.randomUUID();
createInst(id, "Institute of MetaPhysics", "MPI");
CompletableFuture<Response> deleteCompleted = new CompletableFuture<>();
send(locInstitutionStorageUrl("/" + id.toString()), HttpMethod.DELETE, null, SUPPORTED_CONTENT_TYPE_JSON_DEF, ResponseHandler.any(deleteCompleted));
Response deleteResponse = deleteCompleted.get(5, TimeUnit.SECONDS);
assertThat(deleteResponse.getStatusCode(), is(HttpURLConnection.HTTP_NO_CONTENT));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationUnitTest method createInst.
public static Response createInst(UUID id, String name, String code) throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
CompletableFuture<Response> createLocationUnit = new CompletableFuture<>();
JsonObject request = new JsonObject().put("id", id.toString()).put("name", name).put("code", code);
send(locInstitutionStorageUrl(""), HttpMethod.POST, request.toString(), SUPPORTED_CONTENT_TYPE_JSON_DEF, ResponseHandler.json(createLocationUnit));
return createLocationUnit.get(5, TimeUnit.SECONDS);
}
use of org.folio.rest.support.Response 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.Response in project mod-inventory-storage by folio-org.
the class LocationsTest method cannotCreateLocationWithoutUnits.
@Test
public void cannotCreateLocationWithoutUnits() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
Response response = createLocation(null, "Main Library", null, null, null, "PI/CC/ML/X");
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
}
use of org.folio.rest.support.Response in project mod-inventory-storage by folio-org.
the class LocationsTest method cannotCreateLocationWithSameId.
@Test
public void cannotCreateLocationWithSameId() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
UUID id = UUID.randomUUID();
createLocation(id, "Main Library", instID, campID, libID, "PI/CC/ML/X");
Response response = createLocation(id, "Some Other Library", instID, campID, libID, "AA/BB");
assertThat(response.getStatusCode(), is(AdditionalHttpStatusCodes.UNPROCESSABLE_ENTITY));
}
Aggregations