Skip to content

Commit

Permalink
remove obsolete testrunners,
Browse files Browse the repository at this point in the history
remove isJpa10 checks

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Sep 7, 2022
1 parent ad3d6bb commit 8e8c7bb
Show file tree
Hide file tree
Showing 16 changed files with 86 additions and 540 deletions.
16 changes: 0 additions & 16 deletions foundation/org.eclipse.persistence.core.test.framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<release>8</release>
<!-- openjdk11 fails without this being set -->
<detectOfflineLinks>false</detectOfflineLinks>
<additionalJOptions>
<additionalJOption>-Xdoclint:-html</additionalJOption>
</additionalJOptions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
requires transitive jakarta.resource;

requires transitive org.eclipse.persistence.core;
requires oracle.nosql.client;
requires nosqldriver;

exports org.eclipse.persistence.eis.adapters.aq;
exports org.eclipse.persistence.nosql.adapters.nosql;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,7 @@ public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(suiteSpring());
suite.addTest(new EntityManagerJUnitTestSuite("testCacheUsage"));

if (!isJPA10()) {
suite.addTest(new EntityManagerJUnitTestSuite("testIsLoaded"));
}
suite.addTest(new EntityManagerJUnitTestSuite("testIsLoaded"));
return suite;
}

Expand Down Expand Up @@ -492,33 +489,32 @@ public static Test suiteSpring() {
// if (isJPA21()){
// tests.add("testUnsynchronizedPC");
// }
if (!isJPA10()) {
tests.add("testDetachNull");
tests.add("testDetachRemovedObject");
tests.add("testLockingLeftJoinOneToOneQuery");
tests.add("testLockingLeftJoinOneToOneQuery2");
tests.add("testGetProperties");
tests.add("testDetachNonEntity");
tests.add("testFindWithProperties");
tests.add("testDetachManagedObject");
tests.add("testDetachNonManagedObject");
tests.add("testPESSIMISTIC_FORCE_INCREMENTLock");
tests.add("testGetLockModeType");
tests.add("testGetEntityManagerFactory");
tests.add("testConnectionPolicySetProperty");
//Does not return underlying entitymanager tests.add("testUnWrapClass");
tests.add("testIsLoaded");
tests.add("testIsLoadedAttribute");
tests.add("testGetIdentifier");
tests.add("testGetHints");
tests.add("testPESSIMISTIC_FORCE_INCREMENTLockOnNonVersionedEntity");
tests.add("testSelectEmbeddable");
tests.add("testNonPooledConnection");
tests.add("testExclusiveIsolatedLeaksConnectionOnClear");
tests.add("testSetTargetQueryOneToMany");
tests.add("testNestedFetchQueryHints");
tests.add("testInheritanceFetchJoinSecondCall");
}
tests.add("testDetachNull");
tests.add("testDetachRemovedObject");
tests.add("testLockingLeftJoinOneToOneQuery");
tests.add("testLockingLeftJoinOneToOneQuery2");
tests.add("testGetProperties");
tests.add("testDetachNonEntity");
tests.add("testFindWithProperties");
tests.add("testDetachManagedObject");
tests.add("testDetachNonManagedObject");
tests.add("testPESSIMISTIC_FORCE_INCREMENTLock");
tests.add("testGetLockModeType");
tests.add("testGetEntityManagerFactory");
tests.add("testConnectionPolicySetProperty");
//Does not return underlying entitymanager tests.add("testUnWrapClass");
tests.add("testIsLoaded");
tests.add("testIsLoadedAttribute");
tests.add("testGetIdentifier");
tests.add("testGetHints");
tests.add("testPESSIMISTIC_FORCE_INCREMENTLockOnNonVersionedEntity");
tests.add("testSelectEmbeddable");
tests.add("testNonPooledConnection");
tests.add("testExclusiveIsolatedLeaksConnectionOnClear");
tests.add("testSetTargetQueryOneToMany");
tests.add("testNestedFetchQueryHints");
tests.add("testInheritanceFetchJoinSecondCall");

tests.add("testDetachChildObjects");
tests.add("testAutoCloseable");

Expand All @@ -527,9 +523,7 @@ public static Test suiteSpring() {
for (String test : tests) {
suite.addTest(new EntityManagerJUnitTestSuite(test));
}
if (!isJPA10()) {
suite.addTest(new EntityManagerJUnitTestSuite("testCascadeDetach"));
}
suite.addTest(new EntityManagerJUnitTestSuite("testCascadeDetach"));
// Test must be last as clears database.
suite.addTest(new EntityManagerJUnitTestSuite("testDeleteEverything"));
return suite;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,39 @@ public PessimisticLockEntityRefreshTestSuite(String name) {

public static Test suite() {
TestSuite suite = new TestSuite("PessimisticLocking Entity Refresh TestSuite");
if (!isJPA10()) {
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testSetup"));

// test lock-on-find an object multiple times with the same lock type
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockFind"));

// test lock-on-find an object then find it again with no lock type
// no refresh is expected on a subsequent normal (no lock) find
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockAndNormalFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockAndNormalFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockAndNormalFind"));

suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadThenWriteLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteThenReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenWriteLockFind"));

// test finding and locking an object multiple times with the same lock type
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockFindAndLock"));

// test finding and lock an object then find it again with no lock type
// no refresh is ever expected on a subsequent normal (no lock) find
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockAndNormalFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockAndNormalFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockAndNormalFindAndLock"));

suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadThenWriteLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteThenReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenWriteLockFindAndLock"));
}
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testSetup"));

// test lock-on-find an object multiple times with the same lock type
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockFind"));

// test lock-on-find an object then find it again with no lock type
// no refresh is expected on a subsequent normal (no lock) find
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockAndNormalFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockAndNormalFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockAndNormalFind"));

suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadThenWriteLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteThenReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenReadLockFind"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenWriteLockFind"));

// test finding and locking an object multiple times with the same lock type
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockFindAndLock"));

// test finding and lock an object then find it again with no lock type
// no refresh is ever expected on a subsequent normal (no lock) find
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadLockAndNormalFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteLockAndNormalFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementLockAndNormalFindAndLock"));

suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticReadThenWriteLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticWriteThenReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenReadLockFindAndLock"));
suite.addTest(new PessimisticLockEntityRefreshTestSuite("testPessimisticForceIncrementThenWriteLockFindAndLock"));
return suite;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ public static Test suite() {
suite.addTest(new InheritedModelJunitTest("testNodeImplWeaving"));
suite.addTest(new InheritedModelJunitTest("testEmbeddaleCollectionMapEmbeddableRead"));
suite.addTest(new InheritedModelJunitTest("testCopyMapKeyMap"));
if (!isJPA10()) {
suite.addTest(new InheritedModelJunitTest("testInterfaces"));
}
suite.addTest(new InheritedModelJunitTest("testInterfaces"));

return suite;
}
Expand Down
14 changes: 0 additions & 14 deletions jpa/org.eclipse.persistence.jpa.test.framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<release>8</release>
<!-- openjdk11 fails without this being set -->
<detectOfflineLinks>false</detectOfflineLinks>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.framework.jpa.junit;

import java.util.HashMap;
import java.util.Map;
import jakarta.persistence.EntityManager;

import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.internal.jpa.EntityManagerImpl;
import org.eclipse.persistence.logging.AbstractSessionLog;
import org.eclipse.persistence.sessions.Session;
import org.eclipse.persistence.sessions.DatabaseLogin;
import org.eclipse.persistence.sessions.Session;
import org.eclipse.persistence.sessions.server.ServerSession;
import org.eclipse.persistence.testing.framework.TestModel;

import org.eclipse.persistence.testing.framework.junit.JUnitTestCaseHelper;

import java.util.HashMap;
import java.util.Map;

/**
* <p><b>Purpose</b>: Base class for CMP3 Test Models.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package org.eclipse.persistence.testing.framework.jpa.junit;

import jakarta.persistence.EntityManager;
import org.eclipse.persistence.testing.framework.*;
import org.eclipse.persistence.testing.framework.AutoVerifyTestCase;

public class EntityContainerTestBase extends AutoVerifyTestCase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,10 @@
// - 520387: multiple owning descriptors for an embeddable are not set
package org.eclipse.persistence.testing.framework.jpa.junit;

import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityManagerFactory;
import jakarta.persistence.LockModeType;
import jakarta.persistence.Persistence;

import junit.framework.TestCase;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.internal.databaseaccess.DatabasePlatform;
Expand All @@ -53,13 +39,24 @@
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.jpa.server.JEEPlatform;
import org.eclipse.persistence.testing.framework.jpa.server.ServerPlatform;
import org.eclipse.persistence.testing.framework.jpa.server.TestRunner;
import org.eclipse.persistence.testing.framework.junit.JUnitTestCaseHelper;
import org.eclipse.persistence.testing.framework.jpa.server.JEEPlatform;
import org.eclipse.persistence.transaction.JTA11TransactionController;

import junit.framework.TestCase;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

/**
* This is the superclass for all EclipseLink JUnit tests
Expand All @@ -84,7 +81,7 @@ public abstract class JUnitTestCase extends TestCase {
private static Map<String, EntityManagerFactory> emfNamedPersistenceUnits = null;

/** Default persistence unit name. */
private static String DEFAULT_PU_NAME = "default";
private static final String DEFAULT_PU_NAME = "default";

/** Determine if the test is running on a JEE server, or in JSE. */
protected static Boolean isOnServer;
Expand Down Expand Up @@ -288,20 +285,6 @@ public static boolean isWeavingEnabled(String persistenceUnitName) {
return System.getProperty("TEST_NO_WEAVING") == null;
}

/**
* Return if the test is running against JPA 1.0. Any test that uses 2.0
* functionality should call this method to avoid been run against a 1.0
* container.
*/
public static boolean isJPA10() {
try {
LockModeType.valueOf("NONE");
} catch (Exception e) {
return true;
}
return false;
}

/**
* Return if the test is running on a JEE server, or in JSE.
*/
Expand Down Expand Up @@ -766,57 +749,7 @@ public void runBareClient() throws Throwable {
}
}
} else {
//use defined set of pre-configured test runners
Throwable exception = null;
if (puName == null) {
String testrunner = System.getProperty("server.testrunner");
if (testrunner == null) {
fail("System property 'server.testrunner' must be set.");
}
TestRunner runner = (TestRunner) context.lookup(testrunner);
exception = runner.runTest(getClass().getName(), getName(), getServerProperties());
} else {
int i = puName.charAt(8) - 48;
String testRunner[] = new String[7];
for (int j = 1; j <= 6; j++) {
String serverRunner = "server.testrunner" + j;
testRunner[j] = System.getProperty(serverRunner);
if (testRunner[j] == null && j < 6) {
fail("System property 'server.testrunner'" + j + " must be set.");
}
}
switch (i) {
case 1:
TestRunner runner1 = (TestRunner) context.lookup(testRunner[1]);
exception = runner1.runTest(getClass().getName(), getName(), getServerProperties());
break;
case 2:
TestRunner runner2 = (TestRunner) context.lookup(testRunner[2]);
exception = runner2.runTest(getClass().getName(), getName(), getServerProperties());
break;
case 3:
TestRunner runner3 = (TestRunner) context.lookup(testRunner[3]);
exception = runner3.runTest(getClass().getName(), getName(), getServerProperties());
break;
case 4:
TestRunner runner4 = (TestRunner) context.lookup(testRunner[4]);
exception = runner4.runTest(getClass().getName(), getName(), getServerProperties());
break;
case 5:
TestRunner runner5 = (TestRunner) context.lookup(testRunner[5]);
exception = runner5.runTest(getClass().getName(), getName(), getServerProperties());
break;
case 6:
TestRunner runner6 = (TestRunner) context.lookup(testRunner[6]);
exception = runner6.runTest(getClass().getName(), getName(), getServerProperties());
break;
default:
break;
}
}
if (exception != null) {
throw exception;
}
fail("System property 'server.testrunner.context' must be set.");
}
}

Expand Down

0 comments on commit 8e8c7bb

Please sign in to comment.