Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.MockQuery


            }
        };
        DataContext context = new DataContext(parent, new ObjectStore(
                new MockDataRowStore()));

        QueryMessage message = new QueryMessage(new MockQuery());
        new ClientServerChannel(context).onQuery(null, message.getQuery());
        assertTrue(genericDone[0]);
    }
View Full Code Here


            }
        };
        context.setDelegate(delegate);

        // test that delegate is consulted before select
        MockQuery query = new MockQuery();
        context.performGenericQuery(query);

        assertTrue("Delegate is not notified of a query being run.", queriesPerformed
                .contains(query));
        assertEquals(1, queriesPerformed.size());
        assertTrue("Delegate unexpectedly blocked the query.", query.isRouteCalled());
    }
View Full Code Here

                return null;
            }
        };

        context.setDelegate(delegate);
        MockQuery query = new MockQuery();
        context.performGenericQuery(query);

        assertTrue("Delegate is not notified of a query being run.", queriesPerformed
                .contains(query));
        assertEquals(1, queriesPerformed.size());
        assertFalse("Delegate couldn't block the query.", query.isRouteCalled());
    }
View Full Code Here

import org.apache.cayenne.unit.CayenneCase;

public class QualifierTranslatorTest extends CayenneCase {

    public void testNonQualifiedQuery() throws Exception {
        TstQueryAssembler qa = new TstQueryAssembler(getNode(), new MockQuery());

        try {
            new QualifierTranslator(qa).appendPart(new StringBuilder());
            fail();
        }
View Full Code Here

        doExpressionTest(suite);
    }

    private void doExpressionTest(TstExpressionSuite suite) throws Exception {

        TstQueryAssembler qa = new TstQueryAssembler(getNode(), new MockQuery());

        try {
            TstExpressionCase[] cases = suite.cases();

            int len = cases.length;
View Full Code Here

    }

    public void testGetQuery() {
        // create a resolver with a single map
        DataMap m1 = new DataMap();
        Query q = new MockQuery("query1");
        m1.addQuery(q);

        EntityResolver resolver = new EntityResolver(Collections.singleton(m1));
        assertSame(q, resolver.getQuery("query1"));

        // check that the query added on-the-fly will be recognized
        assertNull(resolver.getQuery("query2"));

        Query q2 = new MockQuery("query2");
        m1.addQuery(q2);
        assertSame(q2, resolver.getQuery("query2"));
    }
View Full Code Here

            }
        };
        context.setDelegate(delegate);

        // test that delegate is consulted before select
        MockQuery query = new MockQuery();
        context.performGenericQuery(query);

        assertTrue("Delegate is not notified of a query being run.", queriesPerformed
                .contains(query));
        assertEquals(1, queriesPerformed.size());
        assertTrue("Delegate unexpectedly blocked the query.", query.isRouteCalled());
    }
View Full Code Here

                return null;
            }
        };

        context.setDelegate(delegate);
        MockQuery query = new MockQuery();
        context.performGenericQuery(query);

        assertTrue("Delegate is not notified of a query being run.", queriesPerformed
                .contains(query));
        assertEquals(1, queriesPerformed.size());
        assertFalse("Delegate couldn't block the query.", query.isRouteCalled());
    }
View Full Code Here

            }
        };
        DataContext context = new DataContext(parent, new ObjectStore(
                new MockDataRowStore()));

        QueryMessage message = new QueryMessage(new MockQuery());
        new ClientServerChannel(context).onQuery(null, message.getQuery());
        assertTrue(genericDone[0]);
    }
View Full Code Here

    }

    public void testGetQuery() {
        // create a resolver with a single map
        DataMap m1 = new DataMap();
        Query q = new MockQuery("query1");
        m1.addQuery(q);

        EntityResolver resolver = new EntityResolver(Collections.singleton(m1));
        assertSame(q, resolver.getQuery("query1"));

        // check that the query added on-the-fly will be recognized
        assertNull(resolver.getQuery("query2"));

        Query q2 = new MockQuery("query2");
        m1.addQuery(q2);
        assertSame(q2, resolver.getQuery("query2"));
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.MockQuery

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.