use of eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel in project dwoss by gg-net.
the class CustomerEnhanceTryout method main.
public static void main(String[] args) {
CustomerGenerator gen = new CustomerGenerator();
JButton close = new JButton("Schliessen");
close.addActionListener(e -> Ui.closeWindowOf(close));
JButton firmenKundenButton = new JButton("Lade FirmenKunde");
firmenKundenButton.addActionListener(ev -> {
Customer customer = gen.makeCustomer();
customer.getContacts().clear();
customer.getCompanies().add(gen.makeCompany());
customer.getCompanies().add(gen.makeCompany());
customer.getCompanies().add(gen.makeCompany());
customer.getCompanies().add(gen.makeCompany());
customer.setSource(Source.ONEADO);
customer.setKeyAccounter("Herr Meier");
customer.getFlags().add(CustomerFlag.ITC_CUSTOMER);
customer.getFlags().add(CustomerFlag.CS_UPDATE_CANDIDATE);
customer.getAdditionalCustomerIds().put(ExternalSystem.SAGE, "testsage");
if (customer.getViolationMessage() != null) {
Ui.exec(() -> {
Ui.build().alert("customer is invalid" + customer.getViolationMessage());
});
return;
}
customer.getAddressLabels().add(new AddressLabel(gen.makeCompany(), null, gen.makeAddress(), AddressType.SHIPPING));
Ui.exec(() -> {
Ui.build().fxml().eval(() -> customer, CustomerEnhanceController.class).opt().ifPresent(System.out::println);
});
});
JButton endKundenButton = new JButton("Lade Endkunde");
endKundenButton.addActionListener(ev -> {
Customer customer = gen.makeCustomer();
customer.getCompanies().clear();
customer.getContacts().add(gen.makeContact());
customer.getContacts().add(gen.makeContact());
customer.getContacts().add(gen.makeContact());
customer.getContacts().add(gen.makeContact());
customer.setSource(Source.ONEADO);
customer.getFlags().add(CustomerFlag.ITC_CUSTOMER);
customer.getFlags().add(CustomerFlag.CS_UPDATE_CANDIDATE);
customer.getAdditionalCustomerIds().put(ExternalSystem.SAGE, "testsage");
if (customer.getViolationMessage() != null) {
Ui.exec(() -> {
Ui.build().alert("customer is invalid" + customer.getViolationMessage());
});
return;
}
Ui.exec(() -> {
Ui.build().fxml().eval(() -> customer, CustomerEnhanceController.class).opt().ifPresent(System.out::println);
});
});
JPanel p = new JPanel();
p.add(endKundenButton);
p.add(firmenKundenButton);
p.add(close);
UiCore.startSwing(() -> p);
}
use of eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel in project dwoss by gg-net.
the class CustomerSimpleTest method makeValidAddressLabel.
public static AddressLabel makeValidAddressLabel() {
AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.INVOICE);
assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
return validAddressLabel;
}
use of eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel in project dwoss by gg-net.
the class CustomerTest method makeValidAddressLabel.
public static AddressLabel makeValidAddressLabel() {
AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.INVOICE);
assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
return validAddressLabel;
}
use of eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel in project dwoss by gg-net.
the class CustomerTestUtil method makeValidShippingAddressLabel.
/**
* Uses makeValidCompany, makeValidContact and makeValidAddress.
*
* @return Valid AddressLabel of Type SHIPPING as in AddressLabel.getViolationMessage()
*/
public static AddressLabel makeValidShippingAddressLabel() {
AddressLabel validAddressLabel = new AddressLabel(makeValidCompany(), makeValidContact(), makeValidAddress(), AddressType.SHIPPING);
assertThat(validAddressLabel.getViolationMessage()).as("valid validAddressLabel").isNull();
return validAddressLabel;
}
use of eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel in project dwoss by gg-net.
the class CustomerTestUtil method makeValidConsumerCustomer.
public static Customer makeValidConsumerCustomer() {
Customer customer = new Customer();
customer.getContacts().add(makeValidContact());
customer.getContacts().get(0).getCommunications().add(makeValidCommunication(Type.MOBILE, "0170123456"));
customer.getAddressLabels().add(new AddressLabel(null, customer.getContacts().get(0), customer.getContacts().get(0).getAddresses().get(0), AddressType.INVOICE));
customer.getAddressLabels().add(new AddressLabel(null, customer.getContacts().get(0), makeValidAddress(), AddressType.SHIPPING));
customer.getFlags().add(CustomerFlag.values()[(int) Math.random() * (CustomerFlag.values().length - 1)]);
assertThat(customer.getViolationMessage()).overridingErrorMessage("ConsumerCustomer is not valid, because: " + customer.getViolationMessage()).isNull();
assertThat(customer.isSimple()).overridingErrorMessage("ConsumerCustomer is not simple, because: " + customer.getSimpleViolationMessage()).isFalse();
assertThat(customer.getSimpleViolationMessage()).as("ConsumerCustomer is not simple").isNotNull();
assertThat(customer.isValid()).isTrue();
assertThat(customer.isConsumer()).isTrue();
return customer;
}
Aggregations