Package org.apache.art

Examples of org.apache.art.Painting


        try {
            assertEquals(4, results.size());

            // testing non-null to-one target
            Painting p2 = (Painting) results.get(1);
            Object o2 = p2.readPropertyDirectly(Painting.TO_PAINTING_INFO_PROPERTY);
            assertTrue(o2 instanceof PaintingInfo);
            PaintingInfo pi2 = (PaintingInfo) o2;
            assertEquals(PersistenceState.COMMITTED, pi2.getPersistenceState());
            assertEquals(DataObjectUtils.intPKForObject(p2), DataObjectUtils
                    .intPKForObject(pi2));

            // testing null to-one target
            Painting p4 = (Painting) results.get(3);
            assertNull(p4.readPropertyDirectly(Painting.TO_PAINTING_INFO_PROPERTY));

            // there was a bug marking an object as dirty when clearing the relationships
            assertEquals(PersistenceState.COMMITTED, p4.getPersistenceState());
        }
        finally {
            unblockQueries();
        }
    }
View Full Code Here


        context.performQuery(q);
    }

    public void testPrefetchingToOneNull() throws Exception {

        Painting p1 = context.newObject(Painting.class);
        p1.setPaintingTitle("aaaa");

        context.commitChanges();
        context.invalidateObjects(Collections.singleton(p1));

        SelectQuery q = new SelectQuery(Painting.class);
        q.addPrefetch("toArtist");

        // run the query ... see that it doesn't blow
        List paintings = context.performQuery(q);

        blockQueries();
        try {
            assertEquals(1, paintings.size());

            Painting p2 = (Painting) paintings.get(0);
            assertNull(p2.readProperty(Painting.TO_ARTIST_PROPERTY));
        }
        finally {
            unblockQueries();
        }
    }
View Full Code Here

        assertNotNull(artist);
        assertEquals(nameAfter, artist.getArtistName());
    }

    public void testRefetchRootWithNullifiedToOne() throws Exception {
        Painting painting = insertPaintingInContext("p");
        assertNotNull(painting.getToArtist());

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", null);

        // select without prefetch
        painting = fetchPainting(painting.getPaintingTitle(), false);
        assertNotNull(painting);
        assertNull(painting.getToArtist());
    }
View Full Code Here

        assertNotNull(painting);
        assertNull(painting.getToArtist());
    }

    public void testRefetchRootWithChangedToOneTarget() throws Exception {
        Painting painting = insertPaintingInContext("p");
        Artist artistBefore = painting.getToArtist();
        assertNotNull(artistBefore);

        Artist artistAfter = fetchArtist("artist3", false);
        assertNotNull(artistAfter);
        assertNotSame(artistBefore, artistAfter);

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", artistAfter
                .getObjectId()
                .getIdSnapshot()
                .get("ARTIST_ID"));

        // select without prefetch
        painting = fetchPainting(painting.getPaintingTitle(), false);
        assertNotNull(painting);
        assertSame(artistAfter, painting.getToArtist());
    }
View Full Code Here

        assertNotNull(painting);
        assertSame(artistAfter, painting.getToArtist());
    }

    public void testRefetchRootWithNullToOneTargetChangedToNotNull() throws Exception {
        Painting painting = insertPaintingInContext("p");
        painting.setToArtist(null);
        context.commitChanges();

        assertNull(painting.getToArtist());

        Artist artistAfter = fetchArtist("artist3", false);
        assertNotNull(artistAfter);

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", artistAfter
                .getObjectId()
                .getIdSnapshot()
                .get("ARTIST_ID"));

        // select without prefetch
        painting = fetchPainting(painting.getPaintingTitle(), false);
        assertNotNull(painting);
        assertSame(artistAfter, painting.getToArtist());
    }
View Full Code Here

        assertNotNull(painting);
        assertSame(artistAfter, painting.getToArtist());
    }

    public void testRefetchRootWithDeletedToMany() throws Exception {
        Painting painting = insertPaintingInContext("p");
        Artist artist = painting.getToArtist();
        assertEquals(artist.getPaintingArray().size(), 1);

        deleteRow(painting.getObjectId());

        // select without prefetch
        artist = fetchArtist(artist.getArtistName(), false);
        assertEquals(artist.getPaintingArray().size(), 1);
View Full Code Here

        context.invalidateObjects(Collections.singletonList(artist));
        assertEquals(nameAfter, artist.getArtistName());
    }

    public void testInvalidateRootWithNullifiedToOne() throws Exception {
        Painting painting = insertPaintingInContext("p");
        assertNotNull(painting.getToArtist());

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", null);

        context.invalidateObjects(Collections.singletonList(painting));
        assertNull(painting.getToArtist());
    }
View Full Code Here

        context.invalidateObjects(Collections.singletonList(painting));
        assertNull(painting.getToArtist());
    }

    public void testInvalidateRootWithChangedToOneTarget() throws Exception {
        Painting painting = insertPaintingInContext("p");
        Artist artistBefore = painting.getToArtist();
        assertNotNull(artistBefore);

        Artist artistAfter = fetchArtist("artist3", false);
        assertNotNull(artistAfter);
        assertNotSame(artistBefore, artistAfter);

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", artistAfter
                .getObjectId()
                .getIdSnapshot()
                .get("ARTIST_ID"));

        context.invalidateObjects(Collections.singletonList(painting));
        assertSame(artistAfter, painting.getToArtist());
    }
View Full Code Here

        context.invalidateObjects(Collections.singletonList(painting));
        assertSame(artistAfter, painting.getToArtist());
    }

    public void testInvalidateRootWithNullToOneTargetChangedToNotNull() throws Exception {
        Painting painting = insertPaintingInContext("p");
        painting.setToArtist(null);
        context.commitChanges();

        assertNull(painting.getToArtist());

        Artist artistAfter = fetchArtist("artist3", false);
        assertNotNull(artistAfter);

        // update via DataNode directly
        updateRow(painting.getObjectId(), "ARTIST_ID", artistAfter
                .getObjectId()
                .getIdSnapshot()
                .get("ARTIST_ID"));

        context.invalidateObjects(Collections.singletonList(painting));
        assertSame(artistAfter, painting.getToArtist());
    }
View Full Code Here

        context.invalidateObjects(Collections.singletonList(painting));
        assertSame(artistAfter, painting.getToArtist());
    }

    public void testInvalidateRootWithDeletedToMany() throws Exception {
        Painting painting = insertPaintingInContext("p");
        Artist artist = painting.getToArtist();
        assertEquals(artist.getPaintingArray().size(), 1);

        deleteRow(painting.getObjectId());

        context.invalidateObjects(Collections.singletonList(artist));
        assertEquals(artist.getPaintingArray().size(), 0);
    }
View Full Code Here

TOP

Related Classes of org.apache.art.Painting

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.