use of eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata in project dwoss by gg-net.
the class MandatorMetadataTest method testGetViolationMessagesNonValidShippingCondition.
@Test
public void testGetViolationMessagesNonValidShippingCondition() {
MandatorMetadata makeInValidMandatorMetadata = makeValidMandatorMetadata();
makeInValidMandatorMetadata.setShippingCondition(null);
assertThat(makeInValidMandatorMetadata.getViolationMessage()).as("MandatorMetadata without ShippingCondition").isNotBlank();
}
use of eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata in project dwoss by gg-net.
the class MandatorMetadataTest method testGetViolationMessagesNonValidPaymentMethod.
@Test
public void testGetViolationMessagesNonValidPaymentMethod() {
MandatorMetadata makeInValidMandatorMetadata = makeValidMandatorMetadata();
makeInValidMandatorMetadata.setPaymentMethod(null);
assertThat(makeInValidMandatorMetadata.getViolationMessage()).as("MandatorMetadata without Payment Method").isNotBlank();
}
use of eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata in project dwoss by gg-net.
the class MandatorMetadataTest method makeValidMandatorMetadata.
public static MandatorMetadata makeValidMandatorMetadata() {
MandatorMetadata validMandatorMetadata = new MandatorMetadata();
validMandatorMetadata.setShippingCondition(ShippingCondition.DEALER_ONE);
validMandatorMetadata.setPaymentCondition(PaymentCondition.CUSTOMER);
validMandatorMetadata.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
validMandatorMetadata.add(SalesChannel.UNKNOWN);
assertThat(validMandatorMetadata.getViolationMessage()).as("valid Communication").isNull();
return validMandatorMetadata;
}
use of eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata in project dwoss by gg-net.
the class CustomerHtmlTryout method start.
@Override
public void start(Stage primaryStage) throws Exception {
CustomerGenerator gen = new CustomerGenerator();
Customer c1 = gen.makeOldCustomer();
Customer c2 = gen.makeCustomer();
DefaultCustomerSalesdata defaults = DefaultCustomerSalesdata.builder().allowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER)).paymentCondition(PaymentCondition.CUSTOMER).shippingCondition(ShippingCondition.DEALER_ONE).paymentMethod(PaymentMethod.DIRECT_DEBIT).build();
String MATCHCODE = c1.getMandatorMetadata().stream().map(MandatorMetadata::getMandatorMatchcode).findFirst().orElse("NONE");
OldCustomer c0 = ConverterUtil.convert(c1, MATCHCODE, defaults);
WebView view = new WebView();
view.getEngine().loadContent(Css.toHtml5WithStyle("<h1>OldCustomer.toHtml()</h1>" + c0.toHtmlHighDetailed() + "<hr /><h1>makeOldCustmer : Customer.toHtml(MATCHCODE,defaults)</h1>" + c1.toHtml(MATCHCODE, defaults) + "<hr /><h1>makeOldCustmer : Customer.toHtml()</h1>" + c1.toHtml() + "<hr /><h1>makeCustmer : Customer.toHtml()</h1>" + c2.toHtml()));
primaryStage.setScene(new Scene(new BorderPane(view)));
primaryStage.sizeToScene();
primaryStage.show();
}
use of eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata in project dwoss by gg-net.
the class PersistenceIT method testPersistence.
@Test
public void testPersistence() throws Exception {
utx.begin();
em.joinTransaction();
Customer c = GEN.makeCustomer();
em.persist(c);
utx.commit();
utx.begin();
em.joinTransaction();
CriteriaQuery<Customer> customerQ = em.getCriteriaBuilder().createQuery(Customer.class);
c = em.createQuery(customerQ.select(customerQ.from(Customer.class))).getSingleResult();
assertThat(c.getContacts()).describedAs("customer.getContacts()").isNotEmpty();
L.info("{}", c);
L.info("===== Contacts");
for (Contact contact : c.getContacts()) {
L.info(contact.toString());
L.info("===== - Communications");
for (Communication communication : contact.getCommunications()) {
L.info(communication.toString());
}
}
L.info("===== Companies");
for (Company company : c.getCompanies()) {
L.info(company.toString());
L.info("===== - Communications:");
for (Communication communication : company.getCommunications()) {
L.info(communication.toString());
}
}
L.info("===== MandatorMetaData");
for (MandatorMetadata man : c.getMandatorMetadata()) {
L.info(man.toString());
}
utx.commit();
}
Aggregations