cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Fix tests on Oracle
Date Tue, 03 Oct 2017 14:48:08 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master b0e217187 -> 2568f02f8


Fix tests on Oracle


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

Branch: refs/heads/master
Commit: 2568f02f85ddec9125d98adcf344198f6547a9ce
Parents: b0e2171
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Tue Oct 3 16:58:21 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Tue Oct 3 16:58:21 2017 +0300

----------------------------------------------------------------------
 .../cayenne/access/DataContextExtrasIT.java     | 32 +++++++++-----------
 .../cayenne/access/PrimitiveAttributesIT.java   |  4 +--
 .../org/apache/cayenne/query/SQLExecIT.java     |  6 ++--
 .../src/test/resources/cayenne-java8.xml        |  2 ++
 cayenne-server/src/test/resources/java8.map.xml | 12 ++++----
 5 files changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/2568f02f/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextExtrasIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextExtrasIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextExtrasIT.java
index 498d96c..bb840f1 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextExtrasIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextExtrasIT.java
@@ -33,8 +33,8 @@ import org.apache.cayenne.di.AdhocObjectFactory;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.log.JdbcEventLogger;
 import org.apache.cayenne.map.DbAttribute;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.query.SQLTemplate;
-import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
 import org.apache.cayenne.testdo.testmap.Artist;
