Package org.apache.art

Examples of org.apache.art.PaintingInfo


        assertNull(p2.getToPaintingInfo());
    }

    public void testNewAdd() throws Exception {
        Artist a1 = newArtist();
        PaintingInfo pi1 = newPaintingInfo();
        Painting p1 = newPainting();

        // needed to save without errors
        p1.setToArtist(a1);

        // *** TESTING THIS ***
        p1.setToPaintingInfo(pi1);

        // test before save
        assertSame(pi1, p1.getToPaintingInfo());
        assertSame(p1, pi1.getPainting());

        // do save
        ctxt.commitChanges();
        ctxt = createDataContext();

        // test database data
        Painting p2 = fetchPainting();
        PaintingInfo pi2 = p2.getToPaintingInfo();
        assertNotNull(pi2);
        assertEquals(textReview, pi2.getTextReview());
    }
View Full Code Here


    }

    public void testTakeObjectSnapshotDependentFault() throws Exception {
        // prepare data
        Artist a1 = newArtist();
        PaintingInfo pi1 = newPaintingInfo();
        Painting p1 = newPainting();
       
        p1.setToArtist(a1);
        p1.setToPaintingInfo(pi1);
        ctxt.commitChanges();
View Full Code Here

public class CDOOneDep2OneTest extends CayenneDOTestBase {

    public void testNewAdd1() throws Exception {
        Artist a1 = newArtist();
        PaintingInfo pi1 = newPaintingInfo();
        Painting p1 = newPainting();

        // needed to save without errors
        p1.setToArtist(a1);

        // *** TESTING THIS ***
        pi1.setPainting(p1);

        // test before save
        assertSame(pi1, p1.getToPaintingInfo());
        assertSame(p1, pi1.getPainting());

        // do save
        ctxt.commitChanges();
        ctxt = createDataContext();

        // test database data
        PaintingInfo pi2 = fetchPaintingInfo();
        Painting p2 = pi2.getPainting();
        assertNotNull(p2);
        assertEquals(paintingName, p2.getPaintingTitle());
    }
View Full Code Here

        Artist a1 = newArtist();
        assertEquals(a1.getObjectId(), ctxt
                .localObject(a1.getObjectId(), null)
                .getObjectId());

        PaintingInfo pi1 = newPaintingInfo();
        Painting p1 = newPainting();
        p1.setPaintingTitle(altPaintingName);

        pi1.setPainting(p1);

        assertTrue(ctxt.hasChanges());

        // do save
        ctxt.commitChanges();
        ctxt = createDataContext();

        // test database data
        PaintingInfo pi2 = fetchPaintingInfo();
        Painting p21 = pi2.getPainting();
        assertNotNull(p21);
        assertEquals(altPaintingName, p21.getPaintingTitle());
        assertSame(pi2, p21.getToPaintingInfo());
        ByteArrayTypeTest.assertByteArraysEqual(paintingImage, p21
                .getToPaintingInfo()
                .getImageBlob());

        Painting p22 = newPainting();

        // *** TESTING THIS ***
        pi2.setPainting(p22);

        // test before save
        assertNull(p21.getToPaintingInfo());
        assertSame(pi2, p22.getToPaintingInfo());
        assertSame(p22, pi2.getPainting());
        assertEquals(PersistenceState.MODIFIED, pi2.getPersistenceState());

        // do save II
        ctxt.commitChanges();
        ObjectId pi2oid = pi2.getObjectId();
        ctxt = createDataContext();

        PaintingInfo pi3 = fetchPaintingInfo();
        Painting p3 = pi3.getPainting();
        assertNotNull(p3);
        assertEquals(paintingName, p3.getPaintingTitle());
        assertSame(pi3, p3.getToPaintingInfo());

        // test that object id was updated.
        assertEquals(pi2oid, pi3.getObjectId());

    }
View Full Code Here

TOP

Related Classes of org.apache.art.PaintingInfo

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.