Skip to content

Commit

Permalink
WebLogic Server tests fix (#2028)
Browse files Browse the repository at this point in the history
- JPAAdvPropertiesJUnitTestCase.testLoginEncryptorProperty()
    excluded in JEE server tests as DB connection is provided by JEE server by data source and encryptor is not called
- EntityManagerJUnitTestSuite.testApplicationManagedInServer()
    in WebLogic is org.eclipse.persistence.testing.framework.server.WebLogicPlatform set instead of default org.eclipse.persistence.testing.framework.server.JEEPlatform
- AdvancedJPAJunitTest.testNamedStoredProcedureQueryByIndex()
    needs latest JDBC driver
- PLSQLTestSuite.testEmpRecordInOut
    fixed by setWrapTypes(false) in WLST (Data source properties) to avoid use weblogic.jdbc.wrapper.* classes
- UCP classpath fix to reflect changes in Oracle 23c JDBC driver

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
  • Loading branch information
rfelcman authored Jan 8, 2024
1 parent 2b8457f commit 39c89db
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 27 deletions.
4 changes: 4 additions & 0 deletions jpa/eclipselink.jpa.test/antbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -526,24 +526,28 @@
</path>
<echo message="Configuring 'compile.server.path' to:"/>
<echo message=" 'compile.path'"/>
<echo message=" '${oracle.extensions.depend.dir}/${oracle.ucp.jar}'"/>
<echo message=" '${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}'"/>
<echo message=" '../../../extension.lib.external/mongo.jar'"/>
<echo message=" "/>
<path id="compile.server.path">
<path refid="compile.path"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.ucp.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}"/>
<pathelement path="../../../extension.lib.external/mongo.jar"/>
</path>
<path id="compile.jpa21.server.path">
<path refid="jpa21.compile.path"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.ucp.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}"/>
<pathelement path="../../../extension.lib.external/mongo.jar"/>
</path>
<path id="compile.jpa22.server.path">
<path refid="jpa22.compile.path"/>
<pathelement path="${jdbc.driver.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.ucp.jar}"/>
<pathelement path="${oracle.extensions.depend.dir}/${oracle.sdoapi.jar}"/>
<pathelement path="../../../extension.lib.external/mongo.jar"/>
</path>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -48,6 +48,7 @@

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCConnectionPoolParams/EclipseLinkDS')
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cmo.setWrapTypes(false)

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCDriverParams/EclipseLinkDS/Properties/EclipseLinkDS')
cmo.createProperty('user')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -46,6 +46,7 @@

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCConnectionPoolParams/EclipseLinkDS')
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cmo.setWrapTypes(false)

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCDriverParams/EclipseLinkDS/Properties/EclipseLinkDS')
cmo.createProperty('user')
Expand Down Expand Up @@ -85,6 +86,7 @@

cd('/JDBCSystemResources/ELNonJTADS/JDBCResource/ELNonJTADS/JDBCConnectionPoolParams/ELNonJTADS')
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cmo.setWrapTypes(false)

cd('/JDBCSystemResources/ELNonJTADS/JDBCResource/ELNonJTADS/JDBCDriverParams/ELNonJTADS/Properties/ELNonJTADS')
cmo.createProperty('user')
Expand Down
4 changes: 3 additions & 1 deletion jpa/eclipselink.jpa.test/resource/weblogic/wls_setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2024 Oracle and/or its affiliates. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -47,6 +47,7 @@

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCConnectionPoolParams/EclipseLinkDS')
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cmo.setWrapTypes(false)

cd('/JDBCSystemResources/EclipseLinkDS/JDBCResource/EclipseLinkDS/JDBCDriverParams/EclipseLinkDS/Properties/EclipseLinkDS')
cmo.createProperty('user')
Expand Down Expand Up @@ -89,6 +90,7 @@

