Search in sources :

Example 6 with MultipleJsonRecords

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

the class LoanAPITests method canGetLoanPolicyPropertiesForMultipleLoans.

@Test
void canGetLoanPolicyPropertiesForMultipleLoans() {
    configClient.create(ConfigurationExample.utcTimezoneConfiguration());
    IndividualResource item1 = itemsFixture.basedUponSmallAngryPlanet();
    final ItemResource item2 = itemsFixture.basedUponNod();
    final IndividualResource user1 = usersFixture.jessica();
    final IndividualResource user2 = usersFixture.steve();
    checkOutFixture.checkOutByBarcode(item1, user1, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    checkOutFixture.checkOutByBarcode(item2, user2, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    final IndividualResource loanPolicy = loanPoliciesFixture.canCirculateRolling();
    MultipleJsonRecords loans = loansFixture.getAllLoans();
    loans.forEach(loanJson -> {
        loanHasLoanPolicyProperties(loanJson, loanPolicy);
        loanHasOverdueFinePolicyProperties(loanJson, overdueFinePoliciesFixture.facultyStandard());
        loanHasLostItemPolicyProperties(loanJson, lostItemFeePoliciesFixture.facultyStandard());
    });
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) IndividualResource(api.support.http.IndividualResource) ItemResource(api.support.http.ItemResource) Test(org.junit.jupiter.api.Test)

Example 7 with MultipleJsonRecords

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

the class LoanAPITests method canGetMultipleFeesFinesForMultipleLoans.

@Test
void canGetMultipleFeesFinesForMultipleLoans() {
    configClient.create(ConfigurationExample.utcTimezoneConfiguration());
    IndividualResource item1 = itemsFixture.basedUponSmallAngryPlanet();
    final ItemResource item2 = itemsFixture.basedUponNod();
    final IndividualResource user1 = usersFixture.jessica();
    final IndividualResource user2 = usersFixture.steve();
    IndividualResource loan1 = checkOutFixture.checkOutByBarcode(item1, user1, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    IndividualResource loan2 = checkOutFixture.checkOutByBarcode(item2, user2, ZonedDateTime.of(2018, 4, 21, 11, 21, 43, 0, UTC));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan1).withRemainingFeeFine(100));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan1).withRemainingFeeFine(100));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan2).withRemainingFeeFine(99));
    accountsClient.create(new AccountBuilder().feeFineStatusOpen().withLoan(loan2).withRemainingFeeFine(1000));
    MultipleJsonRecords loans = loansFixture.getAllLoans();
    JsonObject fetchedLoan1 = loans.getById(loan1.getId());
    JsonObject fetchedLoan2 = loans.getById(loan2.getId());
    assertLoanHasFeeFinesProperties(fetchedLoan1, 200);
    assertLoanHasFeeFinesProperties(fetchedLoan2, 1099);
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) JsonObject(io.vertx.core.json.JsonObject) AccountBuilder(api.support.builders.AccountBuilder) IndividualResource(api.support.http.IndividualResource) ItemResource(api.support.http.ItemResource) Test(org.junit.jupiter.api.Test)

Example 8 with MultipleJsonRecords

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

the class CheckInByBarcodeTests method verifyCheckInOperationRecorded.

private void verifyCheckInOperationRecorded(UUID itemId, UUID servicePoint) {
    final CqlQuery query = CqlQuery.queryFromTemplate("itemId=%s", itemId);
    final MultipleJsonRecords recordedOperations = checkInOperationClient.getMany(query);
    assertThat(recordedOperations.totalRecords(), is(1));
    recordedOperations.forEach(checkInOperation -> {
        assertThat(checkInOperation.getString("occurredDateTime"), withinSecondsBeforeNow(2));
        assertThat(checkInOperation.getString("itemId"), is(itemId.toString()));
        assertThat(checkInOperation.getString("servicePointId"), is(servicePoint.toString()));
        assertThat(checkInOperation.getString("performedByUserId"), is(getUserId()));
    });
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) CqlQuery(api.support.http.CqlQuery)

Example 9 with MultipleJsonRecords

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

the class RequestsAPIRetrievalTests method canSearchForRequestsByRequesterLastName.

