This is an automated email from the ASF dual-hosted git repository.
struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git
The following commit(s) were added to refs/heads/master by this push:
new 8d41f3d OPENJPA-2753 fix testBatchLimit test for PostgreSQL
8d41f3d is described below
commit 8d41f3da9ccf27f90c372f91afce3630824426c9
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Fri Nov 9 09:04:59 2018 +0100
OPENJPA-2753 fix testBatchLimit test for PostgreSQL
---
.../persistence/batch/exception/TestBatchLimitException.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/batch/exception/TestBatchLimitException.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/batch/exception/TestBatchLimitException.java
index 765fff7..26a2358 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/batch/exception/TestBatchLimitException.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/batch/exception/TestBatchLimitException.java
@@ -24,6 +24,7 @@ import javax.persistence.EntityManagerFactory;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
+import org.apache.openjpa.jdbc.sql.PostgresDictionary;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.test.AbstractPersistenceTestCase;
import org.apache.openjpa.util.ExceptionInfo;
@@ -38,7 +39,10 @@ public class TestBatchLimitException extends AbstractPersistenceTestCase
{
static Ent1 expectedFailedObject;
static Ent1 expectedFailedObjectOracle;
+
static boolean isOracle = false;
+ static boolean isPostgres = false;
+
final String expectedFailureMsg =
"INSERT INTO Ent1 (pk, name) VALUES (?, ?) [params=(int) 200, (String) twohundred]";
final String expectedFailureMsg18 =
@@ -58,6 +62,7 @@ public class TestBatchLimitException extends AbstractPersistenceTestCase
{
JDBCConfiguration conf = (JDBCConfiguration) emf.getConfiguration();
DBDictionary dict = conf.getDBDictionaryInstance();
isOracle = dict instanceof OracleDictionary;
+ isPostgres = dict instanceof PostgresDictionary;
return emf;
}
@@ -348,7 +353,7 @@ public class TestBatchLimitException extends AbstractPersistenceTestCase
{
Ent1 failedObject = (Ent1) e.getFailedObject();
assertNotNull("Failed object was null.", failedObject);
- if (!isOracle) {
+ if (!isOracle && !isPostgres) {
assertEquals(expectedFailedObject, failedObject);
} else {
// special case, as Oracle returns all statements in the batch
@@ -362,7 +367,7 @@ public class TestBatchLimitException extends AbstractPersistenceTestCase
{
public void verifyExMsg(String msg) {
assertNotNull("Exception message was null.", msg);
- if (!isOracle) {
+ if (!isOracle && !isPostgres) {
assertTrue("Did not see expected text in message. Expected <" + expectedFailureMsg
+ "> but was " +
msg, msg.contains(expectedFailureMsg));
} else {
|