cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1566113 - in /cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access: DataContextDisjointByIdPrefetchTest.java DataContextDisjointByIdPrefetch_ExtrasTest.java
Date Sat, 08 Feb 2014 19:59:11 GMT
Author: aadamchik
Date: Sat Feb  8 19:59:11 2014
New Revision: 1566113

URL: http://svn.apache.org/r1566113
Log:
failing SQLServer unit tests

    replacing with entities that don't use autoincrement...
    autoincrement PK is irrelevant for the test at hand

    where we can't, using Cayenne to INSERT new objects

Added:
    cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetch_ExtrasTest.java
      - copied, changed from r1566066, cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java
Modified:
    cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java

Modified: cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java?rev=1566113&r1=1566112&r2=1566113&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java
(original)
+++ cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java
Sat Feb  8 19:59:11 2014
@@ -18,8 +18,7 @@
  ****************************************************************/
 package org.apache.cayenne.access;
 
-import static org.apache.cayenne.exp.ExpressionFactory.matchExp;
-
+import java.sql.Types;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -32,11 +31,9 @@ import org.apache.cayenne.query.SelectQu
 import org.apache.cayenne.query.SortOrder;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
-import org.apache.cayenne.testdo.testmap.Bag;
-import org.apache.cayenne.testdo.testmap.Ball;
-import org.apache.cayenne.testdo.testmap.Box;
-import org.apache.cayenne.testdo.testmap.BoxInfo;
-import org.apache.cayenne.testdo.testmap.Thing;
+import org.apache.cayenne.testdo.testmap.Artist;
+import org.apache.cayenne.testdo.testmap.Painting;
+import org.apache.cayenne.testdo.testmap.PaintingInfo;
 import org.apache.cayenne.unit.di.DataChannelInterceptor;
 import org.apache.cayenne.unit.di.UnitTestClosure;
 import org.apache.cayenne.unit.di.server.ServerCase;
@@ -54,165 +51,128 @@ public class DataContextDisjointByIdPref
     @Inject
     protected DataChannelInterceptor queryInterceptor;
 
-    protected TableHelper tBag;
-    protected TableHelper tBox;
-    protected TableHelper tBoxInfo;
-    protected TableHelper tBall;
-    protected TableHelper tThing;
-    protected TableHelper tBoxThing;
+    private TableHelper tArtist;
+    private TableHelper tPainting;
+    private TableHelper tPaintingInfo;
 
     @Override
     protected void setUpAfterInjection() throws Exception {
-        dbHelper.deleteAll("BALL");
-        dbHelper.deleteAll("BOX_THING");
-        dbHelper.deleteAll("THING");
-        dbHelper.deleteAll("BOX_INFO");
-        dbHelper.deleteAll("BOX");
-        dbHelper.deleteAll("BAG");
-
-        tBag = new TableHelper(dbHelper, "BAG");
-        tBag.setColumns("ID", "NAME");
-
-        tBox = new TableHelper(dbHelper, "BOX");
-        tBox.setColumns("ID", "BAG_ID", "NAME");
-
-        tBoxInfo = new TableHelper(dbHelper, "BOX_INFO");
-        tBoxInfo.setColumns("ID", "BOX_ID", "COLOR");
+        dbHelper.deleteAll("PAINTING_INFO");
+        dbHelper.deleteAll("PAINTING");
+        dbHelper.deleteAll("ARTIST_EXHIBIT");
+        dbHelper.deleteAll("ARTIST_GROUP");
+        dbHelper.deleteAll("ARTIST");
 
-        tBall = new TableHelper(dbHelper, "BALL");
-        tBall.setColumns("ID", "BOX_ID", "THING_WEIGHT", "THING_VOLUME");
+        tArtist = new TableHelper(dbHelper, "ARTIST");
+        tArtist.setColumns("ARTIST_ID", "ARTIST_NAME");
 
-        tThing = new TableHelper(dbHelper, "THING");
-        tThing.setColumns("ID", "WEIGHT", "VOLUME");
+        tPainting = new TableHelper(dbHelper, "PAINTING");
+        tPainting.setColumns("PAINTING_ID", "ARTIST_ID", "PAINTING_TITLE").setColumnTypes(Types.INTEGER,
Types.BIGINT,
+                Types.VARCHAR);
 
-        tBoxThing = new TableHelper(dbHelper, "BOX_THING");
-        tBoxThing.setColumns("BOX_ID", "THING_WEIGHT", "THING_VOLUME");
+        tPaintingInfo = new TableHelper(dbHelper, "PAINTING_INFO");
+        tPaintingInfo.setColumns("PAINTING_ID", "TEXT_REVIEW");
     }
 
