cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2363 ColumnSelect: unable to use from nested context additional test for EJBQL query
Date Mon, 11 Sep 2017 11:04:08 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 518eb2fe4 -> 4a6241641


CAY-2363 ColumnSelect: unable to use from nested context
  additional test for EJBQL query


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/4a624164
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/4a624164
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/4a624164

Branch: refs/heads/master
Commit: 4a6241641f66a55b83f65e2b4c124e0f74d95121
Parents: 518eb2f
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Mon Sep 11 14:04:03 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Mon Sep 11 14:04:03 2017 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/query/EJBQLQueryIT.java  | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/4a624164/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryIT.java b/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryIT.java
index 2c29ba5..1225f4b 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/EJBQLQueryIT.java
@@ -19,6 +19,7 @@
 package org.apache.cayenne.query;
 
 import org.apache.cayenne.DataRow;
+import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.configuration.EmptyConfigurationNodeVisitor;
 import org.apache.cayenne.configuration.server.ServerRuntime;
@@ -687,4 +688,25 @@ public class EJBQLQueryIT extends ServerCase {
         assertEquals("a2", result.get(1).getArtistName());
         assertEquals("a3", result.get(2).getArtistName());
     }
+
+    @Test
+    public void testSelectFromNestedContext() throws Exception {
+        tArtist.insert(1, "a1");
+        tArtist.insert(2, "a2");
+
+        tPainting.insert(1, 2, "title1");
+        tPainting.insert(2, 1, "title2");
+        tPainting.insert(3, 1, "title3");
+
+        ObjectContext nested = runtime.newContext(context);
+
+        EJBQLQuery query = new EJBQLQuery("SELECT a, COUNT(a.paintingArray) FROM Artist a
GROUP BY a");
+        List<Object[]> result = nested.performQuery(query);
+        assertEquals(2, result.size());
+        for(Object[] next : result) {
+            assertTrue(next[0] instanceof Artist);
+            assertTrue(next[1] instanceof Number);
+        }
+
+    }
 }


Mime
View raw message