openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openjpa] 03/04: Those 2 tests only work when running on Derby.
Date Sat, 02 Feb 2019 11:09:48 GMT
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

commit 17ef63bbe4a96ce8b41727a0ace15fdd1ff312a7
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Sat Feb 2 12:06:57 2019 +0100

    Those 2 tests only work when running on Derby.
    
    They hardcoded slurp in some derby driver via simple-ldap.
    Thus they only work if the derby profile is activated.
    In any other case those tests blow up with a CNFE.
---
 .../openjpa/persistence/conf/TestOverrideNonJtaDataSource.java     | 7 +++++--
 .../org/apache/openjpa/persistence/conf/TestSwitchConnection.java  | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOverrideNonJtaDataSource.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOverrideNonJtaDataSource.java
index 72159df..922d4d8 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOverrideNonJtaDataSource.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestOverrideNonJtaDataSource.java
@@ -27,12 +27,16 @@ import javax.persistence.EntityManagerFactory;
 import javax.persistence.RollbackException;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.ArgumentException;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
+/**
+ * Test only works in Derby due to the simple-JNDI setup
+ */
 public class TestOverrideNonJtaDataSource extends SingleEMFTestCase {
     private String defaultJndiName = "jdbc/mocked";
     private String[] jndiNames = { "jdbc/mocked1" };
@@ -52,8 +56,7 @@ public class TestOverrideNonJtaDataSource extends SingleEMFTestCase {
         super.setUp(Person.class, CLEAR_TABLES);
         OpenJPAEntityManager em = emf.createEntityManager();
         JDBCConfiguration conf = (JDBCConfiguration) em.getConfiguration();
-        String user = conf.getConnectionUserName();
-        if (user != null && !user.equals("")) {
+        if (!(conf.getDBDictionaryInstance() instanceof DerbyDictionary)) {
             // Disable for non-Derby, due to connectionUserName to schema mapping failures
             setTestsDisabled(true);
             getLog().trace("TestOverrideNonJtaDataSource can only be executed against Derby
w/o a schema");
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestSwitchConnection.java
b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestSwitchConnection.java
index 5704786..23cac89 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestSwitchConnection.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/conf/TestSwitchConnection.java
@@ -27,12 +27,16 @@ import javax.persistence.EntityManagerFactory;
 import javax.persistence.RollbackException;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.ArgumentException;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
+/**
+ * Test only works in Derby due to the simple-JNDI setup
+ */
 public class TestSwitchConnection extends SingleEMFTestCase {
     private String defaultJndiName = "jdbc/mocked";
     private String[] jndiNames = { "jdbc/mocked1" };
@@ -52,8 +56,7 @@ public class TestSwitchConnection extends SingleEMFTestCase {
         super.setUp(Person.class, CLEAR_TABLES);
         OpenJPAEntityManager em = emf.createEntityManager();
         JDBCConfiguration conf = (JDBCConfiguration) em.getConfiguration();
-        String user = conf.getConnectionUserName();
-        if (user != null && !user.equals("")) {
+        if (!(conf.getDBDictionaryInstance() instanceof DerbyDictionary)) {
             // Disable for non-Derby, due to connectionUserName to schema mapping failures
             setTestsDisabled(true);
             getLog().trace("TestOverrideNonJtaDataSource can only be executed against Derby
w/o a schema");


Mime
View raw message