cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Test case when lowercase names used by DB
Date Fri, 22 Sep 2017 06:44:30 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 1d5861932 -> dda1a8995


Test case when lowercase names used by DB


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

Branch: refs/heads/master
Commit: dda1a899558bc365f6a7a345b03a01d77c7f4d96
Parents: 1d58619
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Sep 22 09:44:24 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Sep 22 09:44:24 2017 +0300

----------------------------------------------------------------------
 .../test/java/org/apache/cayenne/query/SQLExecIT.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/dda1a899/cayenne-server/src/test/java/org/apache/cayenne/query/SQLExecIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLExecIT.java b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLExecIT.java
index 6da090b..4a03778 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/SQLExecIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/SQLExecIT.java
@@ -74,8 +74,15 @@ public class SQLExecIT extends ServerCase {
         assertEquals(1, result.firstList().size());
 
         DataRow row = (DataRow)result.firstList().get(0);
-        assertEquals(1L, row.get("ARTIST_ID"));
-        assertEquals("a", row.get("ARTIST_NAME"));
+        // there is no methods to control case of the columns' names in SQLExec, so check
both versions
+        assertTrue(row.containsKey("ARTIST_ID") || row.containsKey("artist_id"));
+        if(row.containsKey("ARTIST_ID")) {
+            assertEquals(1L, row.get("ARTIST_ID"));
+            assertEquals("a", row.get("ARTIST_NAME"));
+        } else {
+            assertEquals(1L, row.get("artist_id"));
+            assertEquals("a", row.get("artist_name"));
+        }
     }
 
     @Test


Mime
View raw message