Package com.volantis.mcs.interaction

Examples of com.volantis.mcs.interaction.OpaqueProxy


    }

    private String getPropertyAsString(
            BeanProxy beanProxy, PropertyIdentifier identifier) {

        OpaqueProxy opaqueProxy = (OpaqueProxy) beanProxy.getPropertyProxy(
                identifier);
        return opaqueProxy.getModelObjectAsString();
    }
View Full Code Here


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

        rootProxy.addListener(shallowListenerMock, false);
        rootProxy.addListener(deepListenerMock, true);
        Object value;

        // Check that the first name proxy works.
        OpaqueProxy firstNameProxy = (OpaqueProxy) rootProxy.getPropertyProxy(
                Person.FIRST_NAME);
        value = firstNameProxy.getModelObject();
        assertEquals("first name", "Fred", value);

        // Check that the last name proxy works.
        OpaqueProxy lastNameProxy = (OpaqueProxy) rootProxy.getPropertyProxy(
                Person.LAST_NAME);
        value = lastNameProxy.getModelObject();
        assertEquals("last name", "Flintstone", value);

        // Check that the age proxy works.
        OpaqueProxy ageProxy = (OpaqueProxy) rootProxy.getPropertyProxy(
                Person.AGE);
        value = ageProxy.getModelObject();
        assertEquals("age", new Integer(10040), value);

        // Check that the address proxy works.
        BeanProxy addressProxy = (BeanProxy) rootProxy.getPropertyProxy(
                Person.ADDRESS);
        ListProxy linesProxy = (ListProxy) addressProxy.getPropertyProxy(
                Address.LINES);
        int size = linesProxy.size();
        OpaqueProxy lineProxy;
        for (int i = 0; i < size; i += 1) {
            lineProxy = (OpaqueProxy) linesProxy.getItemProxy(i);
            String expectedLine = (String) lines.get(i);
            String actualLine = (String) lineProxy.getModelObject();
            assertEquals("Line " + i, expectedLine, actualLine);
        }

        ProxyModelChangedEvent event = new ProxyModelChangedEvent(
                firstNameProxy, "Fred", "Wilma", true);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.interaction.OpaqueProxy

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.