cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From and...@apache.org
Subject svn commit: r755516 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/util/ test/java/org/apache/cayenne/access/ test/java/org/apache/cayenne/remote/ test/java/org/apach...
Date Wed, 18 Mar 2009 09:03:48 GMT
Author: andrey
Date: Wed Mar 18 09:03:47 2009
New Revision: 755516

URL: http://svn.apache.org/viewvc?rev=755516&view=rev
Log:
CAY-1194 problems with relationships when using nested contexts and ROP
fix & tests & ToManyList refactoring

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
  (contents, props changed)
      - copied, changed from r754880, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ToManyListTest.java
Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ToManyListTest.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToManyList.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/NestedDataContextWriteTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/NestedObjectContextTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToManyList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToManyList.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToManyList.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToManyList.java
Wed Mar 18 09:03:47 2009
@@ -21,16 +21,12 @@
 
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.ListIterator;
 
-import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.Persistent;
-import org.apache.cayenne.ValueHolder;
-import org.apache.cayenne.query.RelationshipQuery;
+import org.apache.cayenne.util.PersistentObjectList;
 
 /**
  * A list that holds objects for to-many relationships. All operations, except for
@@ -38,17 +34,7 @@
  * synchronization is to synchronize on parent ObjectStore.
  * 
  */
