Package org.apache.art

Examples of org.apache.art.Artist


        query.addOrdering(Artist.ARTIST_NAME_PROPERTY, Ordering.ASC);

        List<Artist> result = createDataContext().performQuery(query);
        assertEquals(2, result.size());

        Artist a = result.get(0);
        assertEquals(3, a.getPaintingArray().size());

        Artist a1 = result.get(1);
        assertEquals(0, a1.getPaintingArray().size());
    }
View Full Code Here


    public void testSnapshotRetainedOnPropertyModification() throws Exception {
        createTestData("test");

        DataContext context = createDataContext();
        Artist a = DataObjectUtils.objectForPK(context, Artist.class, 2000);
        ObjectStore objectStore = context.getObjectStore();

        assertNull(objectStore.getChangesByObjectId().get(a.getObjectId()));

        a.setArtistName("some other name");
        assertNotNull(objectStore.getChangesByObjectId().get(a.getObjectId()));
    }
View Full Code Here

        Map row = (Map) artists.get(0);
        String artistName = (String) row.get("ARTIST_NAME");

        assertTrue(row instanceof DataRow);

        Artist artist = (Artist) createDataContext().objectFromDataRow(
                "Artist",
                (DataRow) row,
                true);
        assertEquals(artistName, artist.getArtistName());
    }
View Full Code Here

    private void insertValue() {
        DataContext context = createDataContext();

        for (int i = 0; i < 5; i++) {
            Artist obj = context.newObject(Artist.class);
            obj.setArtistName("a" + i);
            context.commitChanges();
        }
    }
View Full Code Here

    private void insertPaintValue() {
        DataContext context = createDataContext();

        for (int i = 0; i < 2; i++) {
            Artist art = context.newObject(Artist.class);
            art.setArtistName("a" + i);
            Painting obj = context.newObject(Painting.class);
            obj.setToArtist(art);
            obj.setPaintingTitle("title" + i);
            context.commitChanges();
        }
View Full Code Here

   
    public void testOrBrackets() throws Exception {
        deleteTestData();
        ObjectContext context = createDataContext();
       
        Artist a = context.newObject(Artist.class);
        a.setArtistName("testOrBrackets");
        context.commitChanges();
       
        //this query is equivalent to (false and (false or true)) and
        //should always return 0 rows
        EJBQLQuery query = new EJBQLQuery("select a from Artist a " +
View Full Code Here

    public void testSnapshotRetainedOnRelAndPropertyModification() throws Exception {
        createTestData("test");

        DataContext context = createDataContext();
        Artist a = DataObjectUtils.objectForPK(context, Artist.class, 2000);
        ObjectStore objectStore = context.getObjectStore();

        assertNull(objectStore.getChangesByObjectId().get(a.getObjectId()));

        // we are trying to reproduce the bug CAY-213 - relationship modification puts
        // object in a modified state, so later when object is really modified, its
        // snapshot is not retained... in testing this I am leaving some flexibility for
        // the framework to retain a snapshot when it deems appropriate...

        a.addToPaintingArray(context.newObject(Painting.class));
        a.setArtistName("some other name");
        assertNotNull("Snapshot wasn't retained - CAY-213", objectStore
                .getChangesByObjectId()
                .get(a.getObjectId()));
    }
View Full Code Here

public class UserTransactionTest extends CayenneCase {

    public void testCommit() throws Exception {
        DataContext context = createDataContext();

        Artist a = context.newObject(Artist.class);
        a.setArtistName("AAA");

        final boolean[] willAddConnectionCalled = new boolean[1];
        final boolean[] willCommitCalled = new boolean[1];
        final boolean[] didCommitCalled = new boolean[1];
View Full Code Here

    }

    public void testDeleteObject() throws Exception {
        createTestData("testDeleteObject");

        Artist artist = DataObjectUtils.objectForPK(context, Artist.class, 1);
        assertEquals(PersistenceState.COMMITTED, artist.getPersistenceState());
        context.deleteObject(artist);
        assertEquals(PersistenceState.DELETED, artist.getPersistenceState());
        context.commitChanges();
        assertEquals(PersistenceState.TRANSIENT, artist.getPersistenceState());
        assertNull(artist.getObjectContext());
    }
View Full Code Here

    }

    public void testDeleteObjectsRelationshipCollection() throws Exception {
        createTestData("testDeleteObjectsRelationshipCollection");

        Artist artist = DataObjectUtils.objectForPK(context, Artist.class, 1);
        List paintings = artist.getPaintingArray();

        assertEquals(3, paintings.size());

        // create a clone to be able to inspect paintings after deletion
        List paintingsClone = new ArrayList(paintings);
View Full Code Here

TOP

Related Classes of org.apache.art.Artist

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.