Package org.apache.cayenne.test.parallel

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


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

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(PersistenceState.NEW, altArtist.getPersistenceState());
            }
        };
        helper.runTest(3000);

        // check if now we can save this object again, and with the original
        // ObjectId
        ObjectId id = altArtist.getObjectId();
        assertNotNull(id);
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);

        assertFalse(context1.hasChanges());
    }
View Full Code Here

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

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

            @Override
            protected void assertResult() throws Exception {
                assertEquals(
                        PersistenceState.TRANSIENT,
                        altPainting1.getPersistenceState());
                assertEquals(PersistenceState.COMMITTED, altArtist.getPersistenceState());

                Collection<Painting> list = altArtist.getPaintingArray();
                assertEquals(1, list.size());
                assertFalse(list.contains(altPainting1));
            }
        };
        helper.runTest(3000);
    }
View Full Code Here

        // check peer artist

        // use threaded helper as a barrier, to avoid triggering faults earlier than
        // needed
        ParallelTestContainer helper = new ParallelTestContainer() {

            @Override
            protected void assertResult() throws Exception {
                Object value = altArtist.readPropertyDirectly("paintingArray");
                assertTrue("Unexpected: " + value, value instanceof ToManyList);
                assertTrue(((ToManyList) value).isFault());
            }
        };
        helper.runTest(2000);
        List<Painting> list = altArtist.getPaintingArray();
        assertEquals(2, list.size());
    }
View Full Code Here

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

        // alternate context
        new ParallelTestContainer() {

            @Override
            protected void assertResult() throws Exception {
                assertEquals(PersistenceState.HOLLOW, altArtist.getPersistenceState());
                assertNull(context1
View Full Code Here

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

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

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

        a1.setName("Y");
        assertEquals("X", a2.getName());
        parentContext2.commitChangesToParent();

        new ParallelTestContainer() {

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

        p1.setMaster(altA1);
        assertSame(a2, p2.getMaster());
        assertNotSame(altA2, p2.getMaster());
        parentContext2.commitChanges();

        new ParallelTestContainer() {

            @Override
            protected void assertResult() throws Exception {
                assertSame(altA2, p2.getMaster());
                assertFalse(
View Full Code Here

        a1.addToChildren(py1);
        assertEquals(1, a2.getChildren().size());
        assertFalse(a2.getChildren().contains(py2));
        parentContext2.commitChangesToParent();

        new ParallelTestContainer() {

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

    assertEquals(a1TempId, a2.getObjectId());

    peer1.commitChanges();

    // pause to let the context events propagate
    new ParallelTestContainer() {

      @Override
      protected void assertResult() throws Exception {
        assertFalse(a1.getObjectId().isTemporary());
        assertFalse(a2.getObjectId().isTemporary());
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.