-    private void createBagWithTwoBoxesDataSet() throws Exception {
-        tBag.insert(1, "X");
-        tBox.insert(1, 1, "Y");
-        tBox.insert(2, 1, "Z");
+    private void createArtistWithTwoPaintingsDataSet() throws Exception {
+        tArtist.insert(1, "X");
+
+        for (int i = 1; i <= 2; i++) {
+            tPainting.insert(i, 1, "Y" + i);
+        }
     }
 
-    private void createThreeBagsWithPlentyOfBoxesDataSet() throws Exception {
-        tBag.insert(1, "bag1");
-        tBag.insert(2, "bag2");
-        tBag.insert(3, "bag3");
-
-        tBox.insert(1, 1, "box1");
-        tBox.insert(2, 1, "box2");
-        tBox.insert(3, 1, "box3");
-        tBox.insert(4, 1, "box4");
-        tBox.insert(5, 1, "box5");
-
-        tBox.insert(6, 2, "box6");
-        tBox.insert(7, 2, "box7");
-
-        tBox.insert(8, 3, "box8");
-        tBox.insert(9, 3, "box9");
-        tBox.insert(10, 3, "box10");
+    private void createThreeArtistsWithPlentyOfPaintingsDataSet() throws Exception {
+        tArtist.insert(1, "bag1");
+        tArtist.insert(2, "bag2");
+        tArtist.insert(3, "bag3");
+
+        tPainting.insert(1, 1, "box1");
+        tPainting.insert(2, 1, "box2");
+        tPainting.insert(3, 1, "box3");
+        tPainting.insert(4, 1, "box4");
+        tPainting.insert(5, 1, "box5");
+
+        tPainting.insert(6, 2, "box6");
+        tPainting.insert(7, 2, "box7");
+
+        tPainting.insert(8, 3, "box8");
+        tPainting.insert(9, 3, "box9");
+        tPainting.insert(10, 3, "box10");
     }
 
-    private void createBagWithTwoBoxesAndPlentyOfBallsDataSet() throws Exception {
-        tBag.insert(1, "bag1");
-        tBox.insert(1, 1, "big");
-        tBoxInfo.insert(1, 1, "red");
-        tBox.insert(2, 1, "small");
-        tBoxInfo.insert(2, 2, "green");
-
-        tThing.insert(1, 10, 10);
-        tBoxThing.insert(1, 10, 10);
-        tBall.insert(1, 1, 10, 10);
-
-        tThing.insert(2, 20, 20);
-        tBoxThing.insert(1, 20, 20);
-        tBall.insert(2, 1, 20, 20);
-
-        tThing.insert(3, 30, 30);
-        tBoxThing.insert(2, 30, 30);
-        tBall.insert(3, 2, 30, 30);
-
-        tThing.insert(4, 40, 40);
-        tBoxThing.insert(2, 40, 40);
-        tBall.insert(4, 2, 40, 40);
-
-        tThing.insert(5, 10, 20);
-        tBoxThing.insert(2, 10, 20);
-        tBall.insert(5, 2, 10, 20);
-
-        tThing.insert(6, 30, 40);
-        tBoxThing.insert(2, 30, 40);
-        tBall.insert(6, 2, 30, 40);
+    private void createTwoPaintingsWithInfosDataSet() throws Exception {
+        tArtist.insert(1, "bag1");
+
+        tPainting.insert(1, 1, "big");
+        tPaintingInfo.insert(1, "red");
+        tPainting.insert(2, 1, "small");
+        tPaintingInfo.insert(2, "green");
     }
 
     public void testOneToMany() throws Exception {
-        createBagWithTwoBoxesDataSet();
+        createArtistWithTwoPaintingsDataSet();
 
-        SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
+        SelectQuery query = new SelectQuery(Artist.class);
+        query.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY).setSemantics(
                 PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
 
-        final List<Bag> result = context.performQuery(query);
+        final List<Artist> result = context.performQuery(query);
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
             public void execute() {
                 assertFalse(result.isEmpty());
-                Bag b1 = result.get(0);
-                List<Box> toMany = (List<Box>) b1
-                        .readPropertyDirectly(Bag.BOXES_PROPERTY);
+                Artist b1 = result.get(0);
+                List<Painting> toMany = (List<Painting>) b1.readPropertyDirectly(Artist.PAINTING_ARRAY_PROPERTY);
                 assertNotNull(toMany);
                 assertFalse(((ValueHolder) toMany).isFault());
                 assertEquals(2, toMany.size());
 
                 List<String> names = new ArrayList<String>();
-                for (Box b : toMany) {
+                for (Painting b : toMany) {
                     assertEquals(PersistenceState.COMMITTED, b.getPersistenceState());
-                    names.add(b.getName());
+                    names.add(b.getPaintingTitle());
                 }
 
-                assertTrue(names.contains("Y"));
-                assertTrue(names.contains("Z"));
+                assertTrue(names.contains("Y1"));
+                assertTrue(names.contains("Y2"));
             }
         });
     }
 
     public void testManyToOne() throws Exception {
-        createBagWithTwoBoxesDataSet();
+        createArtistWithTwoPaintingsDataSet();
 
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BAG_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        SelectQuery query = new SelectQuery(Painting.class);
+        query.addPrefetch(Painting.TO_ARTIST_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
 
-        final List<Box> result = context.performQuery(query);
+        final List<Painting> result = context.performQuery(query);
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
             public void execute() {
                 assertFalse(result.isEmpty());
-                Box b1 = result.get(0);
-                assertNotNull(b1.getBag());
-                assertEquals(PersistenceState.COMMITTED, b1
-                        .getBag()
-                        .getPersistenceState());
-                assertEquals("X", b1.getBag().getName());
+                Painting b1 = result.get(0);
+                assertNotNull(b1.getToArtist());
+                assertEquals(PersistenceState.COMMITTED, b1.getToArtist().getPersistenceState());
+                assertEquals("X", b1.getToArtist().getArtistName());
             }
         });
     }
 
     public void testFetchLimit() throws Exception {
-        createThreeBagsWithPlentyOfBoxesDataSet();
+        createThreeArtistsWithPlentyOfPaintingsDataSet();
 
-        final SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
+        final SelectQuery query = new SelectQuery(Artist.class);
+        query.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY).setSemantics(
                 PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        query.addOrdering("db:" + Bag.ID_PK_COLUMN, SortOrder.ASCENDING);
+        query.addOrdering("db:" + Artist.ARTIST_ID_PK_COLUMN, SortOrder.ASCENDING);
 
         query.setFetchLimit(2);
 
         // There will be only 2 bags in a result. The first bag has 5 boxes and
         // the second has 2. So we are expecting exactly 9 snapshots in the data
         // row store after performing the query.
-        final List<Bag> bags = context.performQuery(query);
+        final List<Artist> bags = context.performQuery(query);
 
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
@@ -220,13 +180,13 @@ public class DataContextDisjointByIdPref
 
                 assertEquals(2, bags.size());
 
-                assertEquals(5, bags.get(0).getBoxes().size());
-                assertEquals(2, bags.get(1).getBoxes().size());
+                assertEquals(5, bags.get(0).getPaintingArray().size());
+                assertEquals(2, bags.get(1).getPaintingArray().size());
 
-                for (Bag b : bags) {
-                    b.getName();
-                    for (Box bx : b.getBoxes()) {
-                        bx.getName();
+                for (Artist b : bags) {
+                    b.getArtistName();
+                    for (Painting bx : b.getPaintingArray()) {
+                        bx.getPaintingTitle();
                     }
                 }
             }
@@ -234,22 +194,21 @@ public class DataContextDisjointByIdPref
     }
 
     public void testOneToOneRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
+        createTwoPaintingsWithInfosDataSet();
 
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BOX_INFO_PROPERTY).setSemantics(
+        SelectQuery query = new SelectQuery(Painting.class);
+        query.addPrefetch(Painting.TO_PAINTING_INFO_PROPERTY).setSemantics(
                 PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Box> result = context.performQuery(query);
+        final List<Painting> result = context.performQuery(query);
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
             public void execute() {
                 assertFalse(result.isEmpty());
                 List<String> boxColors = new ArrayList<String>();
-                for (Box box : result) {
-                    BoxInfo info = (BoxInfo) box
-                            .readPropertyDirectly(Box.BOX_INFO_PROPERTY);
+                for (Painting box : result) {
+                    PaintingInfo info = (PaintingInfo) box.readPropertyDirectly(Painting.TO_PAINTING_INFO_PROPERTY);
                     assertNotNull(info);
-                    boxColors.add(info.getColor());
+                    boxColors.add(info.getTextReview());
                     assertEquals(PersistenceState.COMMITTED, info.getPersistenceState());
                 }
                 assertTrue(boxColors.containsAll(Arrays.asList("red", "green")));
@@ -257,202 +216,4 @@ public class DataContextDisjointByIdPref
         });
     }
 
-    public void testFlattenedRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BALLS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Bag> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                Bag b1 = result.get(0);
-                List<Ball> balls = (List<Ball>) b1
-                        .readPropertyDirectly(Bag.BALLS_PROPERTY);
-                assertNotNull(balls);
-                assertFalse(((ValueHolder) balls).isFault());
-                assertEquals(6, balls.size());
-
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Ball b : balls) {
-                    assertEquals(PersistenceState.COMMITTED, b.getPersistenceState());
-                    volumes.add(b.getThingVolume());
-                }
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40, 20, 40)));
-            }
-        });
-    }
-
-    public void testLongFlattenedRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.THINGS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Bag> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                Bag b1 = result.get(0);
-                List<Thing> things = (List<Thing>) b1
-                        .readPropertyDirectly(Bag.THINGS_PROPERTY);
-                assertNotNull(things);
-                assertFalse(((ValueHolder) things).isFault());
-                assertEquals(6, things.size());
-
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Thing t : things) {
-                    assertEquals(PersistenceState.COMMITTED, t.getPersistenceState());
-                    volumes.add(t.getVolume());
-                }
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 20, 30, 40, 40)));
-            }
-        });
-    }
-
-    public void testMultiColumnRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Ball.class);
-        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 40).andExp(
-                matchExp(Ball.THING_WEIGHT_PROPERTY, 30)));
-        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 20).andExp(
-                matchExp(Ball.THING_WEIGHT_PROPERTY, 10)));
-
-        query.addPrefetch(Ball.THING_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-
-        final List<Ball> balls = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-
-                assertEquals(2, balls.size());
-
-              balls.get(0).getThing().getVolume();
-              balls.get(1).getThing().getVolume();
-            }
-        });
-    }
-
-    public void testFlattenedMultiColumnRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.THINGS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Box> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Box box : result) {
-                    List<Thing> things = (List<Thing>) box
-                            .readPropertyDirectly(Box.THINGS_PROPERTY);
-                    assertNotNull(things);
-                    assertFalse(((ValueHolder) things).isFault());
-                    for (Thing t : things) {
-                        assertEquals(PersistenceState.COMMITTED, t.getPersistenceState());
-                        volumes.add(t.getVolume());
-                    }
-                }
-                assertEquals(6, volumes.size());
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40)));
-            }
-        });
-    }
-
-    public void testJointPrefetchInParent() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BALLS_PROPERTY).setSemantics(
-                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
-        query.addPrefetch(Box.BALLS_PROPERTY + "." + Ball.THING_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Box> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Box box : result) {
-                    List<Ball> balls = (List<Ball>) box
-                            .readPropertyDirectly(Box.BALLS_PROPERTY);
-                    assertNotNull(balls);
-                    assertFalse(((ValueHolder) balls).isFault());
-                    for (Ball ball : balls) {
-                        Thing thing = (Thing) ball
-                                .readPropertyDirectly(Ball.THING_PROPERTY);
-                        assertNotNull(thing);
-                        assertEquals(
-                                PersistenceState.COMMITTED,
-                                thing.getPersistenceState());
-                        volumes.add(thing.getVolume());
-                    }
-                }
-                assertEquals(6, volumes.size());
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40)));
-            }
-        });
-    }
-
-    public void testJointPrefetchInChild() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        query.addPrefetch(Bag.BOXES_PROPERTY + "." + Box.BALLS_PROPERTY).setSemantics(
-                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
-        final List<Bag> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-
-                Bag bag = result.get(0);
-                List<Box> boxes = (List<Box>) bag
-                        .readPropertyDirectly(Bag.BOXES_PROPERTY);
-                assertNotNull(boxes);
-                assertFalse(((ValueHolder) boxes).isFault());
-                assertEquals(2, boxes.size());
-
-                Box big = null;
-                List<String> names = new ArrayList<String>();
-                for (Box box : boxes) {
-                    assertEquals(PersistenceState.COMMITTED, box.getPersistenceState());
-                    names.add(box.getName());
-                    if (box.getName().equals("big")) {
-                        big = box;
-                    }
-                }
-                assertTrue(names.contains("big"));
-                assertTrue(names.contains("small"));
-
-                
-                List<Ball> balls = (List<Ball>) big
-                        .readPropertyDirectly(Box.BALLS_PROPERTY);
-                assertNotNull(balls);
-                assertFalse(((ValueHolder) balls).isFault());
-                assertEquals(2, balls.size());
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Ball ball : balls) {
-                    assertEquals(PersistenceState.COMMITTED, ball.getPersistenceState());
-                    volumes.add(ball.getThingVolume());
-                }
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20)));
-            }
-        });
-    }
 }

