Package com.volantis.mcs.interaction.sample.model

Examples of com.volantis.mcs.interaction.sample.model.Address


        Contacts contacts = new Contacts();
        List contactsList = contacts.getContacts();

        // Share the address.
        Address flintstonesAddress = createFlintStoneAddress();
        Person fred = createFredFlintstone(flintstonesAddress);
        Person wilma = createWilmaFlintstone(flintstonesAddress);

        contactsList.add(fred);
        contactsList.add(wilma);
View Full Code Here


        extends FlintstoneTestAbstract {

    public void testCreateModelFromProxies() {

        Person person = new Person();
        Address address;

        BeanProxy personProxy = (BeanProxy) createProxy(person);
        OpaqueProxy firstNameProxy = (OpaqueProxy) personProxy.getPropertyProxy(
                Person.FIRST_NAME);
        firstNameProxy.setModelObject("Fred");
        assertEquals("First name", "Fred", person.getFirstName());

        OpaqueProxy ageProxy = (OpaqueProxy) personProxy.getPropertyProxy(
                Person.AGE);
        ageProxy.setModelObject(new Integer(10030));
        assertEquals("Age", 10030, person.getAge());

        // Address should be null before it is modified.
        address = person.getAddress();
        assertNull("Address not null", address);

        BeanProxy addressProxy = (BeanProxy) personProxy.getPropertyProxy(
                Person.ADDRESS);
        ListProxy linesProxy = (ListProxy) addressProxy.getPropertyProxy(
                Address.LINES);

        // Address should still be null after its proxy and a nested proxy have
        // been added.
        address = person.getAddress();
        assertNull("Address not null", address);

        OpaqueProxy lineProxy;
        lineProxy = (OpaqueProxy) linesProxy.addItemProxy();
        lineProxy.setModelObject("301 Cobblestone Way");

        // Address should not be null now.
        address = person.getAddress();
        assertNotNull("Address null", address);

        lineProxy = (OpaqueProxy) linesProxy.addItemProxy();
        lineProxy.setModelObject("Bedrock");

        lineProxy = (OpaqueProxy) linesProxy.addItemProxy();
        lineProxy.setModelObject("70777");

        List expectedAddressLines = new ArrayList();
        expectedAddressLines.add("301 Cobblestone Way");
        expectedAddressLines.add("Bedrock");
        expectedAddressLines.add("70777");

        // Lines should not be null and should match expected.
        List actualAddressLines = address.getLines();
        assertNotNull("Address lines null", actualAddressLines);
        assertEquals(
                "Address lines mismatch", expectedAddressLines,
                actualAddressLines);
    }
View Full Code Here

public abstract class FlintstoneTestAbstract
        extends TestCaseAbstract {

    public Address createFlintStoneAddress() {
        Address address = new AddressImpl();
        List lines = address.getLines();
        lines.add("301 Cobblestone Way");
        lines.add("Bedrock");
        lines.add("70777");
        return address;
    }
View Full Code Here

public class CopyingTestCase
extends FlintstoneTestAbstract {

    public void testCopying() {

        Address address = createFlintStoneAddress();
        Person person = createFredFlintstone(address);

        Proxy proxy = createProxy(person);

        Person personCopy = (Person) proxy.copyModelObject();
        assertEquals("age", person.getAge(), personCopy.getAge());
        assertSame("firstName", person.getFirstName(), personCopy.getFirstName());
        assertSame("lastName", person.getLastName(), personCopy.getLastName());

        Address addressCopy = personCopy.getAddress();
        assertNotSame("address", address, addressCopy);

        List lines = address.getLines();
        List linesCopy = addressCopy.getLines();
        assertNotSame("lines", lines, linesCopy);

        assertEquals("lines", lines, linesCopy);

        for (int i = 0; i < lines.size(); i++) {
View Full Code Here

                Person.ADDRESS);

        // Set the proxy, this should cause the model objects for all the
        // parent proxies to be created but it should not affect the model
        // object associated with the person2Proxy.
        Address address1 = new AddressImpl();
        address1Proxy.setModelObject(address1);

        // The proxy for the address of the second Person object.
        BeanProxy address2Proxy = (BeanProxy) person2Proxy.getPropertyProxy(
                Person.ADDRESS);

        Address address2 = (Address) address2Proxy.getModelObject();
        assertNull("Getting a required embedded object in list proxy has " +
                "cause other proxies to get the same object.", address2);
    }
View Full Code Here

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        Address address = createFlintStoneAddress();
        List lines = address.getLines();

        Person person = createFredFlintstone(address);

        BeanProxy rootProxy = (BeanProxy) createProxy(person);
        rootProxy.addListener(shallowListenerMock, false);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.interaction.sample.model.Address

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.