Search in sources :

Example 1 with MandatorMetadata

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();
}
Also used : MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) Test(org.junit.Test)

Example 2 with MandatorMetadata

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();
}
Also used : MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) Test(org.junit.Test)

Example 3 with MandatorMetadata

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;
}
Also used : MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)

Example 4 with MandatorMetadata

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();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) DefaultCustomerSalesdata(eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene)

Example 5 with MandatorMetadata

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();
}
Also used : Company(eu.ggnet.dwoss.customer.ee.entity.Company) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) Contact(eu.ggnet.dwoss.customer.ee.entity.Contact) Communication(eu.ggnet.dwoss.customer.ee.entity.Communication) Test(org.junit.Test)

Aggregations

MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)10 Test (org.junit.Test)6 CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)3 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)2 DefaultCustomerSalesdata (eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata)2 Communication (eu.ggnet.dwoss.customer.ee.entity.Communication)1 Company (eu.ggnet.dwoss.customer.ee.entity.Company)1 Contact (eu.ggnet.dwoss.customer.ee.entity.Contact)1 OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)1 InvalidationListener (javafx.beans.InvalidationListener)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 WebView (javafx.scene.web.WebView)1