Copied: cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetch_ExtrasTest.java
(from r1566066, cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java)
URL: http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetch_ExtrasTest.java?p2=cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetch_ExtrasTest.java&p1=cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java&r1=1566066&r2=1566113&rev=1566113&view=diff
==============================================================================
--- cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetchTest.java
(original)
+++ cayenne/main/branches/STABLE-3.1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextDisjointByIdPrefetch_ExtrasTest.java
Sat Feb  8 19:59:11 2014
@@ -22,14 +22,17 @@ import static org.apache.cayenne.exp.Exp
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 
+import org.apache.cayenne.Cayenne;
+import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.ValueHolder;
+import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.PrefetchTreeNode;
 import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.query.SortOrder;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.testmap.Bag;
@@ -43,12 +46,15 @@ import org.apache.cayenne.unit.di.server
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
 
 @UseServerRuntime(ServerCase.TESTMAP_PROJECT)
-public class DataContextDisjointByIdPrefetchTest extends ServerCase {
+public class DataContextDisjointByIdPrefetch_ExtrasTest extends ServerCase {
 
     @Inject
     protected DataContext context;
 
     @Inject
+    private ServerRuntime runtime;
+
+    @Inject
     protected DBHelper dbHelper;
 
     @Inject
@@ -70,218 +76,171 @@ public class DataContextDisjointByIdPref
         dbHelper.deleteAll("BOX");
         dbHelper.deleteAll("BAG");
 
-        tBag = new TableHelper(dbHelper, "BAG");
-        tBag.setColumns("ID", "NAME");
-
-        tBox = new TableHelper(dbHelper, "BOX");
-        tBox.setColumns("ID", "BAG_ID", "NAME");
-
-        tBoxInfo = new TableHelper(dbHelper, "BOX_INFO");
-        tBoxInfo.setColumns("ID", "BOX_ID", "COLOR");
-
-        tBall = new TableHelper(dbHelper, "BALL");
-        tBall.setColumns("ID", "BOX_ID", "THING_WEIGHT", "THING_VOLUME");
-
-        tThing = new TableHelper(dbHelper, "THING");
-        tThing.setColumns("ID", "WEIGHT", "VOLUME");
-
         tBoxThing = new TableHelper(dbHelper, "BOX_THING");
         tBoxThing.setColumns("BOX_ID", "THING_WEIGHT", "THING_VOLUME");
     }
 
-    private void createBagWithTwoBoxesDataSet() throws Exception {
-        tBag.insert(1, "X");
-        tBox.insert(1, 1, "Y");
-        tBox.insert(2, 1, "Z");
-    }
+    private void createBagWithTwoBoxesAndPlentyOfBallsDataSet() throws Exception {
 
-    private void createThreeBagsWithPlentyOfBoxesDataSet() throws Exception {
-        tBag.insert(1, "bag1");
-        tBag.insert(2, "bag2");
-        tBag.insert(3, "bag3");
-
-        tBox.insert(1, 1, "box1");
-        tBox.insert(2, 1, "box2");
-        tBox.insert(3, 1, "box3");
-        tBox.insert(4, 1, "box4");
-        tBox.insert(5, 1, "box5");
-
-        tBox.insert(6, 2, "box6");
-        tBox.insert(7, 2, "box7");
-
-        tBox.insert(8, 3, "box8");
-        tBox.insert(9, 3, "box9");
-        tBox.insert(10, 3, "box10");
-    }
+        // because of SQLServer need to enable identity inserts per transaction,
+        // inserting these objects via Cayenne, and then flushing the cache
+        // http://technet.microsoft.com/en-us/library/ms188059.aspx
+
+        Collection<Object> invalidate = new ArrayList<Object>();
+        ObjectContext context = runtime.getContext();
+
+        Bag b1 = context.newObject(Bag.class);
+        invalidate.add(b1);
+        b1.setName("b1");
+
+        Box bx1 = context.newObject(Box.class);
+        invalidate.add(bx1);
+        bx1.setName("big");
+        bx1.setBag(b1);
+
+        BoxInfo bi1 = context.newObject(BoxInfo.class);
+        invalidate.add(bi1);
+        bi1.setColor("red");
+        bi1.setBox(bx1);
+
+        Box bx2 = context.newObject(Box.class);
+        invalidate.add(bx2);
+        bx2.setName("small");
+        bx2.setBag(b1);
+
+        BoxInfo bi2 = context.newObject(BoxInfo.class);
+        invalidate.add(bi2);
+        bi2.setColor("green");
+        bi2.setBox(bx2);
+
+        Thing t1 = context.newObject(Thing.class);
+        invalidate.add(t1);
+        t1.setVolume(10);
+        t1.setWeight(10);
+
+        Ball bl1 = context.newObject(Ball.class);
+        invalidate.add(bl1);
+        bl1.setBox(bx1);
+        bl1.setThingVolume(10);
+        bl1.setThingWeight(10);
+
+        Thing t2 = context.newObject(Thing.class);
+        invalidate.add(t2);
+        t2.setVolume(20);
+        t2.setWeight(20);
+
+        Ball bl2 = context.newObject(Ball.class);
+        invalidate.add(bl2);
+        bl2.setBox(bx1);
+        bl2.setThingVolume(20);
+        bl2.setThingWeight(20);
+
+        Thing t3 = context.newObject(Thing.class);
+        invalidate.add(t3);
+        t3.setVolume(30);
+        t3.setWeight(30);
+
+        Ball bl3 = context.newObject(Ball.class);
+        invalidate.add(bl3);
+        bl3.setBox(bx2);
+        bl3.setThingVolume(30);
+        bl3.setThingWeight(30);
+
+        Thing t4 = context.newObject(Thing.class);
+        invalidate.add(t4);
+        t4.setVolume(40);
+        t4.setWeight(40);
+
+        Ball bl4 = context.newObject(Ball.class);
+        invalidate.add(bl4);
+        bl4.setBox(bx2);
+        bl4.setThingVolume(40);
+        bl4.setThingWeight(40);
+
+        Thing t5 = context.newObject(Thing.class);
+        invalidate.add(t5);
+        t5.setVolume(20);
+        t5.setWeight(10);
+
+        Ball bl5 = context.newObject(Ball.class);
+        invalidate.add(bl5);
+        bl5.setBox(bx2);
+        bl5.setThingVolume(20);
+        bl5.setThingWeight(10);
+
+        Thing t6 = context.newObject(Thing.class);
+        invalidate.add(t6);
+        t6.setVolume(40);
+        t6.setWeight(30);
+
+        Ball bl6 = context.newObject(Ball.class);
+        invalidate.add(bl6);
+        bl6.setBox(bx2);
+        bl6.setThingVolume(40);
+        bl6.setThingWeight(30);
+
+        context.commitChanges();
+
+        tBoxThing.insert(Cayenne.intPKForObject(bx1), t1.getWeight(), t1.getVolume());
+        tBoxThing.insert(Cayenne.intPKForObject(bx1), t2.getWeight(), t2.getVolume());
+        tBoxThing.insert(Cayenne.intPKForObject(bx2), t3.getWeight(), t3.getVolume());
+        tBoxThing.insert(Cayenne.intPKForObject(bx1), t4.getWeight(), t4.getVolume());
+        tBoxThing.insert(Cayenne.intPKForObject(bx1), t5.getWeight(), t5.getVolume());
+        tBoxThing.insert(Cayenne.intPKForObject(bx1), t6.getWeight(), t6.getVolume());
 
-    private void createBagWithTwoBoxesAndPlentyOfBallsDataSet() throws Exception {
-        tBag.insert(1, "bag1");
-        tBox.insert(1, 1, "big");
-        tBoxInfo.insert(1, 1, "red");
-        tBox.insert(2, 1, "small");
-        tBoxInfo.insert(2, 2, "green");
-
-        tThing.insert(1, 10, 10);
-        tBoxThing.insert(1, 10, 10);
-        tBall.insert(1, 1, 10, 10);
-
-        tThing.insert(2, 20, 20);
-        tBoxThing.insert(1, 20, 20);
-        tBall.insert(2, 1, 20, 20);
-
-        tThing.insert(3, 30, 30);
-        tBoxThing.insert(2, 30, 30);
-        tBall.insert(3, 2, 30, 30);
-
-        tThing.insert(4, 40, 40);
-        tBoxThing.insert(2, 40, 40);
-        tBall.insert(4, 2, 40, 40);
-
-        tThing.insert(5, 10, 20);
-        tBoxThing.insert(2, 10, 20);
-        tBall.insert(5, 2, 10, 20);
-
-        tThing.insert(6, 30, 40);
-        tBoxThing.insert(2, 30, 40);
-        tBall.insert(6, 2, 30, 40);
+        context.invalidateObjects(invalidate);
     }
 
-    public void testOneToMany() throws Exception {
-        createBagWithTwoBoxesDataSet();
+    public void testFlattenedRelationship() throws Exception {
+        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-
+        query.addPrefetch(Bag.BALLS_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
         final List<Bag> result = context.performQuery(query);
+
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
             public void execute() {
                 assertFalse(result.isEmpty());
                 Bag b1 = result.get(0);
-                List<Box> toMany = (List<Box>) b1
-                        .readPropertyDirectly(Bag.BOXES_PROPERTY);
-                assertNotNull(toMany);
-                assertFalse(((ValueHolder) toMany).isFault());
-                assertEquals(2, toMany.size());
+                List<Ball> balls = (List<Ball>) b1.readPropertyDirectly(Bag.BALLS_PROPERTY);
+                assertNotNull(balls);
+                assertFalse(((ValueHolder) balls).isFault());
+                assertEquals(6, balls.size());
 
-                List<String> names = new ArrayList<String>();
-                for (Box b : toMany) {
+                List<Integer> volumes = new ArrayList<Integer>();
+                for (Ball b : balls) {
                     assertEquals(PersistenceState.COMMITTED, b.getPersistenceState());
-                    names.add(b.getName());
-                }
-
-                assertTrue(names.contains("Y"));
-                assertTrue(names.contains("Z"));
-            }
-        });
-    }
-
-    public void testManyToOne() throws Exception {
-        createBagWithTwoBoxesDataSet();
-
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BAG_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-
-        final List<Box> result = context.performQuery(query);
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                Box b1 = result.get(0);
-                assertNotNull(b1.getBag());
-                assertEquals(PersistenceState.COMMITTED, b1
-                        .getBag()
-                        .getPersistenceState());
-                assertEquals("X", b1.getBag().getName());
-            }
-        });
-    }
-
-    public void testFetchLimit() throws Exception {
-        createThreeBagsWithPlentyOfBoxesDataSet();
-
-        final SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        query.addOrdering("db:" + Bag.ID_PK_COLUMN, SortOrder.ASCENDING);
-
-        query.setFetchLimit(2);
-
-        // There will be only 2 bags in a result. The first bag has 5 boxes and
-        // the second has 2. So we are expecting exactly 9 snapshots in the data
-        // row store after performing the query.
-        final List<Bag> bags = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-
-                assertEquals(2, bags.size());
-
-                assertEquals(5, bags.get(0).getBoxes().size());
-                assertEquals(2, bags.get(1).getBoxes().size());
-
-                for (Bag b : bags) {
-                    b.getName();
-                    for (Box bx : b.getBoxes()) {
-                        bx.getName();
-                    }
+                    volumes.add(b.getThingVolume());
                 }
+                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40, 20, 40)));
             }
         });
     }
 
