cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1073938 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne: CDOMany2OneTest.java unit/jira/CAY_901Test.java
Date Wed, 23 Feb 2011 20:41:14 GMT
Author: aadamchik
Date: Wed Feb 23 20:41:14 2011
New Revision: 1073938

URL: http://svn.apache.org/viewvc?rev=1073938&view=rev
Log:
test cleanup

merging tests into a single class

Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/jira/CAY_901Test.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CDOMany2OneTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CDOMany2OneTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CDOMany2OneTest.java?rev=1073938&r1=1073937&r2=1073938&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CDOMany2OneTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/CDOMany2OneTest.java
Wed Feb 23 20:41:14 2011
@@ -20,11 +20,14 @@
 package org.apache.cayenne;
 
 import java.util.List;
+import java.util.Map;
 
 import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.ExpressionFactory;
+import org.apache.cayenne.query.CapsStrategy;
+import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
@@ -84,6 +87,38 @@ public class CDOMany2OneTest extends Ser
 
     }
 
+    public void testMultipleToOneDeletion() throws Exception {
+
+        // was a problem per CAY-901
+
+        Painting p = context.newObject(Painting.class);
+        p.setPaintingTitle("P1");
+
+        Artist a = context.newObject(Artist.class);
+        a.setArtistName("A1");
+
+        Gallery g = context.newObject(Gallery.class);
+        g.setGalleryName("G1");
+
+        p.setToArtist(a);
+        p.setToGallery(g);
+        context.commitChanges();
+
+        p.setToArtist(null);
+        p.setToGallery(null);
+
+        context.commitChanges();
+
+        SQLTemplate q = new SQLTemplate(Painting.class, "SELECT * from PAINTING");
+        q.setColumnNamesCapitalization(CapsStrategy.UPPER);
+        q.setFetchingDataRows(true);
+
+        Map<String, ?> row = (Map<String, ?>) Cayenne.objectForQuery(context,
q);
+        assertEquals("P1", row.get("PAINTING_TITLE"));
+        assertEquals(null, row.get("ARTIST_ID"));
+        assertEquals(null, row.get("GALLERY_ID"));
+    }
+
     public void testReadRO1() throws Exception {
 
         createArtistWithPaintingDataSet();



Mime
View raw message