Package org.apache.cayenne.test.parallel

Examples of org.apache.cayenne.test.parallel.ParallelTestContainer


        for (int i = 0; i < threads.length; i++) {
            threads[i].start();
        }

        new ParallelTestContainer() {

            @Override
            protected void assertResult() throws Exception {
                for (int i = 0; i < threads.length; i++) {
                    // unfortunately here we'll have to leave some dead threads
View Full Code Here


            test.setName("SoftDeleteBatchQueryBuilderTest");
            context.commitChanges();

            final SelectQuery query = new SelectQuery(SoftTest.class);

            new ParallelTestContainer() {

                @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());
                }
            }.runTest(200);

            context.deleteObjects(test);
            assertEquals(test.getPersistenceState(), PersistenceState.DELETED);
            context.commitChanges();

            new ParallelTestContainer() {

                @Override
                protected void assertResult() throws Exception {
                    query.setQualifier(ExpressionFactory.matchExp("name", test.getName()));
                    assertEquals(0, context.performQuery(query).size());
View Full Code Here

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

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

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

        context.deleteObjects(artist);
        context.commitChanges();

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

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

        context.deleteObjects(artist);
        context.commitChanges();

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

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

        assertEquals(newName, freshSnapshot.get("ARTIST_NAME"));

        // check both artists
        assertEquals(newName, altArtist.getArtistName());

        ParallelTestContainer helper = new ParallelTestContainer() {

            @Override
            protected void assertResult() throws Exception {
                assertEquals(
                        "Peer object state wasn't refreshed on fetch",
                        newName,
                        artist.getArtistName());
            }
        };
        helper.runTest(3000);
    }
View Full Code Here

                .getDataRowCache()
                .getCachedSnapshot(altArtist.getObjectId());
        assertEquals(newName, freshSnapshot.get("ARTIST_NAME"));

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(newName, altArtist.getArtistName());
            }
        };
        helper.runTest(3000);
    }
View Full Code Here

                .getCachedSnapshot(altArtist.getObjectId());
        assertEquals(newName, freshSnapshot.get("ARTIST_NAME"));
        assertEquals(newDate, freshSnapshot.get("DATE_OF_BIRTH"));

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(newAltName, altArtist.getArtistName());
                assertEquals(newDate, altArtist.getDateOfBirth());
                assertEquals(PersistenceState.MODIFIED, altArtist.getPersistenceState());
            }
        };
        helper.runTest(3000);

    }
View Full Code Here

                .getObjectStore()
                .getDataRowCache()
                .getCachedSnapshot(altArtist.getObjectId()));

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(PersistenceState.TRANSIENT, altArtist.getPersistenceState());
                assertNull(altArtist.getObjectContext());
            }
        };
        helper.runTest(3000);
    }
View Full Code Here

                .getObjectStore()
                .getDataRowCache()
                .getCachedSnapshot(altArtist.getObjectId()));

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(PersistenceState.TRANSIENT, altArtist.getPersistenceState());
                assertNull(altArtist.getObjectContext());
            }
        };
        helper.runTest(3000);
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.test.parallel.ParallelTestContainer

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.