-    public void testOneToOneRelationship() throws Exception {
+    public void testFlattenedMultiColumnRelationship() throws Exception {
         createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BOX_INFO_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        query.addPrefetch(Box.THINGS_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
         final List<Box> result = context.performQuery(query);
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                List<String> boxColors = new ArrayList<String>();
-                for (Box box : result) {
-                    BoxInfo info = (BoxInfo) box
-                            .readPropertyDirectly(Box.BOX_INFO_PROPERTY);
-                    assertNotNull(info);
-                    boxColors.add(info.getColor());
-                    assertEquals(PersistenceState.COMMITTED, info.getPersistenceState());
-                }
-                assertTrue(boxColors.containsAll(Arrays.asList("red", "green")));
-            }
-        });
-    }
-
-    public void testFlattenedRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BALLS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Bag> result = context.performQuery(query);
 
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
 
             public void execute() {
                 assertFalse(result.isEmpty());
-                Bag b1 = result.get(0);
-                List<Ball> balls = (List<Ball>) b1
-                        .readPropertyDirectly(Bag.BALLS_PROPERTY);
-                assertNotNull(balls);
-                assertFalse(((ValueHolder) balls).isFault());
-                assertEquals(6, balls.size());
-
                 List<Integer> volumes = new ArrayList<Integer>();
-                for (Ball b : balls) {
-                    assertEquals(PersistenceState.COMMITTED, b.getPersistenceState());
-                    volumes.add(b.getThingVolume());
+                for (Box box : result) {
+                    List<Thing> things = (List<Thing>) box.readPropertyDirectly(Box.THINGS_PROPERTY);
+                    assertNotNull(things);
+                    assertFalse(((ValueHolder) things).isFault());
+                    for (Thing t : things) {
+                        assertEquals(PersistenceState.COMMITTED, t.getPersistenceState());
+                        volumes.add(t.getVolume());
+                    }
                 }
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40, 20, 40)));
+                assertEquals(6, volumes.size());
+                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40)));
             }
         });
     }
