Package org.apache.cayenne

Examples of org.apache.cayenne.MockObjectContext


                "setObjectContext",
                ObjectContext.class);

        Object o = e1Class.newInstance();
        assertNull(getObjectContext.invoke(o, (Object[]) null));
        ObjectContext oc = new MockObjectContext();
        setObjectContext.invoke(o, oc);
        assertSame(oc, getObjectContext.invoke(o, (Object[]) null));
    }
View Full Code Here


        assertEquals(null, getAttribute1.invoke(o, (Object[]) null));

        // now call on attached object

        final Object[] prepared = new Object[3];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void prepareForAccess(Persistent object, String property, boolean lazyFaulting) {
                prepared[0] = object;
                prepared[1] = property;
View Full Code Here

        setAttribute1.invoke(o, "x");
        assertEquals("x", getAttribute1.invoke(o, (Object[]) null));

        // now call on attached object
        final Object[] change = new Object[4];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void propertyChanged(
                    Persistent object,
                    String property,
View Full Code Here

        assertEquals(new Integer(0), getAttribute2.invoke(o, (Object[]) null));

        // now call on attached object

        final Object[] prepared = new Object[3];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void prepareForAccess(Persistent object, String property, boolean lazyFaulting) {
                prepared[0] = object;
                prepared[1] = property;
View Full Code Here

        setAttribute2.invoke(o, new Integer(3));
        assertEquals(new Integer(3), getAttribute2.invoke(o, (Object[]) null));

        // now call on attached object
        final Object[] change = new Object[4];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void propertyChanged(
                    Persistent object,
                    String property,
View Full Code Here

        assertEquals(new Double(0d), getAttribute3.invoke(o, (Object[]) null));

        // now call on attached object

        final Object[] prepared = new Object[3];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void prepareForAccess(Persistent object, String property, boolean lazyFaulting) {
                prepared[0] = object;
                prepared[1] = property;
View Full Code Here

        setAttribute3.invoke(o, new Double(3.1d));
        assertEquals(new Double(3.1d), getAttribute3.invoke(o, (Object[]) null));

        // now call on attached object
        final Object[] change = new Object[4];
        ObjectContext context = new MockObjectContext() {

            @Override
            public void propertyChanged(
                    Persistent object,
                    String property,
View Full Code Here

                binder.bind(DataChannel.class).to(MockDataChannel.class);
                binder.bind(ObjectContextFactory.class).toInstance(
                        new ObjectContextFactory() {

                            public ObjectContext createContext(DataChannel parent) {
                                return new MockObjectContext();
                            }

                            public ObjectContext createContext() {
                                return new MockObjectContext();
                            }
                        });
            }
        };
        Injector injector = DIBootstrap.createInjector(module);
View Full Code Here

public class PersistentObjectHolderTest extends TestCase {

    public void testSetInitialValue() {

        MockObjectContext context = new MockObjectContext(new GraphMap());

        ClientMtTable2 o = new ClientMtTable2();
        o.setPersistenceState(PersistenceState.COMMITTED);
        o.setObjectContext(context);
        PersistentObjectHolder holder = new PersistentObjectHolder(
View Full Code Here

        assertFalse(holder.isFault());
        assertSame(o1, holder.value);
    }

    public void testInvalidate() {
        MockObjectContext context = new MockObjectContext(new GraphMap());

        ClientMtTable2 o = new ClientMtTable2();
        o.setPersistenceState(PersistenceState.COMMITTED);
        o.setObjectContext(context);
        PersistentObjectHolder holder = new PersistentObjectHolder(
View Full Code Here

TOP

Related Classes of org.apache.cayenne.MockObjectContext

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.