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:06:55 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 a07482cc3 -> 4a787ae45


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

(cherry picked from commit 4a62416)


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

Branch: refs/heads/STABLE-4.0
Commit: 4a787ae45a11c7beb50e334938b4fbe20edcc24a
Parents: a07482c
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:06:50 2017 +0300

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


http://git-wip-us.apache.org/repos/asf/cayenne/blob/4a787ae4/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 d5e6766..3edb831 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.server.ServerRuntime;
 import org.apache.cayenne.di.Inject;
@@ -697,4 +698,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