Examples of UnitTestClosure


Examples of org.apache.cayenne.unit.di.UnitTestClosure

                new SelectQuery(Painting.class)).get(0);
        final Artist artist = painting.getToArtist();
        assertEquals(PersistenceState.HOLLOW, artist.getPersistenceState());
        assertNull(artist.readPropertyDirectly("artistName"));

        int queries = queryInterceptor.runWithQueryCounter(new UnitTestClosure() {

            public void execute() {
                // this must trigger a fetch
                artist.setDateOfBirth(new Date());
            }
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        EJBQLQuery query = new EJBQLQuery(ejbql);

        final List<?> objects = context.performQuery(query);

        queryBlocker.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                assertNotNull(objects);
                assertFalse(objects.isEmpty());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        EJBQLQuery query = new EJBQLQuery(ejbql);

        final List<?> objects = context.performQuery(query);

        queryBlocker.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                assertEquals(2, objects.size());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

                + "ORDER BY a.artistName, g.galleryName";

        EJBQLQuery query = new EJBQLQuery(ejbql);

        final List<?> objects = context.performQuery(query);
        queryBlocker.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                assertEquals(6, objects.size());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        q.addOrdering(ClientMtTable2.GLOBAL_ATTRIBUTE_PROPERTY, SortOrder.ASCENDING);
        q.addPrefetch(ClientMtTable2.TABLE1_PROPERTY);

        final List<ClientMtTable2> results = clientContext.performQuery(q);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                assertEquals(2, results.size());

                for (ClientMtTable2 o : results) {
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        SelectQuery q = new SelectQuery(ClientMtTable2.class);
        q.addPrefetch(ClientMtTable2.TABLE1_PROPERTY);

        final List<ClientMtTable2> results = clientContext.performQuery(q);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                assertEquals(1, results.size());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
        q.addPrefetch(ClientMtTable1.TABLE2ARRAY_PROPERTY);

        final List<ClientMtTable1> results = clientContext.performQuery(q);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                ClientMtTable1 o1 = results.get(0);
                assertEquals(PersistenceState.COMMITTED, o1.getPersistenceState());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        q.addOrdering(ClientMtTable1.GLOBAL_ATTRIBUTE1_PROPERTY, SortOrder.ASCENDING);
        q.addPrefetch(ClientMtTable1.TABLE2ARRAY_PROPERTY);

        final List<ClientMtTable1> results = clientContext.performQuery(q);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                ClientMtTable1 o2 = results.get(1);
                assertEquals(PersistenceState.COMMITTED, o2.getPersistenceState());
                assertSame(clientContext, o2.getObjectContext());
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        final ObjectIdQuery q1 = new ObjectIdQuery(
                o.getObjectId(),
                false,
                ObjectIdQuery.CACHE);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                List<?> objects = clientContext.performQuery(q1);
                assertEquals(1, objects.size());
                assertSame(o, objects.get(0));
            }
        });

        clientContext.commitChanges();

        // fetch committed
        final ObjectIdQuery q2 = new ObjectIdQuery(
                o.getObjectId(),
                false,
                ObjectIdQuery.CACHE);

        clientServerInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                List<?> objects = clientContext.performQuery(q2);
                assertEquals(1, objects.size());
                assertSame(o, objects.get(0));
View Full Code Here

Examples of org.apache.cayenne.unit.di.UnitTestClosure

        ClientMtTable1 o1 = context.newObject(ClientMtTable1.class);
        o1.setGlobalAttribute1("v1");
        o1.setGlobalAttribute1("v2");

        DataChannelSyncStats stats = clientServerInterceptor
                .runWithSyncStatsCollection(new UnitTestClosure() {

                    public void execute() {
                        context.commitChanges();
                    }
                });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.