Package org.apache.cayenne.testdo.testmap

Examples of org.apache.cayenne.testdo.testmap.CompoundPainting


        assertEquals(8, objects.size());
        assertTrue("CompoundPainting expected, got " + objects.get(0).getClass(), objects
                .get(0) instanceof CompoundPainting);

        for (Iterator<?> i = objects.iterator(); i.hasNext();) {
            CompoundPainting painting = (CompoundPainting) i.next();
            Number id = (Number) painting
                    .getObjectId()
                    .getIdSnapshot()
                    .get("PAINTING_ID");
            assertEquals("CompoundPainting.getPaintingTitle(): "
                    + painting.getPaintingTitle(), "painting" + id, painting
                    .getPaintingTitle());
            if (painting.getToPaintingInfo()==null){
                assertNull(painting.getTextReview());
            }else{
                assertEquals("CompoundPainting.getTextReview(): "
                        + painting.getTextReview(), "painting review" + id, painting
                        .getTextReview());
            }
            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getArtistName(),
                    painting.getToArtist().getArtistName(),
                    painting.getArtistName());
            if (painting.getToGallery() == null) {
                assertNull(painting.getGalleryName());
            }
            else {
                assertEquals("CompoundPainting.getGalleryName(): "
                        + painting.getGalleryName(), painting
                        .getToGallery()
                        .getGalleryName(), painting.getGalleryName());
            }
        }
    }
View Full Code Here


        assertEquals(2, objects.size());
        assertTrue("CompoundPainting expected, got " + objects.get(0).getClass(), objects
                .get(0) instanceof CompoundPainting);

        for (Iterator<?> i = objects.iterator(); i.hasNext();) {
            CompoundPainting painting = (CompoundPainting) i.next();
            assertEquals(PersistenceState.COMMITTED, painting.getPersistenceState());
           
            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getArtistName(),
                    "artist2",
                    painting.getArtistName());
            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getGalleryName(),
                    painting.getToGallery().getGalleryName(),
                    painting.getGalleryName());
        }
    }
View Full Code Here

        assertEquals(2, objects.size());
        assertTrue("CompoundPainting expected, got " + objects.get(0).getClass(), objects
                .get(0) instanceof CompoundPainting);
        Iterator<?> i = objects.iterator();
        while (i.hasNext()) {
            CompoundPainting painting = (CompoundPainting) i.next();
            assertEquals(PersistenceState.COMMITTED, painting.getPersistenceState());
        }
    }
View Full Code Here

        assertNotNull(objects);
        assertEquals(8, objects.size());
        Iterator<?> i = objects.iterator();
        int index=1;
        while (i.hasNext()) {
            CompoundPainting painting = (CompoundPainting) i.next();
            assertEquals("painting" + index, painting.getPaintingTitle());
            index++;
        }
    }
View Full Code Here

        assertNotNull(objects);
        assertEquals(8, objects.size());
        Iterator<?> i = objects.iterator();
        int index=1;
        while (i.hasNext()) {
            CompoundPainting painting = (CompoundPainting) i.next();
            assertEquals("painting" + index, painting.getPaintingTitle());
            index++;
        }
    }
View Full Code Here

        assertEquals("gallery1", galleryItem[0]);
        assertEquals(3L, galleryItem[1]);
    }
   
    public void testInsert() {
        CompoundPainting o1 = context.newObject(CompoundPainting.class);
        o1.setArtistName("A1");
        o1.setEstimatedPrice(new BigDecimal(1.0d));
        o1.setGalleryName("G1");
        o1.setPaintingTitle("P1");
        o1.setTextReview("T1");

        context.commitChanges();

        Number artistCount = (Number) Cayenne.objectForQuery(
                context,
View Full Code Here

        // not purely coincidental
        Artist a = context.newObject(Artist.class);
        a.setArtistName("AX");
        context.commitChanges();

        CompoundPainting o1 = context.newObject(CompoundPainting.class);
        o1.setArtistName("A1");
        o1.setEstimatedPrice(new BigDecimal(1.0d));
        o1.setGalleryName("G1");
        o1.setPaintingTitle("P1");
        o1.setTextReview("T1");

        context.commitChanges();

        context.deleteObject(o1);
        context.commitChanges();
View Full Code Here

                new EJBQLQuery("select count(a) from Gallery a"));
        assertEquals(0, galleryCount.intValue());
    }

    public void testUpdate() {
        CompoundPainting o1 = context.newObject(CompoundPainting.class);
        o1.setArtistName("A1");
        o1.setEstimatedPrice(new BigDecimal(1d));
        o1.setGalleryName("G1");
        o1.setPaintingTitle("P1");
        o1.setTextReview("T1");

        context.commitChanges();

        o1.setArtistName("X1");
        o1.setEstimatedPrice(new BigDecimal(2d));
        o1.setGalleryName("X1");
        o1.setPaintingTitle("X1");
        o1.setTextReview("X1");

        context.commitChanges();
    }
View Full Code Here

        assertTrue(
                "CompoundPainting expected, got " + objects.get(0).getClass(),
                objects.get(0) instanceof CompoundPainting);

        for (Iterator<?> i = objects.iterator(); i.hasNext();) {
            CompoundPainting painting = (CompoundPainting) i.next();
            Number id = (Number) painting
                    .getObjectId()
                    .getIdSnapshot()
                    .get("PAINTING_ID");
            assertEquals(
                    "CompoundPainting.getPaintingTitle(): " + painting.getPaintingTitle(),
                    "painting" + id,
                    painting.getPaintingTitle());
            if (painting.getToPaintingInfo() == null) {
                assertNull(painting.getTextReview());
            }
            else {
                assertEquals(
                        "CompoundPainting.getTextReview(): " + painting.getTextReview(),
                        "painting review" + id,
                        painting.getTextReview());
            }
            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getArtistName(),
                    painting.getToArtist().getArtistName(),
                    painting.getArtistName());
            if (painting.getToGallery() == null) {
                assertNull(painting.getGalleryName());
            }
            else {
                assertEquals(
                        "CompoundPainting.getGalleryName(): " + painting.getGalleryName(),
                        painting.getToGallery().getGalleryName(),
                        painting.getGalleryName());
            }
        }
    }
View Full Code Here

        assertTrue(
                "CompoundPainting expected, got " + objects.get(0).getClass(),
                objects.get(0) instanceof CompoundPainting);

        for (Iterator<?> i = objects.iterator(); i.hasNext();) {
            CompoundPainting painting = (CompoundPainting) i.next();
            assertEquals(PersistenceState.COMMITTED, painting.getPersistenceState());

            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getArtistName(),
                    "artist2",
                    painting.getArtistName());
            assertEquals(
                    "CompoundPainting.getArtistName(): " + painting.getGalleryName(),
                    painting.getToGallery().getGalleryName(),
                    painting.getGalleryName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.testmap.CompoundPainting

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.