use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.
the class CommunicationChannelSubscription_Integtest method replacement_provided.
@Test
public void replacement_provided() throws Exception {
// Given
final DemoObjectWithNotes owner = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
final PostalAddress postalAddress = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Some address", null, null, null, null, null, null);
final PostalAddress replaceWith = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Replacement Address", null, null, null, null, null, null);
final Communication communication = communicationRepository.createPostal("Subject", "/", postalAddress);
final int size = communicationChannelRepository.findByOwner(owner).size();
// When
wrapperFactory.wrap(postalAddress).remove(replaceWith);
// Then
Assertions.assertThat(communicationChannelRepository.findByOwner(owner).size()).isEqualTo(size - 1);
}
use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.
the class CommunicationChannelSubscription_Integtest method validate_fails_when_no_replacement_is_provided.
@Test
public void validate_fails_when_no_replacement_is_provided() throws Exception {
// Given
final DemoObjectWithNotes owner = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
final PostalAddress postalAddress = communicationChannelRepository.newPostal(owner, CommunicationChannelType.POSTAL_ADDRESS, "Some address", null, null, null, null, null, null);
final Communication communication = communicationRepository.createPostal("Subject", "/", postalAddress);
// Expect
expectedExceptions.expectMessage("Communication channel is being used");
// When
wrap(postalAddress).remove(null);
}
use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.
the class DocumentCommunicationSupportForDocumentsAttachedToDemoInvoice method addTo.
private <T extends CommunicationChannel> void addTo(final DemoInvoice invoice, final CommHeaderAbstract<T> header, final CommunicationChannelType channelType) {
final DemoObjectWithNotes customer = invoice.getCustomer();
final List<CommunicationChannelOwnerLink> links = communicationChannelOwnerLinkRepository.findByOwner(customer);
final List channels = links.stream().map(CommunicationChannelOwnerLink::getCommunicationChannel).filter(cc -> cc.getType() == channelType).collect(Collectors.toList());
header.getToChoices().addAll(channels);
}
use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.
the class DemoObjectWithNote_and_DemoInvoice_create3 method execute.
@Override
protected void execute(final ExecutionContext executionContext) {
final Country gbrCountry = countryRepository.findCountry(CountriesRefData.GBR);
final DemoObjectWithNotes custA = wrap(demoCustomerMenu).createDemoObjectWithNotes(FRED_HAS_EMAIL_AND_PHONE);
addEmailAddress(custA, "fred@gmail.com");
addEmailAddress(custA, "freddy@msn.com");
addPhoneOrFaxNumber(custA, CommunicationChannelType.PHONE_NUMBER, "555 1234");
addPhoneOrFaxNumber(custA, CommunicationChannelType.FAX_NUMBER, "555 4321");
final DemoInvoice custA_1 = demoInvoiceRepository.create("1", custA);
attachReceipt(custA_1, "Sample4.PDF");
final DemoInvoice custA_2 = demoInvoiceRepository.create("2", custA);
attachReceipt(custA_2, "Sample5.PDF");
final DemoObjectWithNotes custB = wrap(demoCustomerMenu).createDemoObjectWithNotes(MARY_HAS_PHONE_AND_POST);
addPhoneOrFaxNumber(custB, CommunicationChannelType.PHONE_NUMBER, "777 0987");
addPhoneOrFaxNumber(custB, CommunicationChannelType.FAX_NUMBER, "777 7890");
addPostalAddress(custB, gbrCountry, null, "45", "High Street", null, "OX1 4BJ", "Oxford");
addPostalAddress(custB, gbrCountry, null, "23", "Railway Road", null, "WN7 4AA", "Leigh");
final DemoInvoice custB_1 = demoInvoiceRepository.create("1", custB);
attachReceipt(custB_1, "xlsdemo1.pdf");
final DemoInvoice custB_2 = demoInvoiceRepository.create("2", custB);
attachReceipt(custB_2, "xlsdemo2.pdf");
final DemoObjectWithNotes custC = wrap(demoCustomerMenu).createDemoObjectWithNotes(JOE_HAS_EMAIL_AND_POST);
addEmailAddress(custC, "joe@yahoo.com");
addEmailAddress(custC, "joey@friends.com");
addPostalAddress(custC, gbrCountry, null, "5", "Witney Gardens", null, "WA4 5HT", "Warrington");
addPostalAddress(custC, gbrCountry, null, "3", "St. Nicholas Street Road", null, "YO11 2HF", "Scarborough");
final DemoInvoice custC_1 = demoInvoiceRepository.create("1", custC);
attachReceipt(custC_1, "pptdemo1.pdf");
final DemoInvoice custC_2 = demoInvoiceRepository.create("2", custC);
attachReceipt(custC_2, "pptdemo2.pdf");
}
use of org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes in project estatio by estatio.
the class CommunicationChannelSubscription_Integtest method setUp.
@Before
public void setUp() throws Exception {
// given
fixtureScripts.runFixtureScript(new DemoObjectWithNotes_and_DemoInvoice_and_docs_and_comms_recreate(), null);
transactionService.nextTransaction();
// and so given customer with an email
final DemoObjectWithNotes fred = customerMenu.findDemoObjectsWithNotesByName(DemoObjectWithNote_and_DemoInvoice_create3.FRED_HAS_EMAIL_AND_PHONE).get(0);
final EmailAddress fredEmail = (EmailAddress) linkRepository.findByOwnerAndCommunicationChannelType(fred, CommunicationChannelType.EMAIL_ADDRESS).get(0).getCommunicationChannel();
}
Aggregations