@@ -290,8 +249,7 @@ public class DataContextDisjointByIdPref
         createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.THINGS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        query.addPrefetch(Bag.THINGS_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
         final List<Bag> result = context.performQuery(query);
 
         queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
@@ -299,8 +257,7 @@ public class DataContextDisjointByIdPref
             public void execute() {
                 assertFalse(result.isEmpty());
                 Bag b1 = result.get(0);
-                List<Thing> things = (List<Thing>) b1
-                        .readPropertyDirectly(Bag.THINGS_PROPERTY);
+                List<Thing> things = (List<Thing>) b1.readPropertyDirectly(Bag.THINGS_PROPERTY);
                 assertNotNull(things);
                 assertFalse(((ValueHolder) things).isFault());
                 assertEquals(6, things.size());
@@ -319,13 +276,10 @@ public class DataContextDisjointByIdPref
         createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Ball.class);
-        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 40).andExp(
-                matchExp(Ball.THING_WEIGHT_PROPERTY, 30)));
-        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 20).andExp(
-                matchExp(Ball.THING_WEIGHT_PROPERTY, 10)));
+        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 40).andExp(matchExp(Ball.THING_WEIGHT_PROPERTY,
30)));
+        query.orQualifier(matchExp(Ball.THING_VOLUME_PROPERTY, 20).andExp(matchExp(Ball.THING_WEIGHT_PROPERTY,
10)));
 
