cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: Update firebird support - fix EJBQL functions - fix function call expressions - fix tests (explicitly clear self reference as delete all query can't handle it on Firebird)
Date Fri, 13 Jan 2017 09:28:54 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 4f860180d -> cde608b11


Update firebird support
 - fix EJBQL functions
 - fix function call expressions
 - fix tests (explicitly clear self reference as delete all query can't handle it on Firebird)


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

Branch: refs/heads/master
Commit: cde608b11627922553f573ce65752b879e29f629
Parents: 4f86018
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Fri Jan 13 11:17:08 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Fri Jan 13 11:17:08 2017 +0300

----------------------------------------------------------------------
 .../cayenne/dba/firebird/FirebirdAdapter.java   |   6 +-
 .../FirebirdEJBQLConditionTranslator.java       | 105 +++++++++++++++++++
 .../FirebirdEJBQLTranslatorFactory.java         |  37 +++++++
 .../firebird/FirebirdQualifierTranslator.java   |  37 ++++++-
 .../org/apache/cayenne/CDOReflexiveRelIT.java   |   3 +
 .../CayenneDataObjectRelationshipsIT.java       |  18 ++++
 .../cayenne/access/DataContextPrefetchIT.java   |   3 +
 .../AshwoodEntitySorter_RelationshipsIT.java    |   4 +
 .../apache/cayenne/query/ColumnSelectIT.java    |  10 --
 .../query/ObjectSelect_PrimitiveColumnsIT.java  |  11 +-
 .../cayenne/query/ObjectSelect_RunIT.java       |  10 --
 .../cayenne/unit/FirebirdUnitDbAdapter.java     |  17 ++-
 .../cayenne/unit/di/server/SchemaBuilder.java   |  32 ++++++
 .../cayenne/unit/di/server/ServerCase.java      |   6 +-
 .../org/apache/cayenne/unit/jira/CAY_194IT.java |   3 +
 pom.xml                                         |   4 +-
 16 files changed, 267 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
index c88c88f..6bc26be 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdAdapter.java
@@ -20,6 +20,7 @@
 package org.apache.cayenne.dba.firebird;
 
 import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslatorFactory;
 import org.apache.cayenne.access.translator.select.QualifierTranslator;
 import org.apache.cayenne.access.translator.select.QueryAssembler;
 import org.apache.cayenne.access.types.ByteArrayType;
@@ -107,5 +108,8 @@ public class FirebirdAdapter extends JdbcAdapter {
         return new FirebirdQualifierTranslator(queryAssembler);
     }
 
-
+    @Override
+    public EJBQLTranslatorFactory getEjbqlTranslatorFactory() {
+        return new FirebirdEJBQLTranslatorFactory();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLConditionTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLConditionTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLConditionTranslator.java
new file mode 100644
index 0000000..6d0f272d
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLConditionTranslator.java
@@ -0,0 +1,105 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.dba.firebird;
+
+import org.apache.cayenne.access.translator.ejbql.EJBQLConditionTranslator;
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslationContext;
+import org.apache.cayenne.ejbql.EJBQLExpression;
+import org.apache.cayenne.ejbql.parser.EJBQLTrimSpecification;
+
+/**
+ * @since 4.0
+ */
+public class FirebirdEJBQLConditionTranslator extends EJBQLConditionTranslator {
+
+    public FirebirdEJBQLConditionTranslator(EJBQLTranslationContext context) {
+        super(context);
+    }
+
+    @Override
+    public boolean visitTrim(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            if (!(expression.getChild(0) instanceof EJBQLTrimSpecification)) {
+                context.append(" {fn TRIM(");
+            }
+        } else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean visitTrimLeading(EJBQLExpression expression) {
+        context.append(" {fn TRIM(LEADING FROM ");
+        return false;
+    }
+
+    @Override
+    public boolean visitTrimTrailing(EJBQLExpression expression) {
+        context.append(" {fn TRIM(TRAILING FROM ");
+        return false;
+    }
+
+    @Override
+    public boolean visitTrimBoth(EJBQLExpression expression) {
+        context.append(" {fn TRIM(");
+        return false;
+    }
+
+    @Override
+    public boolean visitLower(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn LOWER(");
+            return true;
+        } else {
+            return super.visitLower(expression, finishedChildIndex);
+        }
+    }
+
+    @Override
+    public boolean visitLocate(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn POSITION(");
+            return true;
+        } else {
+            return super.visitLocate(expression, finishedChildIndex);
+        }
+    }
+
+    @Override
+    public boolean visitSubstring(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" SUBSTRING(");
+        } else {
+            if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+                context.append(" AS INTEGER))");
+            } else {
+                if(finishedChildIndex == 0) {
+                    context.append(" FROM CAST(");
+                } else if(finishedChildIndex == 1) {
+                    context.append(" AS INTEGER) FOR CAST(");
+                }
+            }
+        }
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLTranslatorFactory.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLTranslatorFactory.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLTranslatorFactory.java
new file mode 100644
index 0000000..aea4437
--- /dev/null
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdEJBQLTranslatorFactory.java
@@ -0,0 +1,37 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.dba.firebird;
+
+import org.apache.cayenne.access.translator.ejbql.EJBQLTranslationContext;
+import org.apache.cayenne.access.translator.ejbql.JdbcEJBQLTranslatorFactory;
+import org.apache.cayenne.ejbql.EJBQLExpressionVisitor;
+
+/**
+ * @since 4.0
+ */
+public class FirebirdEJBQLTranslatorFactory extends JdbcEJBQLTranslatorFactory {
+
+    @Override
+    public EJBQLExpressionVisitor getConditionTranslator(EJBQLTranslationContext context)
{
+        context.setCaseInsensitive(caseInsensitive);
+        return new FirebirdEJBQLConditionTranslator(context);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
index 9965b12..503358f 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dba/firebird/FirebirdQualifierTranslator.java
@@ -25,6 +25,8 @@ import org.apache.cayenne.dba.oracle.OracleQualifierTranslator;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.parser.ASTFunctionCall;
 
+import java.io.IOException;
+
 public class FirebirdQualifierTranslator extends QualifierTranslator {
 
 	private int substringArg = 0;
@@ -67,6 +69,36 @@ public class FirebirdQualifierTranslator extends QualifierTranslator {
 	}
 
 	/**
+	 * A little bit ugly code that wraps String scalars to CAST(? AS VARCHAR(length))
+	 * because otherwise derby don't know what type will be at the placeholder and
+	 * use LONG VARCHAR that isn't comparable what leads to statement preparation failure.
+	 *
+	 * @since 4.0
+	 */
+	protected void appendFunctionArg(Object value, ASTFunctionCall functionExpression) throws
IOException {
+		if("CONCAT".equals(functionExpression.getFunctionName())) {
+			if(value instanceof String) {
+				out.append("CAST(");
+			}
+			super.appendFunctionArg(value, functionExpression);
+			if(value instanceof String) {
+				clearLastFunctionArgDivider(functionExpression);
+				out.append(" AS VARCHAR(").append(((String)value).length()).append("))");
+				appendFunctionArgDivider(functionExpression);
+			}
+		} else if("SUBSTRING".equals(functionExpression.getFunctionName())) {
+			out.append("CAST(");
+			super.appendFunctionArg(value, functionExpression);
+			clearLastFunctionArgDivider(functionExpression);
+			substringArg--;
+			out.append(" AS INTEGER)");
+			appendFunctionArgDivider(functionExpression);
+		} else {
+			super.appendFunctionArg(value, functionExpression);
+		}
+	}
+
+	/**
 	 * @since 4.0
 	 */
 	@Override
@@ -100,8 +132,9 @@ public class FirebirdQualifierTranslator extends QualifierTranslator {
 				out.delete(out.length() - 4, out.length());
 				break;
 			case "SUBSTRING":
-				// no offset arg
-				if(substringArg == 2) {
+				if(substringArg == 1) {
+					out.delete(out.length() - " FROM ".length(), out.length());
+				} else if(substringArg == 2) {
 					out.delete(out.length() - " FOR ".length(), out.length());
 				}
 				break;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/CDOReflexiveRelIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/CDOReflexiveRelIT.java b/cayenne-server/src/test/java/org/apache/cayenne/CDOReflexiveRelIT.java
index 56dfd47..24f5777 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/CDOReflexiveRelIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/CDOReflexiveRelIT.java
@@ -123,6 +123,9 @@ public class CDOReflexiveRelIT extends ServerCase {
         childGroup1.setName("child1");
         childGroup1.setToParentGroup(parentGroup);
         context.commitChanges();
+
+        childGroup1.setToParentGroup(null);
+        context.commitChanges();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/CayenneDataObjectRelationshipsIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/CayenneDataObjectRelationshipsIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/CayenneDataObjectRelationshipsIT.java
index 35bc8fe..6c13706 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/CayenneDataObjectRelationshipsIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/CayenneDataObjectRelationshipsIT.java
@@ -193,6 +193,9 @@ public class CayenneDataObjectRelationshipsIT extends ServerCase {
         childGroup1.setName("child1");
         childGroup1.setToParentGroup(parentGroup);
         context.commitChanges();
+
+        childGroup1.setToParentGroup(null);
+        context.commitChanges();
     }
 
     @Test
@@ -207,6 +210,9 @@ public class CayenneDataObjectRelationshipsIT extends ServerCase {
         childGroup1.setToParentGroup(parentGroup);
 
         context.commitChanges();
+
+        childGroup1.setToParentGroup(null);
+        context.commitChanges();
     }
 
     @Test
@@ -226,6 +232,12 @@ public class CayenneDataObjectRelationshipsIT extends ServerCase {
         childGroup2.setToParentGroup(parentGroup);
 
         context.commitChanges();
+
+        childGroup1.setToParentGroup(null);
+        context.commitChanges();
+
+        childGroup2.setToParentGroup(null);
+        context.commitChanges();
     }
 
     @Test
@@ -245,6 +257,12 @@ public class CayenneDataObjectRelationshipsIT extends ServerCase {
         childGroup2.setToParentGroup(childGroup1);
 
         context.commitChanges();
+
+        childGroup1.setToParentGroup(null);
+        context.commitChanges();
+
+        childGroup2.setToParentGroup(null);
+        context.commitChanges();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextPrefetchIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextPrefetchIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextPrefetchIT.java
index 71fb837..72ea5cc 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextPrefetchIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DataContextPrefetchIT.java
@@ -510,6 +510,9 @@ public class DataContextPrefetchIT extends ServerCase {
 				assertEquals(PersistenceState.COMMITTED, fetchedChild.getToParentGroup().getPersistenceState());
 			}
 		});
+
+		child.setToParentGroup(null);
+		context.commitChanges();
 	}
 
 	@Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/ashwood/AshwoodEntitySorter_RelationshipsIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/ashwood/AshwoodEntitySorter_RelationshipsIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/ashwood/AshwoodEntitySorter_RelationshipsIT.java
index 56d3020..9ed803a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/ashwood/AshwoodEntitySorter_RelationshipsIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/ashwood/AshwoodEntitySorter_RelationshipsIT.java
@@ -84,5 +84,9 @@ public class AshwoodEntitySorter_RelationshipsIT extends ServerCase {
 		assertEquals("r3", ((ReflexiveAndToOne) objects.get(0)).getName());
 		assertEquals("r2", ((ReflexiveAndToOne) objects.get(1)).getName());
 		assertEquals("r1", ((ReflexiveAndToOne) objects.get(2)).getName());
+
+		tReflexiveAndToOne.delete().where("PARENT_ID", 2).execute();
+		tReflexiveAndToOne.delete().where("PARENT_ID", 1).execute();
+		tReflexiveAndToOne.deleteAll();
 	}
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/query/ColumnSelectIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/ColumnSelectIT.java b/cayenne-server/src/test/java/org/apache/cayenne/query/ColumnSelectIT.java
index a4dcada..025796c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/ColumnSelectIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/ColumnSelectIT.java
@@ -21,7 +21,6 @@ package org.apache.cayenne.query;
 
 import java.sql.Types;
 import java.text.DateFormat;
-import java.util.Arrays;
 import java.util.Locale;
 
 import org.apache.cayenne.CayenneRuntimeException;
@@ -35,7 +34,6 @@ import org.apache.cayenne.unit.UnitDbAdapter;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -90,14 +88,6 @@ public class ColumnSelectIT extends ServerCase {
         tPaintings.insert(21, "painting21", 2, 1);
     }
 
-    @After
-    public void clearArtistsDataSet() throws Exception {
-        for(String table : Arrays.asList("PAINTING", "ARTIST", "GALLERY")) {
-            TableHelper tHelper = new TableHelper(dbHelper, table);
-            tHelper.deleteAll();
-        }
-    }
-
     @Test
     public void testSelectGroupBy() throws Exception {
         Property<Long> count = Property.create(countExp(), Long.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_PrimitiveColumnsIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_PrimitiveColumnsIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_PrimitiveColumnsIT.java
index 9906375..7654bca 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_PrimitiveColumnsIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_PrimitiveColumnsIT.java
@@ -31,7 +31,6 @@ import org.apache.cayenne.testdo.primitive.PrimitivesTestEntity;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -60,12 +59,6 @@ public class ObjectSelect_PrimitiveColumnsIT extends ServerCase {
         }
     }
 
-    @After
-    public void cleanTestRecords() throws Exception {
-        TableHelper tPrimitives = new TableHelper(dbHelper, "PRIMITIVES_TEST");
-        tPrimitives.deleteAll();
-    }
-
     @Test
     public void test_SelectIntegerColumn() throws Exception {
         int intColumn2 = ObjectSelect.query(PrimitivesTestEntity.class)
@@ -88,13 +81,13 @@ public class ObjectSelect_PrimitiveColumnsIT extends ServerCase {
     @Test
     public void test_SelectIntegerExpColumn() throws Exception {
         Property<Integer> property = Property.create("intColumn",
-                ExpressionFactory.exp("(obj:intColumn + 1)"), Integer.class);
+                ExpressionFactory.exp("(obj:intColumn + obj:intColumn)"), Integer.class);
 
         int intColumn2 = ObjectSelect.query(PrimitivesTestEntity.class)
                 .column(property)
                 .orderBy(PrimitivesTestEntity.INT_COLUMN.asc())
                 .selectFirst(context);
-        assertEquals(11, intColumn2);
+        assertEquals(20, intColumn2);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_RunIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_RunIT.java
b/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_RunIT.java
index ca4a7ce..30b4f0c 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_RunIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/query/ObjectSelect_RunIT.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
-import java.util.Arrays;
 import java.util.List;
 
 import org.apache.cayenne.CayenneRuntimeException;
@@ -46,7 +45,6 @@ import org.apache.cayenne.testdo.testmap.Painting;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
 import org.apache.cayenne.unit.di.server.ServerCase;
 import org.apache.cayenne.unit.di.server.UseServerRuntime;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -80,14 +78,6 @@ public class ObjectSelect_RunIT extends ServerCase {
 		}
 	}
 
-	@After
-	public void clearArtistsDataSet() throws Exception {
-		for(String table : Arrays.asList("PAINTING", "ARTIST", "GALLERY")) {
-			TableHelper tHelper = new TableHelper(dbHelper, table);
-			tHelper.deleteAll();
-		}
-	}
-
 	@Test
 	public void test_SelectObjects() throws Exception {
 		List<Artist> result = ObjectSelect.query(Artist.class).select(context);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
b/cayenne-server/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
index ba1f237..54e333a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/FirebirdUnitDbAdapter.java
@@ -26,20 +26,29 @@ public class FirebirdUnitDbAdapter extends UnitDbAdapter {
     public FirebirdUnitDbAdapter(DbAdapter adapter) {
         super(adapter);
     }
-    
+
+    @Override
     public boolean supportsBoolean() {
         return true;
     }
-    
+
+    @Override
     public boolean supportsLobs() {
         return true;
     }
-    
+
+    @Override
     public boolean supportsFKConstraints(DbEntity entity) {
         return !entity.getName().contains("CLOB");
     }
-    
+
+    @Override
     public boolean supportsBinaryPK() {
         return false;
     }
+
+    @Override
+    public boolean supportsPKGeneratorConcurrency() {
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
index 8cab9b1..22923c3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/SchemaBuilder.java
@@ -160,6 +160,7 @@ public class SchemaBuilder {
 		for (Procedure proc : map.getProcedures()) {
 			unitDbAdapter.tweakProcedure(proc);
 		}
+		filterDataMap(map);
 
 		node.addDataMap(map);
 
@@ -170,6 +171,37 @@ public class SchemaBuilder {
 		domain.addNode(node);
 	}
 
+	/**
+	 * Remote binary pk {@link DbEntity} for {@link DbAdapter} not supporting
+	 * that and so on.
+	 */
+	protected void filterDataMap(DataMap map) {
+		boolean supportsBinaryPK = unitDbAdapter.supportsBinaryPK();
+
+		if (supportsBinaryPK) {
+			return;
+		}
+
+		List<DbEntity> entitiesToRemove = new ArrayList<DbEntity>();
+
+		for (DbEntity ent : map.getDbEntities()) {
+			for (DbAttribute attr : ent.getAttributes()) {
+				// check for BIN PK or FK to BIN Pk
+				if (attr.getType() == Types.BINARY || attr.getType() == Types.VARBINARY
+						|| attr.getType() == Types.LONGVARBINARY) {
+					if (attr.isPrimaryKey() || attr.isForeignKey()) {
+						entitiesToRemove.add(ent);
+						break;
+					}
+				}
+			}
+		}
+
+		for (DbEntity e : entitiesToRemove) {
+			map.removeDbEntity(e.getName(), true);
+		}
+	}
+
 	/** Drops all test tables. */
 	private void dropSchema() throws Exception {
 		for (DataNode node : domain.getDataNodes()) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCase.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCase.java
b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCase.java
index 0f5181e..d23510e 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCase.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/server/ServerCase.java
@@ -40,7 +40,11 @@ public class ServerCase extends DICase {
 
 	@Before
 	public void cleanUpDB() throws Exception {
-		dbCleaner.clean();
+		try {
+			dbCleaner.clean();
+		} catch (Exception ex) {
+			dbCleaner.clean();
+		}
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_194IT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_194IT.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_194IT.java
index 704a435..8689bb8 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_194IT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_194IT.java
@@ -110,5 +110,8 @@ public class CAY_194IT extends ServerCase {
                 qualifier));
         assertEquals(1, children.size());
         assertSame(o2, children.get(0));
+
+        o2.setToParent(null);
+        context.commitChanges();
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/cde608b1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ec153e1..5345246 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1260,8 +1260,8 @@
 			<dependencies>
 				<dependency>
 					<groupId>org.firebirdsql.jdbc</groupId>
-					<artifactId>jaybird-jdk16</artifactId>
-					<version>2.2.3</version>
+					<artifactId>jaybird-jdk17</artifactId>
+					<version>2.2.12</version>
 					<scope>test</scope>
 				</dependency>
 			</dependencies>


Mime
View raw message