@Test
void canSearchForRequestsByRequesterLastName() {
    UUID firstRequester = usersFixture.steve().getId();
    UUID secondRequester = usersFixture.jessica().getId();
    final UUID pickupServicePointId = servicePointsFixture.cd1().getId();
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponSmallAngryPlanet(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(firstRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponNod(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(firstRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponInterestingTimes(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(secondRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponTemeraire(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(firstRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponNod(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(firstRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponUprooted(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(secondRequester));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponTemeraire(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).withRequesterId(secondRequester));
    final MultipleJsonRecords requests = requestsFixture.getRequests(queryFromTemplate("requester.lastName=%s", "Pontefract"), noLimit(), noOffset());
    assertThat(requests.size(), is(3));
    assertThat(requests.totalRecords(), is(3));
    requests.forEach(this::requestHasExpectedProperties);
}
Also used : ItemBuilder(api.support.builders.ItemBuilder) MultipleJsonRecords(api.support.MultipleJsonRecords) RequestBuilder(api.support.builders.RequestBuilder) UUID(java.util.UUID) Test(org.junit.jupiter.api.Test)

Example 10 with MultipleJsonRecords

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

the class RequestsAPIRetrievalTests method canSearchForRequestsByProxyLastName.

@Test
void canSearchForRequestsByProxyLastName() {
    final IndividualResource sponsor = usersFixture.jessica();
    final IndividualResource firstProxy = usersFixture.charlotte();
    final IndividualResource secondProxy = usersFixture.james();
    final UUID pickupServicePointId = servicePointsFixture.cd1().getId();
    proxyRelationshipsFixture.currentProxyFor(sponsor, firstProxy);
    proxyRelationshipsFixture.currentProxyFor(sponsor, secondProxy);
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponSmallAngryPlanet(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).by(sponsor).proxiedBy(firstProxy));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponNod(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).by(sponsor).proxiedBy(secondProxy));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponNod(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).by(sponsor).proxiedBy(secondProxy));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponUprooted(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).by(sponsor).proxiedBy(firstProxy));
    requestsFixture.place(new RequestBuilder().forItem(itemsFixture.basedUponTemeraire(ItemBuilder::checkOut)).withPickupServicePointId(pickupServicePointId).by(sponsor).proxiedBy(secondProxy));
    final MultipleJsonRecords requests = requestsFixture.getRequests(queryFromTemplate("proxy.lastName=%s", "Rodwell"), noLimit(), noOffset());
    assertThat(requests.size(), is(3));
    assertThat(requests.totalRecords(), is(3));
    requests.forEach(this::requestHasExpectedProperties);
}
Also used : MultipleJsonRecords(api.support.MultipleJsonRecords) RequestBuilder(api.support.builders.RequestBuilder) IndividualResource(api.support.http.IndividualResource) UUID(java.util.UUID) Test(org.junit.jupiter.api.Test)

Aggregations

MultipleJsonRecords (api.support.MultipleJsonRecords)25 Test (org.junit.jupiter.api.Test)21 IndividualResource (api.support.http.IndividualResource)12 UUID (java.util.UUID)12 RequestBuilder (api.support.builders.RequestBuilder)9 JsonObject (io.vertx.core.json.JsonObject)8 LoanBuilder (api.support.builders.LoanBuilder)6 ItemResource (api.support.http.ItemResource)5 ItemBuilder (api.support.builders.ItemBuilder)4 lombok.val (lombok.val)4 ZonedDateTime (java.time.ZonedDateTime)3 AccountBuilder (api.support.builders.AccountBuilder)2 CqlQuery (api.support.http.CqlQuery)2 RequestsAPICreationTests.setupMissingItem (api.requests.RequestsAPICreationTests.setupMissingItem)1 APITests (api.support.APITests)1 CheckInByBarcodeResponse (api.support.CheckInByBarcodeResponse)1 Address (api.support.builders.Address)1 LoanPolicyBuilder (api.support.builders.LoanPolicyBuilder)1 FakePubSub (api.support.fakes.FakePubSub)1 PublishedEvents.byEventType (api.support.fakes.PublishedEvents.byEventType)1