-        query.addPrefetch(Ball.THING_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        query.addPrefetch(Ball.THING_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
 
         final List<Ball> balls = context.performQuery(query);
 
@@ -335,37 +289,8 @@ public class DataContextDisjointByIdPref
 
                 assertEquals(2, balls.size());
 
-              balls.get(0).getThing().getVolume();
-              balls.get(1).getThing().getVolume();
-            }
-        });
-    }
-
-    public void testFlattenedMultiColumnRelationship() throws Exception {
-        createBagWithTwoBoxesAndPlentyOfBallsDataSet();
-
-        SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.THINGS_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
-        final List<Box> result = context.performQuery(query);
-
-        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
-
-            public void execute() {
-                assertFalse(result.isEmpty());
-                List<Integer> volumes = new ArrayList<Integer>();
-                for (Box box : result) {
-                    List<Thing> things = (List<Thing>) box
-                            .readPropertyDirectly(Box.THINGS_PROPERTY);
-                    assertNotNull(things);
-                    assertFalse(((ValueHolder) things).isFault());
-                    for (Thing t : things) {
-                        assertEquals(PersistenceState.COMMITTED, t.getPersistenceState());
-                        volumes.add(t.getVolume());
-                    }
-                }
-                assertEquals(6, volumes.size());
-                assertTrue(volumes.containsAll(Arrays.asList(10, 20, 30, 40)));
+                balls.get(0).getThing().getVolume();
+                balls.get(1).getThing().getVolume();
             }
         });
     }
