Package org.apache.isis.core.integtestsupport.legacy.sample.domain

Examples of org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer


        return (WrapperObject) proxiedNewCustomer;
    }

    @Test
    public void invokingSaveThroughProxyMakesTransientObjectPersistent() {
        final Customer newCustomer = getDomainObjectContainer().newTransientInstance(Customer.class);
        assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(false));
        final Customer newCustomerVO = getWrapperFactory().wrap(newCustomer);
        newCustomerVO.setCustomerNumber(123);
        newCustomerVO.setFirstNameMandatory("Joe");
        newCustomerVO.setLastName("Smith");
        newCustomerVO.setMandatoryAssociation(countryGbrDO);
        newCustomerVO.setCountryOfBirthMandatory(countryGbrDO);
        newCustomerVO.setMandatoryValue("foo");
        newCustomerVO.setMaxLengthField("abc");
        newCustomerVO.setRegExCaseInsensitiveField("ABCd");
        newCustomerVO.setRegExCaseSensitiveField("abcd");
        final WrapperObject proxyNewCustomer = asWrapperObject(newCustomerVO);
        proxyNewCustomer.save();
        assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(true));
    }
View Full Code Here


        assertThat(getDomainObjectContainer().isPersistent(custJsDO), is(true));
    }

    @Test
    public void whenValidateMethodThenCanVetoSave() {
        final Customer newCustomer = getDomainObjectContainer().newTransientInstance(Customer.class);

        // just to get into valid state
        newCustomer.setCustomerNumber(123);
        newCustomer.setFirstNameMandatory("Joe");
        newCustomer.setLastName("Smith");
        newCustomer.setCountryOfBirthMandatory(countryGbrDO);
        newCustomer.setMandatoryAssociation(countryGbrDO);
        newCustomer.setMandatoryValue("foo");
        newCustomer.setMaxLengthField("abc");
        newCustomer.setRegExCaseInsensitiveField("ABCd");
        newCustomer.setRegExCaseSensitiveField("abcd");

        final Customer newCustomerWO = getWrapperFactory().wrap(newCustomer);
        newCustomer.validate = "No shakes";

        final WrapperObject newCustomerWrapper = asWrapperObject(newCustomerWO);
        try {
            assertThat(getDomainObjectContainer().isPersistent(newCustomer), is(false));
View Full Code Here

    /**
     * Returns the first Customer with given last name.
     */
    public Customer findByName(@Named("Last name") final String lastName) {
        final Customer firstMatch = firstMatch(Customer.class, new FilterLastName(lastName));
        return firstMatch;
    }
View Full Code Here

    // }}

    @Override
    public void install() {
        getLOGGER().debug("installing");
        final Customer richard = getCustomerRepository().findByName("Pawson");
        final Product foldingTable = getProductRepository().findByCode("820-72721");
        final Product foldingChair = getProductRepository().findByCode("820-72725");
        final Product waspCatcher = getProductRepository().findByCode("850-18003");
        final Product coolbox = getProductRepository().findByCode("845-01020");

        setDate(2007, 4, 11);
        setTime(10, 15);
        richard.placeOrder(foldingTable, 1);
        setDate(2007, 4, 12);
        setTime(9, 35);
        richard.placeOrder(foldingChair, 6);
        setDate(2007, 4, 13);
        setTime(14, 20);
        richard.placeOrder(waspCatcher, 1);
        setDate(2007, 4, 14);
        setTime(11, 10);
        richard.placeOrder(coolbox, 1);
    }
View Full Code Here

     * Creates a new (still-transient) customer.
     *
     * @return
     */
    public Customer newCustomer() {
        final Customer customer = newTransientInstance(Customer.class);
        return customer;
    }
View Full Code Here

     * @return
     */
    @Hidden
    public Customer newCustomer(final String firstName, final String lastName, final int customerNumber, final Country countryOfBirth) {

        final Customer customer = newCustomer();
        customer.setFirstName(firstName);
        customer.setLastName(lastName);
        customer.setCustomerNumber(customerNumber);
        customer.modifyCountryOfBirth(countryOfBirth);

        persist(customer);
        return customer;
    }
View Full Code Here

        final WrapperObject custRpVOAsViewObject = asWrapperObject();
    }

    @Test
    public void shouldBeAbleToCreateAView() {
        final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
        assertThat(custRpVO, instanceOf(Customer.class));
        custRpVO.setFirstName("Dick");

        assertThat("Dick", equalTo(custRpVO.getFirstName()));
    }
View Full Code Here

        assertThat("Dick", equalTo(custRpVO.getFirstName()));
    }

    @Test
    public void viewShouldPassesThroughSetterToUnderlyingDomainObject() {
        final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
        custRpVO.setFirstName("Dick");

        assertThat("Dick", equalTo(custRpVO.getFirstName()));
    }
View Full Code Here

        assertThat("Dick", equalTo(custRpVO.getFirstName()));
    }

    @Test
    public void objectIsViewShouldReturnTrueWhenDealingWithView() {
        final Customer custRpVO = getWrapperFactory().wrap(custJsDO);
        assertThat(getWrapperFactory().isWrapper(custRpVO), is(true));
    }
View Full Code Here

public class InteractionListenerTest extends AbstractTest {

    @Test
    public void shouldBeAbleToAddListener() {
        final Customer proxiedCustRP = getWrapperFactory().wrap(custJsDO);
        final InteractionEvent[] events = { null };
        final InteractionListener l = new InteractionAdapter() {
            @Override
            public void propertyAccessed(final PropertyAccessEvent ev) {
                events[0] = ev;
            }
        };
        getWrapperFactory().addInteractionListener(l);

        proxiedCustRP.getFirstName();
        assertThat(events[0], notNullValue());
        final PropertyAccessEvent ev = (PropertyAccessEvent) events[0];
        assertThat(ev.getMemberNaturalName(), is("First Name"));
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.