@@ -148,7 +148,7 @@ public class DataContextExtrasIT extends ServerCase {
         // assertEquals("a", o1.readPropertyDirectly("artistName")); // field-based
 
         // update table bypassing Cayenne
-        int count = tArtist.update().set("ARTIST_NAME", "b").where("ARTIST_NAME", "a").execute();
+        int count = tArtist.update().set("ARTIST_NAME", "b").execute();
         assertTrue(count > 0);
 
         context.prepareForAccess(o1, null, false);
@@ -321,9 +321,9 @@ public class DataContextExtrasIT extends ServerCase {
 
         createPhantomModificationDataSet();
 
-        List<?> objects = context.performQuery(new SelectQuery(Artist.class));
-        Artist a1 = (Artist) objects.get(0);
-        Artist a2 = (Artist) objects.get(1);
+        List<Artist> objects = ObjectSelect.query(Artist.class).select(context);
+        Artist a1 = objects.get(0);
+        Artist a2 = objects.get(1);
 
         a1.setArtistName(a1.getArtistName());
         a1.resetValidationFlags();
@@ -354,8 +354,8 @@ public class DataContextExtrasIT extends ServerCase {
 
         createPhantomModificationsValidateToOneDataSet();
 
-        List<?> objects = context.performQuery(new SelectQuery(Painting.class));
-        Painting p1 = (Painting) objects.get(0);
+        List<Painting> objects = ObjectSelect.query(Painting.class).select(context);
+        Painting p1 = objects.get(0);
 
         p1.setPaintingTitle(p1.getPaintingTitle());
         p1.resetValidationFlags();
@@ -371,8 +371,8 @@ public class DataContextExtrasIT extends ServerCase {
 
         createValidateOnToManyChangeDataSet();
 
-        List<?> objects = context.performQuery(new SelectQuery(Artist.class));
-        Artist a1 = (Artist) objects.get(0);
+        List<Artist> objects = ObjectSelect.query(Artist.class).select(context);
+        Artist a1 = objects.get(0);
 
         Painting p1 = context.newObject(Painting.class);
         p1.setPaintingTitle("XXX");
@@ -388,8 +388,8 @@ public class DataContextExtrasIT extends ServerCase {
 
         createPhantomModificationDataSet();
 
-        List<?> objects = context.performQuery(new SelectQuery(Artist.class));
-        Artist a1 = (Artist) objects.get(0);
+        List<Artist> objects = ObjectSelect.query(Artist.class).select(context);
+        Artist a1 = objects.get(0);
 
         String oldName = a1.getArtistName();
 
@@ -405,11 +405,10 @@ public class DataContextExtrasIT extends ServerCase {
 
         createPhantomRelationshipModificationCommitDataSet();
 
-        SelectQuery query = new SelectQuery(Painting.class);
-        List<?> objects = context.performQuery(query);
+        List<Painting> objects = ObjectSelect.query(Painting.class).select(context);
         assertEquals(1, objects.size());
 
-        Painting p1 = (Painting) objects.get(0);
+        Painting p1 = objects.get(0);
 
         Artist oldArtist = p1.getToArtist();
         Artist newArtist = Cayenne.objectForPK(context, Artist.class, 33002);
@@ -431,11 +430,10 @@ public class DataContextExtrasIT extends ServerCase {
 
         createPhantomRelationshipModificationCommitDataSet();
 
-        SelectQuery query = new SelectQuery(Painting.class);
-        List<?> objects = context.performQuery(query);
+        List<Painting> objects = ObjectSelect.query(Painting.class).select(context);
         assertEquals(1, objects.size());
 
-        Painting p1 = (Painting) objects.get(0);
+        Painting p1 = objects.get(0);
 
         Artist oldArtist = p1.getToArtist();
         Artist newArtist = Cayenne.objectForPK(context, Artist.class, 33002);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2568f02f/cayenne-server/src/test/java/org/apache/cayenne/access/PrimitiveAttributesIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/PrimitiveAttributesIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/PrimitiveAttributesIT.java
index f885b40..031cfa2 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/PrimitiveAttributesIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/PrimitiveAttributesIT.java
@@ -62,7 +62,7 @@ public class PrimitiveAttributesIT extends ServerCase {
         tPrimitives.setColumns("ID", "BOOLEAN_COLUMN", "INT_COLUMN", "CHAR_COLUMN");
         tPrimitives.insert(1, true, -100, String.valueOf('a'))
                 .insert(2, false, 0, String.valueOf('~'))
-                .insert(3, true, Integer.MAX_VALUE, String.valueOf('Å'));
+                .insert(3, true, Integer.MAX_VALUE, String.valueOf('Z'));
 
         List<PrimitivesTestEntity> result = ObjectSelect.query(PrimitivesTestEntity.class)
                 .orderBy(PrimitivesTestEntity.INT_COLUMN.asc()).select(context);
@@ -76,7 +76,7 @@ public class PrimitiveAttributesIT extends ServerCase {
         assertFalse(result.get(1).isBooleanColumn());
 
         assertEquals(Integer.MAX_VALUE, result.get(2).getIntColumn());
-        assertEquals('Å', result.get(2).getCharColumn());
+        assertEquals('Z', result.get(2).getCharColumn());
         assertTrue(result.get(2).isBooleanColumn());
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2568f02f/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 b85bfb8..f1c3a20 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
@@ -80,11 +80,11 @@ public class SQLExecIT extends ServerCase {
         DataRow row = (DataRow)result.firstList().get(0);
         if(unitDbAdapter.isLowerCaseNames()) {
             assertTrue(row.containsKey("artist_id"));
-            assertEquals(1L, row.get("artist_id"));
+            assertEquals(1L, ((Number)row.get("artist_id")).longValue());
             assertEquals("a", row.get("artist_name"));
         } else {
             assertTrue(row.containsKey("ARTIST_ID"));
-            assertEquals(1L, row.get("ARTIST_ID"));
+            assertEquals(1L, ((Number)row.get("ARTIST_ID")).longValue());
             assertEquals("a", row.get("ARTIST_NAME"));
         }
     }
@@ -96,7 +96,7 @@ public class SQLExecIT extends ServerCase {
                 .paramsArray(55, "a3").update(context);
 
         assertEquals(1, inserted);
-        assertEquals(55l, dbHelper.getLong("ARTIST", "ARTIST_ID"));
+        assertEquals(55L, dbHelper.getLong("ARTIST", "ARTIST_ID"));
         assertEquals("a3", dbHelper.getString("ARTIST", "ARTIST_NAME").trim());
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2568f02f/cayenne-server/src/test/resources/cayenne-java8.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/cayenne-java8.xml b/cayenne-server/src/test/resources/cayenne-java8.xml
index b0476f4..8d0c655 100644
--- a/cayenne-server/src/test/resources/cayenne-java8.xml
+++ b/cayenne-server/src/test/resources/cayenne-java8.xml
@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <domain xmlns="http://cayenne.apache.org/schema/10/domain"
+	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	 xsi:schemaLocation="http://cayenne.apache.org/schema/10/domain http://cayenne.apache.org/schema/10/domain.xsd"
 	 project-version="10">
 	<map name="java8"/>
 </domain>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2568f02f/cayenne-server/src/test/resources/java8.map.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/java8.map.xml b/cayenne-server/src/test/resources/java8.map.xml
index 9018dfd..fb6d3bc 100644
--- a/cayenne-server/src/test/resources/java8.map.xml
+++ b/cayenne-server/src/test/resources/java8.map.xml
@@ -6,23 +6,23 @@
 	<property name="defaultPackage" value="org.apache.cayenne.testdo.java8"/>
 	<db-entity name="LOCAL_DATETIME_TEST">
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="Timestamp" type="TIMESTAMP"/>
+		<db-attribute name="TimestampField" type="TIMESTAMP"/>
 	</db-entity>
 	<db-entity name="LOCAL_DATE_TEST">
-		<db-attribute name="Date" type="DATE"/>
+		<db-attribute name="DateField" type="DATE"/>
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 	</db-entity>
 	<db-entity name="LOCAL_TIME_TEST">
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
-		<db-attribute name="Time" type="TIME"/>
+		<db-attribute name="TimeField" type="TIME"/>
 	</db-entity>
 	<obj-entity name="LocalDateTest" className="org.apache.cayenne.testdo.java8.LocalDateTestEntity"
dbEntityName="LOCAL_DATE_TEST">
-		<obj-attribute name="date" type="java.time.LocalDate" db-attribute-path="Date"/>
+		<obj-attribute name="date" type="java.time.LocalDate" db-attribute-path="DateField"/>
 	</obj-entity>
 	<obj-entity name="LocalDateTimeTest" className="org.apache.cayenne.testdo.java8.LocalDateTimeTestEntity"
dbEntityName="LOCAL_DATETIME_TEST">
-		<obj-attribute name="timestamp" type="java.time.LocalDateTime" db-attribute-path="Timestamp"/>
+		<obj-attribute name="timestamp" type="java.time.LocalDateTime" db-attribute-path="TimestampField"/>
 	</obj-entity>
 	<obj-entity name="LocalTimeTest" className="org.apache.cayenne.testdo.java8.LocalTimeTestEntity"
dbEntityName="LOCAL_TIME_TEST">
-		<obj-attribute name="time" type="java.time.LocalTime" db-attribute-path="Time"/>
+		<obj-attribute name="time" type="java.time.LocalTime" db-attribute-path="TimeField"/>
 	</obj-entity>
 </data-map>


Mime
View raw message