Examples of UnitTestClosure


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

        q.addPrefetch(Painting.TO_PAINTING_INFO_PROPERTY);
        q.addOrdering(Painting.PAINTING_TITLE_PROPERTY, SortOrder.ASCENDING);

        final List<Painting> results = context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

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

                // testing non-null to-one target
View Full Code Here

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

        SelectQuery q = new SelectQuery(Painting.class);
        q.addPrefetch(Painting.TO_ARTIST_PROPERTY);

        final List<Painting> paintings = context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                assertEquals(1, paintings.size());

                Painting p2 = paintings.get(0);
View Full Code Here

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

        q.addPrefetch(Painting.TO_ARTIST_PROPERTY);
        q.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);

        context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                // per CAY-499 second run of a cached query with prefetches (i.e. when the
                // result is served from cache) used to throw an exception...
View Full Code Here

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

        q.addPrefetch(Painting.TO_ARTIST_PROPERTY);
        q.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);

        context.performQuery(q);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                // per CAY-499 second run of a cached query with prefetches (i.e. when the
                // result is served from cache) used to throw an exception...
View Full Code Here

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

        createTwoArtists();

        List<?> artists = context.performQuery("QueryWithSharedCache", true);
        assertEquals(2, artists.size());

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                DataContext otherContext = (DataContext) runtime.getContext();
                List<?> artists1 = otherContext.performQuery(
View Full Code Here

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

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

        final List<?> results = clientServerChannel.onQuery(null, query).firstList();

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                ClientMtTable1 o1 = (ClientMtTable1) results.get(0);
                assertNull(o1.getObjectContext());
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<?> results = clientServerChannel.onQuery(null, q).firstList();

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {

                ClientMtTable1 o2 = (ClientMtTable1) results.get(1);
                assertNull(o2.getObjectContext());
View Full Code Here

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

        query.setPageSize(5);
        final List<?> objects = context.performQuery(query);
        assertNotNull(objects);
        assertTrue(objects instanceof IncrementalFaultList);

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                assertEquals(7, objects.size());
            }
        });
View Full Code Here

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

        createTwoArtists();

        List<?> artists = context.performQuery("QueryWithLocalCache", true);
        assertEquals(2, artists.size());

        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {

            public void execute() {
                List<?> artists1 = context.performQuery("QueryWithLocalCache", false);
                assertEquals(2, artists1.size());
            }
View Full Code Here

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

        assertNotNull(artist);

        context.invalidateObjects(Collections.singletonList(artist));
        assertEquals(PersistenceState.HOLLOW, artist.getPersistenceState());

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

            public void execute() {
                // this must trigger a fetch
                artist.setArtistName("new name");
            }
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.