cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r562878 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test: java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java resources/dml/access.DataContextEJBQLConditionsTest.xml
Date Sun, 05 Aug 2007 15:00:46 GMT
Author: aadamchik
Date: Sun Aug  5 08:00:45 2007
New Revision: 562878

URL: http://svn.apache.org/viewvc?view=rev&rev=562878
Log:
CAY-841  EJBQL Support for LIKE/ESCAPE and IN conditions
(test for NOT LIKE)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java?view=diff&rev=562878&r1=562877&r2=562878
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
Sun Aug  5 08:00:45 2007
@@ -29,13 +29,13 @@
 import org.apache.cayenne.unit.CayenneCase;
 
 public class DataContextEJBQLConditionsTest extends CayenneCase {
-    
+
     protected void setUp() throws Exception {
         deleteTestData();
     }
 
     public void testLike1() throws Exception {
-        createTestData("prepare");
+        createTestData("prepareLike");
 
         String ejbql = "SELECT p FROM Painting p WHERE p.paintingTitle LIKE 'A%C'";
 
@@ -52,9 +52,28 @@
 
         assertTrue(ids.contains(new Integer(33001)));
     }
-    
+
+    public void testNotLike() throws Exception {
+        createTestData("prepareLike");
+
+        String ejbql = "SELECT p FROM Painting p WHERE p.paintingTitle NOT LIKE 'A%C'";
+
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        List objects = createDataContext().performQuery(query);
+        assertEquals(4, objects.size());
+
+        Set ids = new HashSet();
+        Iterator it = objects.iterator();
+        while (it.hasNext()) {
+            Object id = DataObjectUtils.pkForObject((Persistent) it.next());
+            ids.add(id);
+        }
+
+        assertFalse(ids.contains(new Integer(33001)));
+    }
+
     public void testLike2() throws Exception {
-        createTestData("prepare");
+        createTestData("prepareLike");
 
         String ejbql = "SELECT p FROM Painting p WHERE p.paintingTitle LIKE '_DDDD'";
 
@@ -73,9 +92,9 @@
         assertTrue(ids.contains(new Integer(33003)));
         assertTrue(ids.contains(new Integer(33005)));
     }
-    
+
     public void testLikeEscape() throws Exception {
-        createTestData("prepare");
+        createTestData("prepareLike");
 
         String ejbql = "SELECT p FROM Painting p WHERE p.paintingTitle LIKE 'X_DDDD' ESCAPE
'X'";
 
@@ -92,4 +111,5 @@
 
         assertTrue(ids.contains(new Integer(33005)));
     }
+
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml?view=diff&rev=562878&r1=562877&r2=562878
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
Sun Aug  5 08:00:45 2007
@@ -68,7 +68,7 @@
 	<!-- Data Sets -->
 	<!-- ======================================= -->
 
-	<bean id="prepare" class="java.util.ArrayList">
+	<bean id="prepareLike" class="java.util.ArrayList">
 		<constructor-arg>
 			<list>
 				<ref bean="P1" />



Mime
View raw message