cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r653077 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test: java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java resources/dml/access.DataContextEJBQLConditionsTest.xml
Date Sat, 03 May 2008 13:36:11 GMT
Author: aadamchik
Date: Sat May  3 06:36:10 2008
New Revision: 653077

URL: http://svn.apache.org/viewvc?rev=653077&view=rev
Log:
CAY-919  EJBQL Query with relational queries (<, <=, >, >=) are throwing exceptions
(testing...)

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

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java?rev=653077&r1=653076&r2=653077&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
Sat May  3 06:36:10 2008
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.cayenne.access;
 
+import java.math.BigDecimal;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -42,7 +43,7 @@
 
         // TODO: andrus 02/25/2008 - fails on HSQLDB / succeeds on MySQL. HSQLDB error is
         // "Unresolved parameter type : as both operands of aritmetic operator in
-        
+
         // statement"
         // String ejbql = "SELECT p FROM Painting p WHERE p.estimatedPrice < (1 + - 4.0
*
         // - 1000.0)";
@@ -285,6 +286,32 @@
         assertTrue(ids.contains(33001l));
     }
 
+    public void testGreaterOrEquals() throws Exception {
+        createTestData("prepareGreaterThan");
+
+        String ejbql = "SELECT p FROM Painting p WHERE p.estimatedPrice >= :estimatedPrice";
+
+        ObjectContext context = createDataContext();
+
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        query.setParameter("estimatedPrice", new BigDecimal(4000));
+        List<?> objects = context.performQuery(query);
+        assertEquals(4, objects.size());
+    }
+
+    public void testLessOrEquals() throws Exception {
+        createTestData("prepareGreaterThan");
+
+        String ejbql = "SELECT p FROM Painting p WHERE p.estimatedPrice <= :estimatedPrice";
+
+        ObjectContext context = createDataContext();
+
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        query.setParameter("estimatedPrice", new BigDecimal(4000));
+        List<?> objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+    }
+
     public void testCollectionNotMemberOfParameter() throws Exception {
         createTestData("prepareCollection");
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml?rev=653077&r1=653076&r2=653077&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/dml/access.DataContextEJBQLConditionsTest.xml
Sat May  3 06:36:10 2008
@@ -209,6 +209,18 @@
 		</constructor-arg>
 	</bean>
 	
+	<bean id="prepareGreaterThan" class="java.util.ArrayList">
+		<constructor-arg>
+			<list>
+				<ref bean="P1" />
+				<ref bean="P2" />
+				<ref bean="P3" />
+				<ref bean="P4" />
+				<ref bean="P5" />
+			</list>
+		</constructor-arg>
+	</bean>
+	
 	<bean id="prepareIn" class="java.util.ArrayList">
 		<constructor-arg>
 			<list>



Mime
View raw message