Search in sources :

Example 1 with ResourceClient

use of api.support.http.ResourceClient in project mod-inventory by folio-org.

the class ApiTestSuite method createLocations.

private static void createLocations() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    final OkapiHttpClient client = createOkapiHttpClient();
    ResourceClient institutionsClient = ResourceClient.forInstitutions(client);
    nottinghamUniversityInstitution = createReferenceRecord(institutionsClient, "Nottingham University", "NOTT");
    ResourceClient campusesClient = ResourceClient.forCampuses(client);
    jubileeCampus = createReferenceRecord(campusesClient, new JsonObject().put("name", "Jubilee Campus").put("institutionId", nottinghamUniversityInstitution.toString()).put("code", "JUBILEE"));
    ResourceClient librariesClient = ResourceClient.forLibraries(client);
    djanoglyLibrary = createReferenceRecord(librariesClient, new JsonObject().put("name", "Djanogly Learning Resource Centre").put("campusId", jubileeCampus.toString()).put("code", "DJANOGLY"));
    businessLibrary = createReferenceRecord(librariesClient, new JsonObject().put("name", "Business Library").put("campusId", jubileeCampus.toString()).put("code", "BUSINESS"));
    ResourceClient locationsClient = ResourceClient.forLocations(client);
    final UUID fakeServicePointId = UUID.randomUUID();
    thirdFloorLocationId = createReferenceRecord(locationsClient, new JsonObject().put("name", "3rd Floor").put("code", "NU/JC/DL/3F").put("institutionId", nottinghamUniversityInstitution.toString()).put("campusId", jubileeCampus.toString()).put("libraryId", djanoglyLibrary.toString()).put("primaryServicePoint", fakeServicePointId.toString()).put("servicePointIds", new JsonArray().add(fakeServicePointId.toString())));
    mezzanineDisplayCaseLocationId = createReferenceRecord(locationsClient, new JsonObject().put("name", "Display Case, Mezzanine").put("code", "NU/JC/BL/DM").put("institutionId", nottinghamUniversityInstitution.toString()).put("campusId", jubileeCampus.toString()).put("libraryId", businessLibrary.toString()).put("primaryServicePoint", fakeServicePointId.toString()).put("servicePointIds", new JsonArray().add(fakeServicePointId.toString())));
    readingRoomLocationId = createReferenceRecord(locationsClient, new JsonObject().put("name", "Reading Room").put("code", "NU/JC/BL/PR").put("institutionId", nottinghamUniversityInstitution.toString()).put("campusId", jubileeCampus.toString()).put("libraryId", businessLibrary.toString()).put("primaryServicePoint", fakeServicePointId.toString()).put("servicePointIds", new JsonArray().add(fakeServicePointId.toString())));
    // Need to create a main library location otherwise MODS ingestion will fail
    // TODO: Need to remove this when MODS uses different example location
    mainLibraryLocationId = createReferenceRecord(locationsClient, new JsonObject().put("name", "Main Library").put("code", "NU/JC/DL/ML").put("institutionId", nottinghamUniversityInstitution.toString()).put("campusId", jubileeCampus.toString()).put("libraryId", djanoglyLibrary.toString()).put("primaryServicePoint", fakeServicePointId.toString()).put("servicePointIds", new JsonArray().add(fakeServicePointId.toString())));
}
Also used : JsonArray(io.vertx.core.json.JsonArray) ResourceClient(api.support.http.ResourceClient) OkapiHttpClient(org.folio.inventory.support.http.client.OkapiHttpClient) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID)

Example 2 with ResourceClient

use of api.support.http.ResourceClient in project mod-circulation by folio-org.

the class SingleOpenHoldShelfRequestTests method removeServicePoint.

private void removeServicePoint(UUID requestId) {
    final ResourceClient requestsStorage = forRequestsStorage();
    final Response fetchedRequest = requestsStorage.getById(requestId);
    final JsonObject holdRequestWithoutPickupServicePoint = fetchedRequest.getJson();
    holdRequestWithoutPickupServicePoint.remove("pickupServicePointId");
    requestsStorage.replace(requestId, holdRequestWithoutPickupServicePoint);
}
Also used : Response(org.folio.circulation.support.http.client.Response) ResourceClient(api.support.http.ResourceClient) JsonObject(io.vertx.core.json.JsonObject)

Example 3 with ResourceClient

use of api.support.http.ResourceClient in project mod-circulation by folio-org.

the class RenewalAPITests method cannotRenewWhenUserIsInactive.

@Test
void cannotRenewWhenUserIsInactive() {
    IndividualResource smallAngryPlanet = itemsFixture.basedUponSmallAngryPlanet();
    IndividualResource jessica = usersFixture.jessica();
    checkOutFixture.checkOutByBarcode(smallAngryPlanet, jessica, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    final UUID userId = jessica.getId();
    JsonObject userRecord = jessica.copyJson();
    userRecord.put("active", false);
    final ResourceClient usersClient = ResourceClient.forUsers();
    usersClient.replace(userId, userRecord);
    jessica = usersClient.get(userId);
    Response response = attemptRenewal(smallAngryPlanet, jessica);
    assertThat(response.getJson(), hasErrorWith(hasMessage("Cannot renew loan when user is inactive or expired")));
}
Also used : Response(org.folio.circulation.support.http.client.Response) ResourceClient(api.support.http.ResourceClient) JsonObject(io.vertx.core.json.JsonObject) IndividualResource(api.support.http.IndividualResource) UUID(java.util.UUID) Test(org.junit.jupiter.api.Test)

Example 4 with ResourceClient

use of api.support.http.ResourceClient in project mod-inventory by folio-org.

the class ApiTestSuite method createNatureOfContentTerms.

private static void createNatureOfContentTerms() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    ResourceClient client = ResourceClient.forNatureOfContentTerms(createOkapiHttpClient());
    audiobookNatureOfContentTermId = createReferenceRecord(client, new JsonObject().put("name", "audiobook").put("source", "folio"));
    bibliographyNatureOfContentTermId = createReferenceRecord(client, new JsonObject().put("name", "bibliography").put("source", "folio"));
}
Also used : ResourceClient(api.support.http.ResourceClient) JsonObject(io.vertx.core.json.JsonObject)

Aggregations

ResourceClient (api.support.http.ResourceClient)4 JsonObject (io.vertx.core.json.JsonObject)4 UUID (java.util.UUID)2 Response (org.folio.circulation.support.http.client.Response)2 IndividualResource (api.support.http.IndividualResource)1 JsonArray (io.vertx.core.json.JsonArray)1 OkapiHttpClient (org.folio.inventory.support.http.client.OkapiHttpClient)1 Test (org.junit.jupiter.api.Test)1