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())));
}
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);
}
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")));
}
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"));
}
Aggregations