use of api.support.builders.HoldingBuilder in project mod-circulation by folio-org.
the class RequestScheduledNoticesTests method beforeEach.
@BeforeEach
public void beforeEach() {
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", Collections.singletonList("CopyNumbers"));
item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
requester = usersFixture.steve();
pickupServicePoint = servicePointsFixture.cd1();
}
use of api.support.builders.HoldingBuilder in project mod-circulation by folio-org.
the class RequestsAPICreationTests method holdRequestNoticeIsSentWhenPolicyDefinesHoldRequestNoticeConfiguration.
@Test
void holdRequestNoticeIsSentWhenPolicyDefinesHoldRequestNoticeConfiguration() {
UUID holdConfirmationTemplateId = UUID.randomUUID();
JsonObject holdConfirmationConfiguration = new NoticeConfigurationBuilder().withTemplateId(holdConfirmationTemplateId).withEventType(HOLD_REQUEST_EVENT).create();
JsonObject recallConfirmationConfiguration = new NoticeConfigurationBuilder().withTemplateId(UUID.randomUUID()).withEventType(RECALL_REQUEST_EVENT).create();
NoticePolicyBuilder noticePolicy = new NoticePolicyBuilder().withName("Policy with hold notice").withLoanNotices(Arrays.asList(holdConfirmationConfiguration, recallConfirmationConfiguration));
useFallbackPolicies(loanPoliciesFixture.canCirculateRolling().getId(), requestPoliciesFixture.allowAllRequestPolicy().getId(), noticePoliciesFixture.create(noticePolicy).getId(), overdueFinePoliciesFixture.facultyStandard().getId(), lostItemFeePoliciesFixture.facultyStandard().getId());
UUID id = UUID.randomUUID();
UUID pickupServicePointId = servicePointsFixture.cd1().getId();
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", Collections.singletonList("CopyNumbers"));
ItemResource item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
IndividualResource requester = usersFixture.steve();
ZonedDateTime requestDate = ZonedDateTime.of(2017, 7, 22, 10, 22, 54, 0, UTC);
checkOutFixture.checkOutByBarcode(item, usersFixture.jessica());
IndividualResource request = requestsFixture.place(new RequestBuilder().withId(id).open().hold().forItem(item).by(requester).withRequestDate(requestDate).fulfilToHoldShelf().withRequestExpiration(LocalDate.of(2017, 7, 30)).withHoldShelfExpiration(LocalDate.of(2017, 8, 31)).withPickupServicePointId(pickupServicePointId).withTags(new RequestBuilder.Tags(asList("new", "important"))));
verifyNumberOfSentNotices(1);
verifyNumberOfPublishedEvents(NOTICE, 1);
verifyNumberOfPublishedEvents(NOTICE_ERROR, 0);
Map<String, Matcher<String>> noticeContextMatchers = new HashMap<>();
noticeContextMatchers.putAll(TemplateContextMatchers.getUserContextMatchers(requester));
noticeContextMatchers.putAll(TemplateContextMatchers.getItemContextMatchers(item, true));
noticeContextMatchers.putAll(TemplateContextMatchers.getRequestContextMatchers(request));
assertThat(FakeModNotify.getSentPatronNotices(), hasItems(hasEmailNoticeProperties(requester.getId(), holdConfirmationTemplateId, noticeContextMatchers)));
}
use of api.support.builders.HoldingBuilder in project mod-circulation by folio-org.
the class DueDateScheduledNoticesProcessingTests method beforeEach.
@BeforeEach
public void beforeEach() {
ItemBuilder itemBuilder = basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", Collections.singletonList("CopyNumbers"));
item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
borrower = usersFixture.steve();
templateFixture.createDummyNoticeTemplate(BEFORE_TEMPLATE_ID);
templateFixture.createDummyNoticeTemplate(BEFORE_RECURRING_TEMPLATE_ID);
templateFixture.createDummyNoticeTemplate(UPON_AT_TEMPLATE_ID);
templateFixture.createDummyNoticeTemplate(AFTER_TEMPLATE_ID);
templateFixture.createDummyNoticeTemplate(AFTER_RECURRING_TEMPLATE_ID);
}
use of api.support.builders.HoldingBuilder in project mod-circulation by folio-org.
the class RequestsAPICreationTests method holdRequestNoticeIsNotSentWhenPatronNoticeRequestFails.
@Test
void holdRequestNoticeIsNotSentWhenPatronNoticeRequestFails() {
UUID holdConfirmationTemplateId = UUID.randomUUID();
JsonObject holdConfirmationConfiguration = new NoticeConfigurationBuilder().withTemplateId(holdConfirmationTemplateId).withEventType(HOLD_REQUEST_EVENT).create();
JsonObject recallConfirmationConfiguration = new NoticeConfigurationBuilder().withTemplateId(UUID.randomUUID()).withEventType(RECALL_REQUEST_EVENT).create();
NoticePolicyBuilder noticePolicy = new NoticePolicyBuilder().withName("Policy with hold notice").withLoanNotices(Arrays.asList(holdConfirmationConfiguration, recallConfirmationConfiguration));
useFallbackPolicies(loanPoliciesFixture.canCirculateRolling().getId(), requestPoliciesFixture.allowAllRequestPolicy().getId(), noticePoliciesFixture.create(noticePolicy).getId(), overdueFinePoliciesFixture.facultyStandard().getId(), lostItemFeePoliciesFixture.facultyStandard().getId());
UUID id = UUID.randomUUID();
UUID pickupServicePointId = servicePointsFixture.cd1().getId();
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", Collections.singletonList("CopyNumbers"));
ItemResource item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
IndividualResource requester = usersFixture.steve();
ZonedDateTime requestDate = ZonedDateTime.of(2017, 7, 22, 10, 22, 54, 0, UTC);
checkOutFixture.checkOutByBarcode(item, usersFixture.jessica());
FakeModNotify.setFailPatronNoticesWithBadRequest(true);
requestsFixture.place(new RequestBuilder().withId(id).open().hold().forItem(item).by(requester).withRequestDate(requestDate).fulfilToHoldShelf().withRequestExpiration(LocalDate.of(2017, 7, 30)).withHoldShelfExpiration(LocalDate.of(2017, 8, 31)).withPickupServicePointId(pickupServicePointId).withTags(new RequestBuilder.Tags(asList("new", "important"))));
verifyNumberOfSentNotices(0);
verifyNumberOfPublishedEvents(NOTICE, 0);
verifyNumberOfPublishedEvents(NOTICE_ERROR, 1);
}
use of api.support.builders.HoldingBuilder in project mod-circulation by folio-org.
the class RequestScheduledNoticesProcessingTests method beforeEach.
@BeforeEach
public void beforeEach() {
ItemBuilder itemBuilder = ItemExamples.basedUponSmallAngryPlanet(materialTypesFixture.book().getId(), loanTypesFixture.canCirculate().getId());
HoldingBuilder holdingBuilder = itemsFixture.applyCallNumberHoldings("CN", "Prefix", "Suffix", singletonList("CopyNumbers"));
item = itemsFixture.basedUponSmallAngryPlanet(itemBuilder, holdingBuilder);
requester = usersFixture.steve();
pickupServicePoint = servicePointsFixture.cd1();
templateFixture.createDummyNoticeTemplate(TEMPLATE_ID);
}
Aggregations