cd('/JDBCSystemResources/ELNonJTADS/JDBCResource/ELNonJTADS/JDBCConnectionPoolParams/ELNonJTADS')
cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
cmo.setWrapTypes(false)

cd('/JDBCSystemResources/ELNonJTADS/JDBCResource/ELNonJTADS/JDBCDriverParams/ELNonJTADS/Properties/ELNonJTADS')
cmo.createProperty('user')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -44,13 +44,15 @@
import org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl;
import org.eclipse.persistence.logging.DefaultSessionLog;
import org.eclipse.persistence.logging.SessionLog;
import org.eclipse.persistence.platform.server.ServerPlatformUtils;
import org.eclipse.persistence.sessions.Connector;
import org.eclipse.persistence.sessions.DefaultConnector;
import org.eclipse.persistence.sessions.JNDIConnector;
import org.eclipse.persistence.sessions.broker.SessionBroker;
import org.eclipse.persistence.sessions.server.ServerSession;
import org.eclipse.persistence.testing.framework.server.JEEPlatform;
import org.eclipse.persistence.testing.framework.server.ServerPlatform;
import org.eclipse.persistence.testing.framework.server.WebLogicPlatform;
import org.eclipse.persistence.testing.framework.server.TestRunner;
import org.eclipse.persistence.testing.framework.server.TestRunner1;
import org.eclipse.persistence.testing.framework.server.TestRunner2;
Expand Down Expand Up @@ -298,7 +300,12 @@ public static ServerPlatform getServerPlatform() {
if (serverPlatform == null) {
String platformClass = System.getProperty("TEST_SERVER_PLATFORM");
if (platformClass == null) {
serverPlatform = new JEEPlatform();
String detectedServerPlatform = ServerPlatformUtils.detectServerPlatform(null);
if (detectedServerPlatform != null && detectedServerPlatform.contains("WebLogic")) {
serverPlatform = new WebLogicPlatform();
} else {
serverPlatform = new JEEPlatform();
}
} else {
try {
serverPlatform = (ServerPlatform)Class.forName(platformClass).newInstance();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -363,27 +363,28 @@ public void testSessionXMLProperty() {
}

public void testLoginEncryptorProperty() {
EntityManager em = createEntityManager(persistenceUnitName);
try {
//Create new customer
beginTransaction(em);
Customer customer = ModelExamples.customerExample1();
em.persist(customer);
em.flush();
Integer customerId = customer.getCustomerId();
commitTransaction(em);

customer = em.find(org.eclipse.persistence.testing.models.jpa.jpaadvancedproperties.Customer.class, customerId);
//Purge it
beginTransaction(em);
em.remove(customer);
commitTransaction(em);

assertNotNull(customer);
assertTrue("CustomizedEncryptor.encryptPassword() method wasn't called.", CustomizedEncryptor.encryptPasswordCounter > 0);
assertTrue("CustomizedEncryptor.decryptPassword() method wasn't called.", CustomizedEncryptor.decryptPasswordCounter > 0);
} finally {
closeEntityManager(em);
if (!isOnServer()) {
EntityManager em = createEntityManager(persistenceUnitName);
try {
//Create new customer
beginTransaction(em);
Customer customer = ModelExamples.customerExample1();
em.persist(customer);
em.flush();
Integer customerId = customer.getCustomerId();
commitTransaction(em);

//Purge it
beginTransaction(em);
em.remove(em.find(org.eclipse.persistence.testing.models.jpa.jpaadvancedproperties.Customer.class, customerId));
commitTransaction(em);

assertNotNull(customer);
assertTrue("CustomizedEncryptor.encryptPassword() method wasn't called.", CustomizedEncryptor.encryptPasswordCounter > 0);
assertTrue("CustomizedEncryptor.decryptPassword() method wasn't called.", CustomizedEncryptor.decryptPasswordCounter > 0);
} finally {
closeEntityManager(em);
}
}
}
}

0 comments on commit 39c89db

Please sign in to comment.