-public class ToManyList implements List, Serializable, ValueHolder {
-
-    private Persistent source;
-    private String relationship;
-
-    // wrapped objects list
-    List objectList;
-
-    // track additions/removals in unresolved...
-    LinkedList addedToUnresolved;
-    LinkedList<Object> removedFromUnresolved;
+public class ToManyList extends PersistentObjectList implements Serializable {
 
     /**
      * Creates ToManyList.
@@ -56,296 +42,40 @@
      * @since 1.1
      */
     public ToManyList(Persistent source, String relationship) {
-        if (source == null) {
-            throw new NullPointerException("'source' can't be null.");
-        }
-
-        if (relationship == null) {
-            throw new NullPointerException("'relationship' can't be null.");
-        }
-
-        this.source = source;
-        this.relationship = relationship;
+        super(source, relationship);
 
         // if source is new, set object list right away
-        if (isTransientSource()) {
+        if (isTransientParent()) {
             objectList = new LinkedList();
         }
     }
 
     /**
-     * @since 1.2
-     */
-    public Persistent getRelationshipOwner() {
-        return source;
-    }
-
-    /**
      * Returns a name of relationship for this list.
      * 
      * @since 1.1
+     * @deprecated use {@link #getRelationshipName()} method
      */
+    @Deprecated
     public String getRelationship() {
-        return relationship;
-    }
-
-    public void setObjectList(List objectList) {
-        this.objectList = objectList;
-    }
-
-    public Object getValue() throws CayenneRuntimeException {
-        return resolvedObjectList();
-    }
-
-    public void invalidate() {
-        this.objectList = null;
-    }
-
-    public boolean isFault() {
-        return objectList == null;
-    }
-
-    public Object getValueDirectly() throws CayenneRuntimeException {
-        return objectList;
-    }
-
-    public Object setValueDirectly(Object value) throws CayenneRuntimeException {
-        if (value == null || value instanceof List) {
-            Object old = this.objectList;
-            setObjectList((List) value);
-            return old;
-        }
-        else {
-            throw new CayenneRuntimeException("Value must be a list, got: "
-                    + value.getClass().getName());
-        }
-    }
-
-    public Object setValue(Object value) throws CayenneRuntimeException {
-        resolvedObjectList();
-        return setValueDirectly(objectList);
+        return getRelationshipName();
     }
 
     // ====================================================
     // Standard List Methods.
     // ====================================================
-    public boolean add(Object o) {
-        return (isFault()) ? addLocal(o) : objectList.add(o);
-    }
-
-    public void add(int index, Object element) {
-        resolvedObjectList().add(index, element);
-    }
-
-    public boolean addAll(Collection c) {
-        return resolvedObjectList().addAll(c);
-    }
-
-    public boolean addAll(int index, Collection c) {
-        return resolvedObjectList().addAll(index, c);
-    }
-
-    public void clear() {
-        resolvedObjectList().clear();
-    }
-
-    public boolean contains(Object o) {
-        return resolvedObjectList().contains(o);
-    }
-
-    public boolean containsAll(Collection c) {
-        return resolvedObjectList().containsAll(c);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-
-        if (!(o instanceof ToManyList)) {
-            return false;
-        }
-
-        return resolvedObjectList().equals(((ToManyList) o).resolvedObjectList());
-    }
-
     @Override
     public int hashCode() {
         return 15 + resolvedObjectList().hashCode();
     }
 
-    public Object get(int index) {
-        return resolvedObjectList().get(index);
-    }
-
-    public int indexOf(Object o) {
-        return resolvedObjectList().indexOf(o);
-    }
-
-    public boolean isEmpty() {
-        return resolvedObjectList().isEmpty();
-    }
-
-    public Iterator iterator() {
-        return resolvedObjectList().iterator();
-    }
-
-    public int lastIndexOf(Object o) {
-        return resolvedObjectList().lastIndexOf(o);
-    }
-
-    public ListIterator listIterator() {
-        return resolvedObjectList().listIterator();
-    }
-
-    public ListIterator listIterator(int index) {
-        return resolvedObjectList().listIterator(index);
-    }
-
-    public Object remove(int index) {
-        return resolvedObjectList().remove(index);
-    }
-
-    public boolean remove(Object o) {
-        return (isFault()) ? removeLocal(o) : objectList.remove(o);
-    }
-
-    public boolean removeAll(Collection c) {
-        return resolvedObjectList().removeAll(c);
-    }
-
-    public boolean retainAll(Collection c) {
-        return resolvedObjectList().retainAll(c);
-    }
-
-    public Object set(int index, Object element) {
-        return resolvedObjectList().set(index, element);
-    }
-
-    public int size() {
-        return resolvedObjectList().size();
-    }
-
-    public List subList(int fromIndex, int toIndex) {
-        return resolvedObjectList().subList(fromIndex, toIndex);
-    }
-
-    public Object[] toArray() {
-        return resolvedObjectList().toArray();
-    }
-
-    public Object[] toArray(Object[] a) {
-        return resolvedObjectList().toArray(a);
-    }
-
     // ====================================================
     // Tracking list modifications, and resolving it
     // on demand
     // ====================================================
 
-    boolean isTransientSource() {
-        int state = source.getPersistenceState();
-        return state == PersistenceState.NEW || state == PersistenceState.TRANSIENT;
-    }
-
-    boolean isUncommittedSource() {
-        int state = source.getPersistenceState();
-        return state == PersistenceState.MODIFIED || state == PersistenceState.DELETED;
-    }
-
-    /**
-     * Returns internal objects list resolving it if needed.
-     */
-    List resolvedObjectList() {
-        if (isFault()) {
-
-            synchronized (this) {
-                // now that we obtained the lock, check
-                // if another thread just resolved the list
-
-                if (isFault()) {
-                    List localList;
-
-                    if (isTransientSource()) {
-                        localList = new LinkedList();
-                    }
-                    else {
-                        localList = source.getObjectContext().performQuery(
-                                new RelationshipQuery(
-                                        source.getObjectId(),
-                                        relationship,
-                                        false));
-                    }
-
-                    mergeLocalChanges(localList);
-                    this.objectList = localList;
-                }
-            }
-        }
-
-        return objectList;
-    }
-
-    void clearLocalChanges() {
-        addedToUnresolved = null;
-        removedFromUnresolved = null;
-    }
-
-    void mergeLocalChanges(List fetchedList) {
-
-        // only merge if an object is in an uncommitted state
-        // any other state means that our local tracking
-        // is invalid...
-        if (isUncommittedSource()) {
-
-            if (removedFromUnresolved != null) {
-                fetchedList.removeAll(removedFromUnresolved);
-            }
-
-            // add only those that are not already on the list
-            // do not include transient objects...
-            if (addedToUnresolved != null && !addedToUnresolved.isEmpty()) {
-                Iterator it = addedToUnresolved.iterator();
-                while (it.hasNext()) {
-                    Object next = it.next();
-
-                    if (next instanceof Persistent) {
-                        Persistent dataObject = (Persistent) next;
-                        if (dataObject.getPersistenceState() == PersistenceState.TRANSIENT)
{
-                            continue;
-                        }
-                    }
-
-                    if (!fetchedList.contains(next)) {
-                        fetchedList.add(next);
-                    }
-                }
-            }
-        }
-
-        // clear local information in any event
-        clearLocalChanges();
-    }
-
-    boolean addLocal(Object object) {
-
-        if (removedFromUnresolved != null) {
-            removedFromUnresolved.remove(object);
-        }
-
-        if (addedToUnresolved == null) {
-            addedToUnresolved = new LinkedList();
-        }
-
-        addedToUnresolved.addLast(object);
-
-        // this is really meaningless, since we don't know
-        // if an object was present in the list
-        return true;
-    }
-
-    boolean removeLocal(Object object) {
+    @Override
+    protected boolean removeLocal(Object object) {
         if (addedToUnresolved != null) {
             addedToUnresolved.remove(object);
         }
@@ -378,4 +108,29 @@
     public String toString() {
         return getClass().getName() + "@" + System.identityHashCode(this);
     }
+    
+    @Override
+    protected void postprocessAdd(Collection collection) {
+        //no need for this operation for DataObjects...
+    }
+
+    @Override
+    protected void postprocessRemove(Collection collection) {
+        //no need for this operation for DataObjects...
+    }
+
+    @Override
+    protected void postprocessAdd(Object addedObject) {
+        //no need for this operation for DataObjects...
+    }
+
+    @Override
+    protected void postprocessRemove(Object removedObject) {
+        //no need for this operation for DataObjects...
+    }
+    
+    @Override
+    protected void updateReverse(List resolved) {
+        //no need for this operation for DataObjects...
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/PersistentObjectList.java
Wed Mar 18 09:03:47 2009
@@ -308,12 +308,12 @@
         return objectList;
     }
 
-    void clearLocalChanges() {
+    protected void clearLocalChanges() {
         addedToUnresolved = null;
         removedFromUnresolved = null;
     }
 
-    void mergeLocalChanges(List fetchedList) {
+    protected void mergeLocalChanges(List fetchedList) {
 
         // only merge if an object is in an uncommitted state
         // any other state means that our local tracking
@@ -349,7 +349,7 @@
         clearLocalChanges();
     }
 
-    boolean addLocal(Object object) {
+    protected boolean addLocal(Object object) {
 
         if (removedFromUnresolved != null) {
             removedFromUnresolved.remove(object);
@@ -366,7 +366,7 @@
         return true;
     }
 
-    boolean removeLocal(Object object) {
+    protected boolean removeLocal(Object object) {
         if (addedToUnresolved != null) {
             addedToUnresolved.remove(object);
         }
@@ -382,21 +382,21 @@
         return true;
     }
 
-    void postprocessAdd(Collection collection) {
+    protected void postprocessAdd(Collection collection) {
         Iterator it = collection.iterator();
         while (it.hasNext()) {
             postprocessAdd(it.next());
         }
     }
 
-    void postprocessRemove(Collection collection) {
+    protected void postprocessRemove(Collection collection) {
         Iterator it = collection.iterator();
         while (it.hasNext()) {
             postprocessRemove(it.next());
         }
     }
 
-    void postprocessAdd(Object addedObject) {
+    protected void postprocessAdd(Object addedObject) {
 
         // notify ObjectContext
         if (relationshipOwner.getObjectContext() != null) {
@@ -408,7 +408,7 @@
         }
     }
 
-    void postprocessRemove(Object removedObject) {
+    protected void postprocessRemove(Object removedObject) {
 
         // notify ObjectContext
         if (relationshipOwner.getObjectContext() != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/RelationshipFault.java
Wed Mar 18 09:03:47 2009
@@ -91,13 +91,25 @@
                         relationshipOwner.getObjectId(),
                         relationshipName,
                         false));
+        
+        /**
+         * Duplicating the list (see CAY-1194). Doing that only for RelationshipFault
+         * query results, so only for nested DataContexts
+         */
+        if (resolved instanceof RelationshipFault) {
+            resolved = new ArrayList(resolved);
+        }
 
         if (resolved.isEmpty()) {
             return resolved;
         }
 
-        // see if reverse relationship is to-one and we can connect source to results....
-
+        updateReverse(resolved);
+        return resolved;
+    }
+    
+    // see if reverse relationship is to-one and we can connect source to results....
+    protected void updateReverse(List resolved) {
         EntityResolver resolver = relationshipOwner
                 .getObjectContext()
                 .getEntityResolver();
@@ -118,7 +130,5 @@
                 property.writePropertyDirectly(it.next(), null, relationshipOwner);
             }
         }
-
-        return resolved;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/NestedDataContextWriteTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/NestedDataContextWriteTest.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/NestedDataContextWriteTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/NestedDataContextWriteTest.java
Wed Mar 18 09:03:47 2009
@@ -30,6 +30,7 @@
 import org.apache.cayenne.DataObjectUtils;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.Persistent;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.unit.CayenneCase;
 
@@ -569,4 +570,32 @@
         child.commitChangesToParent();
 
     }
+    
+    public void testCAY1194() throws Exception {
+        deleteTestData();
+        
+        DataContext context = createDataContext();
+        
+        Artist artist = context.newObject(Artist.class);
+        artist.setArtistName("111");
+        ObjectContext child = context.createChildContext();
+        
+        Painting painting = child.newObject(Painting.class);
+        painting.setPaintingTitle("222");
+        
+        Artist localParentMt = (Artist) child.localObject(artist.getObjectId(), null);
+        assertEquals(0, artist.getPaintingArray().size());
+        assertEquals(0, localParentMt.getPaintingArray().size());
+        
+        painting.setToArtist(localParentMt);
+        
+        assertEquals(0, artist.getPaintingArray().size());
+        assertEquals(1, localParentMt.getPaintingArray().size());
+        assertEquals(((Persistent) localParentMt.getPaintingArray().get(0)).getObjectContext(),
child);
+        
+        child.commitChangesToParent();
+        assertEquals(1, artist.getPaintingArray().size());
+        assertEquals(((Persistent) artist.getPaintingArray().get(0)).getObjectContext(),
context);
+        
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/NestedObjectContextTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/NestedObjectContextTest.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/NestedObjectContextTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/NestedObjectContextTest.java
Wed Mar 18 09:03:47 2009
@@ -615,4 +615,29 @@
         //fetching other relationship... this fails per CAY-1183
         childMt2.getTable3();
     }
+    
+    public void testCAY1194() throws Exception {
+        deleteTestData();
+        
+        ClientMtTable1 parentMt = context.newObject(ClientMtTable1.class);        
+        ObjectContext child = context.createChildContext();
+        
+        ClientMtTable2 childMt2 = child.newObject(ClientMtTable2.class);
+        childMt2.setGlobalAttribute("222");
+        
+        ClientMtTable1 localParentMt = (ClientMtTable1) child.localObject(parentMt.getObjectId(),
null);
+        assertEquals(0, parentMt.getTable2Array().size());
+        assertEquals(0, localParentMt.getTable2Array().size());
+        
+        childMt2.setTable1(localParentMt);
+        
+        assertEquals(0, parentMt.getTable2Array().size());
+        assertEquals(1, localParentMt.getTable2Array().size());
+        
+        assertEquals(((Persistent) localParentMt.getTable2Array().get(0)).getObjectContext(),
child);
+        
+        child.commitChangesToParent();
+        assertEquals(1, parentMt.getTable2Array().size());
+        assertEquals(((Persistent) parentMt.getTable2Array().get(0)).getObjectContext(),
context);
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java?rev=755516&r1=755515&r2=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/remote/RemoteCayenneCase.java
Wed Mar 18 09:03:47 2009
@@ -38,12 +38,16 @@
     @Override
     public void setUp() throws Exception {
         parentDataContext = createDataContext();
+        context = createROPContext();
+    }
+    
+    protected CayenneContext createROPContext() {
         ClientServerChannel clientServerChannel = new ClientServerChannel(parentDataContext);
         UnitLocalConnection connection = new UnitLocalConnection(
                 clientServerChannel,
                 LocalConnection.HESSIAN_SERIALIZATION);
         ClientChannel channel = new ClientChannel(connection);
-        context = new CayenneContext(channel, true, true);
+        return new CayenneContext(channel, true, true);
     }
     
     @Override

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
(from r754880, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ToManyListTest.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ToManyListTest.java&r1=754880&r2=755516&rev=755516&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ToManyListTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
Wed Mar 18 09:03:47 2009
@@ -17,15 +17,21 @@
  *  under the License.
  ****************************************************************/
 
-package org.apache.cayenne.access;
+package org.apache.cayenne.util;
 
 import java.util.Collections;
+import java.util.List;
 
 import org.apache.art.Artist;
 import org.apache.art.Painting;
 import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.access.ToManyList;
 import org.apache.cayenne.unit.CayenneCase;
 
+/**
+ * Moved to org.apache.cayenne.util package for accessing protected properties we don't need
getters for
+ */
 public class ToManyListTest extends CayenneCase {
 
     protected DataContext context;
@@ -94,7 +100,7 @@
         int size = list.size();
         assertFalse("List must be resolved after checking a size...", list.isFault());
         assertEquals(1, size);
-        assertTrue(list.objectList.contains(p2));
+        assertTrue(getValue(list).contains(p2));
     }
 
     public void testSavedUnresolvedMerge() throws Exception {
@@ -127,8 +133,8 @@
         int size = list.size();
         assertFalse("List must be resolved after checking a size...", list.isFault());
         assertEquals(2, size);
-        assertTrue(list.objectList.contains(p2));
-        assertTrue(list.objectList.contains(p1));
+        assertTrue(getValue(list).contains(p2));
+        assertTrue(getValue(list).contains(p1));
     }
 
     public void testThrowOutDeleted() throws Exception {
@@ -173,8 +179,8 @@
         int size = list.size();
         assertFalse("List must be resolved after checking a size...", list.isFault());
         assertEquals("Deleted object must have been purged...", 1, size);
-        assertTrue(list.objectList.contains(p1));
-        assertFalse("Deleted object must have been purged...", list.objectList
+        assertTrue(getValue(list).contains(p1));
+        assertFalse("Deleted object must have been purged...", getValue(list)
                 .contains(p2));
     }
 
@@ -237,4 +243,8 @@
         assertFalse(list.contains(p2));
         assertFalse("List must be resolved...", list.isFault());
     }
+    
+    private List getValue(ToManyList list) {
+        return (List) list.getValueDirectly();
+    }
 }

Propchange: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/util/ToManyListTest.java
------------------------------------------------------------------------------
    svn:mergeinfo = 



Mime
View raw message