use of org.folio.rest.support.IndividualResource in project mod-circulation-storage by folio-org.
the class CheckInStorageApiTest method canGetCheckInById.
@Test
public void canGetCheckInById() throws InterruptedException, ExecutionException, TimeoutException, MalformedURLException {
JsonObject checkInToCreate = createSampleCheckIn().create();
IndividualResource createResult = checkInClient.create(checkInToCreate);
IndividualResource checkInById = checkInClient.getById(createResult.getId());
assertThat(createResult.getJson(), is(checkInToCreate));
assertThat(checkInById.getJson(), is(checkInToCreate));
}
use of org.folio.rest.support.IndividualResource in project mod-circulation-storage by folio-org.
the class PatronActionSessionAPITest method canCreatePatronActionSession.
@Test
public void canCreatePatronActionSession() throws InterruptedException, MalformedURLException, TimeoutException, ExecutionException {
String actionType = "Check-out";
JsonObject request = createPatronActionSession(actionType);
IndividualResource individualResource = assertRecordClient.create(request);
assertThat(individualResource.getJson().getString("actionType"), is(actionType));
}
use of org.folio.rest.support.IndividualResource in project mod-circulation-storage by folio-org.
the class LoansAnonymizationApiTest method shouldAnonymizeSingleClosedLoanForUser.
@Test
public void shouldAnonymizeSingleClosedLoanForUser() throws MalformedURLException, ExecutionException, InterruptedException, TimeoutException {
final UUID userId = UUID.randomUUID();
final IndividualResource loan = loansClient.create(new LoanRequestBuilder().closed().withUserId(userId));
anonymizeLoansFor(userId);
final IndividualResource fetchedLoan = loansClient.getById(loan.getId());
assertThat("Should no longer have a user ID", fetchedLoan.getJson().containsKey("userId"), is(false));
assertThat("Anonymized loans should still be present", loansClient.getAll().getTotalRecords(), is(1));
}
use of org.folio.rest.support.IndividualResource in project mod-circulation-storage by folio-org.
the class LoansAnonymizationApiTest method shouldAnonymizeSingleClosedLoanHistoryForUser.
@Test
public void shouldAnonymizeSingleClosedLoanHistoryForUser() throws MalformedURLException, ExecutionException, InterruptedException, TimeoutException {
final UUID userId = UUID.randomUUID();
final IndividualResource loan = loansClient.create(new LoanRequestBuilder().open().withUserId(userId));
loansClient.replace(loan.getId(), LoanRequestBuilder.from(loan.getJson()).withReturnDate(DateTime.now()).closed());
anonymizeLoansFor(userId);
final MultipleRecords<JsonObject> historyRecords = getLoanActionHistoryForUser(userId);
assertThat("Should be no history records for user", historyRecords.getRecords().size(), is(0));
assertThat("Should be no history records for user", historyRecords.getTotalRecords(), is(0));
}
use of org.folio.rest.support.IndividualResource in project mod-circulation-storage by folio-org.
the class LoansAnonymizationApiTest method shouldNotAnonymizeLoansForOtherUser.
@Test
public void shouldNotAnonymizeLoansForOtherUser() throws MalformedURLException, ExecutionException, InterruptedException, TimeoutException {
final UUID firstUserId = UUID.randomUUID();
final UUID secondUserId = UUID.randomUUID();
final IndividualResource otherUsersLoan = loansClient.create(new LoanRequestBuilder().closed().withUserId(firstUserId));
anonymizeLoansFor(secondUserId);
final IndividualResource fetchedLoan = loansClient.getById(otherUsersLoan.getId());
assertThat(fetchedLoan.getJson().getString("userId"), isUUID(firstUserId));
assertThat("Anonymized loans should still be present", loansClient.getAll().getTotalRecords(), is(1));
}
Aggregations