cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r602079 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access: DataContextExtendedTypeOperationsTest.java DataContextSelectQueryExtendedTypeTest.java
Date Fri, 07 Dec 2007 12:04:18 GMT
Author: aadamchik
Date: Fri Dec  7 04:04:17 2007
New Revision: 602079

URL: http://svn.apache.org/viewvc?rev=602079&view=rev
Log:
Basic ExtendedType tests

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextExtendedTypeOperationsTest.java
      - copied, changed from r602075, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextSelectQueryExtendedTypeTest.java
Removed:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextSelectQueryExtendedTypeTest.java

Copied: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextExtendedTypeOperationsTest.java
(from r602075, cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextSelectQueryExtendedTypeTest.java)
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextExtendedTypeOperationsTest.java?p2=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextExtendedTypeOperationsTest.java&p1=cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextSelectQueryExtendedTypeTest.java&r1=602075&r2=602079&rev=602079&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextSelectQueryExtendedTypeTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextExtendedTypeOperationsTest.java
Fri Dec  7 04:04:17 2007
@@ -18,12 +18,17 @@
  ****************************************************************/
 package org.apache.cayenne.access;
 
+import java.util.Arrays;
+
 import org.apache.art.ExtendedTypeEntity;
 import org.apache.art.StringET1;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.exp.ExpressionFactory;
 import org.apache.cayenne.query.SQLTemplate;
+import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.unit.CayenneCase;
 
-public class DataContextSelectQueryExtendedTypeTest extends CayenneCase {
+public class DataContextExtendedTypeOperationsTest extends CayenneCase {
 
     @Override
     protected void setUp() throws Exception {
@@ -42,5 +47,44 @@
         checkQ.setFetchingDataRows(true);
         checkQ.setColumnNamesCapitalization(SQLTemplate.UPPERCASE_COLUMN_NAMES);
         assertEquals(1, e1.getObjectContext().performQuery(checkQ).size());
+    }
+
+    public void testInExpressionExtendedTypeArray() {
+        ExtendedTypeEntity e1 = createDataContext().newObject(ExtendedTypeEntity.class);
+        e1.setName(new StringET1("X"));
+
+        ExtendedTypeEntity e2 = e1.getObjectContext().newObject(ExtendedTypeEntity.class);
+        e2.setName(new StringET1("Y"));
+
+        ExtendedTypeEntity e3 = e1.getObjectContext().newObject(ExtendedTypeEntity.class);
+        e3.setName(new StringET1("Z"));
+
+        e1.getObjectContext().commitChanges();
+
+        Expression in = ExpressionFactory.inExp(
+                ExtendedTypeEntity.NAME_PROPERTY,
+                new Object[] {
+                        new StringET1("X"), new StringET1("Y")
+                });
+        SelectQuery query = new SelectQuery(ExtendedTypeEntity.class, in);
+        assertEquals(2, e1.getObjectContext().performQuery(query).size());
+    }
+
+    public void testInExpressionExtendedTypeList() {
+        ExtendedTypeEntity e1 = createDataContext().newObject(ExtendedTypeEntity.class);
+        e1.setName(new StringET1("X"));
+
+        ExtendedTypeEntity e2 = e1.getObjectContext().newObject(ExtendedTypeEntity.class);
+        e2.setName(new StringET1("Y"));
+
+        ExtendedTypeEntity e3 = e1.getObjectContext().newObject(ExtendedTypeEntity.class);
+        e3.setName(new StringET1("Z"));
+
+        e1.getObjectContext().commitChanges();
+
+        Expression in = ExpressionFactory.inExp(ExtendedTypeEntity.NAME_PROPERTY, Arrays
+                .asList(new StringET1("X"), new StringET1("Y")));
+        SelectQuery query = new SelectQuery(ExtendedTypeEntity.class, in);
+        assertEquals(2, e1.getObjectContext().performQuery(query).size());
     }
 }



Mime
View raw message