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

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


        // =====================================================================
        //   Create Test Objects
        // =====================================================================

        Person person = new Person();
        person.setAge(-10);

        BeanProxy root = (BeanProxy) createProxy(person);

        // =====================================================================
        //   Set Test Object Specific Expectations
View Full Code Here


        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);

        Proxy proxy = createProxy(contacts);
View Full Code Here

        super.setUp();
        Contacts contacts = new Contacts();
        BeanProxy contactsBeanProxy = (BeanProxy) createProxy(contacts);
        contactsProxy = (ListProxy) contactsBeanProxy.getPropertyProxy(Contacts.CONTACTS);

        Person wilma = createWilmaFlintstone(createFlintStoneAddress());
        wilmaProxy = (BeanProxy) createProxy(wilma);
        contactsProxy.prepareAddProxyItemOperation(wilmaProxy).execute();

        Person fred = createFredFlintstone(createFlintStoneAddress());
        fredProxy = (BeanProxy) createProxy(fred);
        contactsProxy.prepareAddProxyItemOperation(fredProxy).execute();
    }
View Full Code Here

     */
    public void testOperationsFailWhenReadOnly() {
        // List proxy operations
        contactsProxy.setReadWriteState(ReadWriteState.READ_ONLY);
        assertOperationFails("Add model item should fail when list is RO",
                contactsProxy.prepareAddModelItemOperation(new Person()));
        assertOperationFails("Add proxy item should fail when list is RO",
                contactsProxy.prepareAddProxyItemOperation(
                        createProxy(new Person())));
        assertOperationFails("Create/add proxy item should fail when list is RO",
                contactsProxy.prepareCreateAndAddProxyItemOperation());
        assertOperationFails("Remove proxy item should fail when list is RO",
                contactsProxy.prepareRemoveProxyItemOperation(wilmaProxy));
        assertOperationFails("Set model should fail when list is RO",
                contactsProxy.prepareSetModelObjectOperation(new ArrayList()));

        // Bean proxy operations
        wilmaProxy.setReadWriteState(ReadWriteState.READ_ONLY);
        assertOperationFails("Set model should fail when bean is RO",
                wilmaProxy.prepareSetModelObjectOperation(new Person()));

        // Opaque proxy operations
        Proxy opaqueProxy = wilmaProxy.getPropertyProxy(Person.FIRST_NAME);
        opaqueProxy.setReadWriteState(ReadWriteState.READ_ONLY);
        assertOperationFails("Set model should fail when property is RO",
View Full Code Here

public class InteractionTestCase
        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");
View Full Code Here

        lines.add("70777");
        return address;
    }

    public Person createFredFlintstone(Address address) {
        Person person = new Person();
        person.setFirstName("Fred");
        person.setLastName("Flintstone");
        person.setAge(10040);
        person.setAddress(address);
        return person;
    }
View Full Code Here

        person.setAddress(address);
        return person;
    }

    public Person createWilmaFlintstone(Address address) {
        Person person = new Person();
        person.setFirstName("Wilma");
        person.setLastName("Flintstone");
        person.setAge(10021);
        person.setAddress(address);
        return person;
    }
View Full Code Here

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);
View Full Code Here

        // =====================================================================

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

        Person person = createFredFlintstone(address);

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

TOP

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

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.