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.
This commit is contained in:
Mark Struberg 2019-02-02 12:06:57 +01:00
parent 43aa42ccb5
commit 17ef63bbe4
2 changed files with 10 additions and 4 deletions

View File

@ -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");

View File

@ -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");