@@ -374,8 +299,7 @@ public class DataContextDisjointByIdPref
         createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Box.class);
-        query.addPrefetch(Box.BALLS_PROPERTY).setSemantics(
-                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
+        query.addPrefetch(Box.BALLS_PROPERTY).setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
         query.addPrefetch(Box.BALLS_PROPERTY + "." + Ball.THING_PROPERTY).setSemantics(
                 PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
         final List<Box> result = context.performQuery(query);
@@ -386,17 +310,13 @@ public class DataContextDisjointByIdPref
                 assertFalse(result.isEmpty());
                 List<Integer> volumes = new ArrayList<Integer>();
                 for (Box box : result) {
-                    List<Ball> balls = (List<Ball>) box
-                            .readPropertyDirectly(Box.BALLS_PROPERTY);
+                    List<Ball> balls = (List<Ball>) box.readPropertyDirectly(Box.BALLS_PROPERTY);
                     assertNotNull(balls);
                     assertFalse(((ValueHolder) balls).isFault());
                     for (Ball ball : balls) {
-                        Thing thing = (Thing) ball
-                                .readPropertyDirectly(Ball.THING_PROPERTY);
+                        Thing thing = (Thing) ball.readPropertyDirectly(Ball.THING_PROPERTY);
                         assertNotNull(thing);
-                        assertEquals(
-                                PersistenceState.COMMITTED,
-                                thing.getPersistenceState());
+                        assertEquals(PersistenceState.COMMITTED, thing.getPersistenceState());
                         volumes.add(thing.getVolume());
                     }
                 }
@@ -410,8 +330,7 @@ public class DataContextDisjointByIdPref
         createBagWithTwoBoxesAndPlentyOfBallsDataSet();
 
         SelectQuery query = new SelectQuery(Bag.class);
-        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(
-                PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
+        query.addPrefetch(Bag.BOXES_PROPERTY).setSemantics(PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS);
         query.addPrefetch(Bag.BOXES_PROPERTY + "." + Box.BALLS_PROPERTY).setSemantics(
                 PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
         final List<Bag> result = context.performQuery(query);
@@ -422,8 +341,7 @@ public class DataContextDisjointByIdPref
                 assertFalse(result.isEmpty());
 
                 Bag bag = result.get(0);
-                List<Box> boxes = (List<Box>) bag
-                        .readPropertyDirectly(Bag.BOXES_PROPERTY);
+                List<Box> boxes = (List<Box>) bag.readPropertyDirectly(Bag.BOXES_PROPERTY);
                 assertNotNull(boxes);
                 assertFalse(((ValueHolder) boxes).isFault());
                 assertEquals(2, boxes.size());
@@ -440,9 +358,7 @@ public class DataContextDisjointByIdPref
                 assertTrue(names.contains("big"));
                 assertTrue(names.contains("small"));
 
-                
-                List<Ball> balls = (List<Ball>) big
-                        .readPropertyDirectly(Box.BALLS_PROPERTY);
+                List<Ball> balls = (List<Ball>) big.readPropertyDirectly(Box.BALLS_PROPERTY);
                 assertNotNull(balls);
                 assertFalse(((ValueHolder) balls).isFault());
                 assertEquals(2, balls.size());



Mime
View raw message