Examples of ThreadedTestHelper


Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        a1.setArtistName("Y");
        assertEquals("X", a2.getArtistName());
        parentPeer.commitChangesToParent();

        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertEquals("Y", a2.getArtistName());
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        p1.setToArtist(altA1);
        assertSame(a2, p2.getToArtist());
        assertNotSame(altA2, p2.getToArtist());
        parentPeer.commitChangesToParent();

        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertSame(altA2, p2.getToArtist());
                assertFalse("Peer data context became dirty on event processing", peer2
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        a1.addToPaintingArray(py1);
        assertEquals(1, a2.getPaintingArray().size());
        assertFalse(a2.getPaintingArray().contains(py2));
        parentPeer.commitChangesToParent();

        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertEquals(2, a2.getPaintingArray().size());
                assertTrue(a2.getPaintingArray().contains(py2));
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        artist.setArtistName("version2");
        context.commitChanges();

        // assert that delegate was consulted when an object store
        // was refreshed
        ThreadedTestHelper helper = new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertTrue("Delegate was not consulted", methodInvoked[0]);
            }
        };
        helper.assertWithTimeout(3000);
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        context.deleteObject(artist);
        context.commitChanges();

        // assert that delegate was consulted when an object store
        // was refreshed
        ThreadedTestHelper helper = new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertTrue("Delegate was not consulted", methodInvoked[0]);
            }
        };
        helper.assertWithTimeout(3000);
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        context.deleteObject(artist);
        context.commitChanges();

        // assert that delegate was consulted when an object store
        // was refreshed, and actually blocked object expulsion
        ThreadedTestHelper helper = new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertTrue("Delegate was not consulted", methodInvoked[0]);
            }
        };
        helper.assertWithTimeout(3000);
        assertEquals(PersistenceState.COMMITTED, altArtist.getPersistenceState());
        assertNotNull(altArtist.getObjectContext());
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

            test.setName("SoftDeleteBatchQueryBuilderTest");
            context.commitChanges();
           
            final SelectQuery query = new SelectQuery(SoftTest.class);
           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(1, context.performQuery(query).size());
                   
                    query.andQualifier(ExpressionFactory.matchDbExp("DELETED", true));
                    assertEquals(0, context.performQuery(query).size());
                }
            }.assertWithTimeout(200);
           
            context.deleteObject(test);
            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
            context.commitChanges();
           
            new ThreadedTestHelper() {
                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(0, context.performQuery(query).size());
                   
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

                .getCachedSnapshot(a2.getObjectId());
        assertNotNull("No snapshot for artist", freshSnapshot);
        assertEquals(NEW_NAME, freshSnapshot.get("ARTIST_NAME"));

        // check peer artist
        ThreadedTestHelper helper = new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                assertEquals(
                        "Snapshot change is not propagated: " + freshSnapshot,
                        NEW_NAME,
                        a2.getArtistName());
            }
        };
        helper.assertWithTimeout(3000);
    }
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        assertEquals(0, context.getObjectStore().registeredObjectsCount());
        context.performQuery(new SelectQuery(Artist.class));
        assertEquals(1, context.getObjectStore().registeredObjectsCount());

        // allow for slow GC
        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                System.gc();
                assertEquals(0, context.getObjectStore().registeredObjectsCount());
View Full Code Here

Examples of org.apache.cayenne.unit.util.ThreadedTestHelper

        a.setArtistName("X");
        a = null;
        assertEquals(1, context.getObjectStore().registeredObjectsCount());

        // allow for slow GC
        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                System.gc();
                assertEquals(1, context.getObjectStore().registeredObjectsCount());
            }
        }.assertWithTimeout(2000);

        assertEquals(1, context.getObjectStore().registeredObjectsCount());
        context.commitChanges();
        new ThreadedTestHelper() {

            @Override
            protected void assertResult() throws Exception {
                System.gc();
                assertEquals(0, context.getObjectStore().registeredObjectsCount());
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.