You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2024/01/02 15:20:57 UTC
(db-jdo) branch JDO-831 updated: JDO-831: First version of parallel execution of query test cases where possible
This is an automated email from the ASF dual-hosted git repository.
mbo pushed a commit to branch JDO-831
in repository https://gitbox.apache.org/repos/asf/db-jdo.git
The following commit(s) were added to refs/heads/JDO-831 by this push:
new 8aa2d750 JDO-831: First version of parallel execution of query test cases where possible
8aa2d750 is described below
commit 8aa2d7502b4bb7cb20fad8dd301bd10162973ca2
Author: Michael Bouschen <Mi...@akquinet.de>
AuthorDate: Tue Jan 2 16:20:34 2024 +0100
JDO-831: First version of parallel execution of query test cases where possible
---
.../main/java/org/apache/jdo/exectck/RunTCK.java | 2 +
.../java/org/apache/jdo/tck/pc/mylib/PCPoint.java | 24 +
.../java/org/apache/jdo/tck/query/QueryTest.java | 143 +-
.../apache/jdo/tck/query/api/AutoCloseable.java | 20 +-
.../org/apache/jdo/tck/query/api/ChangeQuery.java | 2 +-
.../apache/jdo/tck/query/api/DeclareImports.java | 57 +-
.../jdo/tck/query/api/DeclareParameters.java | 62 +-
.../apache/jdo/tck/query/api/DeclareVariables.java | 44 +-
.../org/apache/jdo/tck/query/api/ExecuteQuery.java | 62 +-
.../jdo/tck/query/api/ExecuteQueryWithArray.java | 49 +-
.../jdo/tck/query/api/ExecuteQueryWithMap.java | 49 +-
.../org/apache/jdo/tck/query/api/GetFetchPlan.java | 48 +-
.../apache/jdo/tck/query/api/GetIgnoreCache.java | 45 +-
.../jdo/tck/query/api/GetPersistenceManager.java | 44 +-
.../jdo/tck/query/api/MetadataSearchOrder.java | 30 +-
.../apache/jdo/tck/query/api/NewNamedQuery.java | 42 +-
.../jdo/tck/query/api/NewQuerySingleString.java | 2 +-
.../tck/query/api/NewQueryWithCandidateClass.java | 4 +-
.../NewQueryWithCandidateClassAndCollection.java | 6 +-
.../api/NewQueryWithCandidateClassAndExtent.java | 4 +-
...NewQueryWithCandidateClassCollectionFilter.java | 2 +-
.../jdo/tck/query/api/NewQueryWithExtent.java | 4 +-
.../org/apache/jdo/tck/query/api/QueryCancel.java | 158 +-
.../apache/jdo/tck/query/api/QueryExtentions.java | 2 +-
.../jdo/tck/query/api/SampleReadQueries.java | 599 +--
.../apache/jdo/tck/query/api/SaveAsNamedQuery.java | 3 +-
.../jdo/tck/query/api/SetCandidateCollection.java | 2 +-
.../org/apache/jdo/tck/query/api/SetGrouping.java | 2 +-
.../apache/jdo/tck/query/api/SetIgnoreCache.java | 44 +-
.../org/apache/jdo/tck/query/api/SetOrdering.java | 57 +-
.../org/apache/jdo/tck/query/api/SetRange.java | 2 +-
.../org/apache/jdo/tck/query/api/SetResult.java | 47 +-
.../apache/jdo/tck/query/api/SetResultClass.java | 2 +-
.../org/apache/jdo/tck/query/api/SetUnique.java | 4 +-
.../tck/query/api/SetterReplacePreviousValues.java | 6 +
.../jdo/tck/query/api/SingleStringQuery.java | 3 +-
.../jdo/tck/query/api/UnmodifiableQuery.java | 85 +-
.../jdo/tck/query/delete/DeleteQueryElements.java | 8 +-
.../java/org/apache/jdo/tck/query/jdoql/Cast.java | 131 +-
.../query/jdoql/CharacterAndStringLiterals.java | 133 +-
.../jdoql/ComparingCollectionFieldToNull.java | 8 +-
...omparingPersistentAndNonPersistentInstance.java | 139 +-
.../tck/query/jdoql/DenoteUniquenessInFilter.java | 172 +-
...gMultipleQueriesSimultaneouslyIsThreadSafe.java | 2 +-
.../org/apache/jdo/tck/query/jdoql/Having.java | 137 +-
.../query/jdoql/IdentifiersEqualFieldNames.java | 288 +-
.../apache/jdo/tck/query/jdoql/IfElseInFilter.java | 282 +-
.../tck/query/jdoql/MultipleIdenticalImports.java | 214 +-
.../query/jdoql/NavigationComparisonWithNull.java | 651 ++--
.../jdoql/NavigationThroughACollectionField.java | 6 +-
.../jdoql/NavigationThroughANullValuedField.java | 237 +-
...NavigationThroughReferencesUsesDotOperator.java | 235 +-
.../apache/jdo/tck/query/jdoql/NegativeRange.java | 219 +-
.../jdoql/NullCollectionsAndContainsMethod.java | 143 +-
.../tck/query/jdoql/NullCollectionsAndIsEmpty.java | 8 +-
.../jdo/tck/query/jdoql/OrderingSpecification.java | 150 +-
.../apache/jdo/tck/query/jdoql/PositiveRange.java | 235 +-
.../apache/jdo/tck/query/jdoql/RangeAsString.java | 236 +-
.../query/jdoql/SeparateNamespaceForTypeNames.java | 132 +-
.../query/jdoql/keywords/InvalidUseOfKeywords.java | 46 +-
.../query/jdoql/keywords/KeywordsAsFieldNames.java | 31 +-
.../jdo/tck/query/jdoql/keywords/SingleString.java | 4 +-
.../query/jdoql/keywords/UppercaseLowercase.java | 27 +-
.../keywords/UseOfThisToAcessHiddenField.java | 49 +-
.../MethodsAndObjectConstructionNotSupported.java | 54 +-
.../query/jdoql/methods/StartsWithAndEndsWith.java | 113 +-
.../jdoql/methods/SupportedCollectionMethods.java | 304 +-
.../query/jdoql/methods/SupportedDateMethods.java | 178 +-
.../jdoql/methods/SupportedJDOHelperMethods.java | 171 +-
.../query/jdoql/methods/SupportedListMethods.java | 139 +-
.../jdoql/methods/SupportedLocalDateMethods.java | 32 +-
.../methods/SupportedLocalDateTimeMethods.java | 48 +-
.../jdoql/methods/SupportedLocalTimeMethods.java | 35 +-
.../query/jdoql/methods/SupportedMapMethods.java | 282 +-
.../query/jdoql/methods/SupportedMathMethods.java | 819 ++--
.../jdoql/methods/SupportedOptionalMethods.java | 490 ++-
.../jdoql/methods/SupportedStringMethods.java | 862 +++--
.../query/jdoql/methods/SupportedTimeMethods.java | 24 +-
.../tck/query/jdoql/operators/BinaryAddition.java | 87 +-
.../query/jdoql/operators/BinarySubtraction.java | 86 +-
.../jdoql/operators/BitwiseBinaryOperators.java | 156 +-
.../query/jdoql/operators/BitwiseComplement.java | 72 +-
.../query/jdoql/operators/BooleanLogicalAND.java | 164 +-
.../query/jdoql/operators/BooleanLogicalOR.java | 208 +-
.../tck/query/jdoql/operators/ComparisonTests.java | 25 +-
.../tck/query/jdoql/operators/ConditionalAND.java | 167 +-
.../tck/query/jdoql/operators/ConditionalOR.java | 189 +-
.../jdo/tck/query/jdoql/operators/Equality.java | 3016 +++++++++------
...dComparisonsBetweenDateFieldsAndParameters.java | 211 +-
...risonsBetweenPrimitivesAndWrapperInstances.java | 119 +-
...omparisonsBetweenStringFieldsAndParameters.java | 204 +-
.../jdo/tck/query/jdoql/operators/GreaterThan.java | 3978 ++++++++++++--------
.../query/jdoql/operators/GreaterThanOrEqual.java | 3945 +++++++++++--------
.../jdo/tck/query/jdoql/operators/Instanceof.java | 117 +-
.../jdo/tck/query/jdoql/operators/LessThan.java | 3943 +++++++++++--------
.../tck/query/jdoql/operators/LessThanOrEqual.java | 3946 +++++++++++--------
.../query/jdoql/operators/LogicalComplement.java | 146 +-
...java => LogicalComplementWithNullInstance.java} | 98 +-
.../jdo/tck/query/jdoql/operators/Modulo.java | 97 +-
.../jdo/tck/query/jdoql/operators/NotEquals.java | 3074 +++++++++------
.../query/jdoql/operators/StringConcatenation.java | 131 +-
.../query/jdoql/parameters/ImplicitParameters.java | 233 +-
.../query/jdoql/parameters/MixedParameters.java | 31 +-
.../query/jdoql/parameters/OrderOfParameters.java | 17 +-
...eclaredWithSameNameAsFieldOfCandidateClass.java | 75 +-
.../query/jdoql/subqueries/AggregateOnSize.java | 13 +-
.../jdoql/subqueries/CorrelatedSubqueries.java | 43 +-
.../CorrelatedSubqueriesWithParameters.java | 232 +-
.../subqueries/MultipleCallsReplaceSubquery.java | 2 +-
.../jdoql/subqueries/NonCorrelatedSubqueries.java | 168 +-
.../NullCandidateCollectionExpression.java | 4 +-
.../jdoql/subqueries/NullSubqueryParameter.java | 11 +-
.../jdoql/subqueries/NullVariableDeclaration.java | 76 +-
.../subqueries/UnmodifiedSubqueryInstance.java | 109 +-
.../tck/query/jdoql/variables/MixedVariables.java | 31 +-
.../jdoql/variables/UnconstrainedVariable.java | 6 +-
.../query/jdoql/variables/VariablesAndFields.java | 339 +-
.../jdoql/variables/VariablesWithoutExtent.java | 4 +-
.../jdo/tck/query/result/AggregateResult.java | 1615 ++++----
.../apache/jdo/tck/query/result/DefaultResult.java | 6 +-
.../apache/jdo/tck/query/result/DefaultUnique.java | 598 +--
.../query/result/DistinctCandidateInstances.java | 176 +-
.../apache/jdo/tck/query/result/DistinctQuery.java | 235 +-
.../org/apache/jdo/tck/query/result/Grouping.java | 74 +-
.../apache/jdo/tck/query/result/IfElseResult.java | 219 +-
.../jdo/tck/query/result/MethodsInResult.java | 335 +-
.../jdo/tck/query/result/NPEInResultExpr.java | 117 +-
.../apache/jdo/tck/query/result/NullResults.java | 182 +-
.../tck/query/result/ResultClassRequirements.java | 623 +--
.../jdo/tck/query/result/ResultExpressions.java | 1034 ++---
.../apache/jdo/tck/query/result/ShapeOfResult.java | 585 +--
.../org/apache/jdo/tck/query/result/Unique.java | 197 +-
.../jdo/tck/query/result/VariableInResult.java | 294 +-
.../result/VariableInResultMultipleNavigation.java | 232 +-
.../query/result/VariableInResultNavigation.java | 312 +-
.../jdo/tck/query/sql/AllowedAPIMethods.java | 170 +-
.../apache/jdo/tck/query/sql/ExecuteWithMap.java | 223 +-
.../org/apache/jdo/tck/query/sql/NewQuery.java | 2 +
.../apache/jdo/tck/query/sql/NoCandidateClass.java | 51 +-
.../apache/jdo/tck/query/sql/ShapeOfResult.java | 259 +-
tck/src/main/resources/conf/jdoql.conf | 1 +
.../tck/pc/company/companyForSampleQueriesTest.xml | 2 +-
142 files changed, 25245 insertions(+), 17105 deletions(-)
diff --git a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
index 16eebed1..2ac8db99 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
@@ -546,6 +546,8 @@ public class RunTCK extends AbstractTCKMojo {
command.add("--disable-ansi-colors");
}
command.add("--details=" + testRunnerDetails);
+ command.add("--config");
+ command.add("junit.jupiter.execution.parallel.enabled=true");
// add Test classes
for (String testClass : classesList) {
// skip empty entries
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCPoint.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCPoint.java
index dc19c5c5..c44eb790 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCPoint.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCPoint.java
@@ -48,6 +48,12 @@ public class PCPoint implements Serializable {
this.y = Integer.valueOf(y);
}
+ public PCPoint(PCPoint pcPoint) {
+ this.id = pcPoint.id;
+ this.x = pcPoint.x;
+ this.y = pcPoint.y;
+ }
+
public PCPoint(int x, Integer y) {
this.x = x;
this.y = y;
@@ -65,6 +71,24 @@ public class PCPoint implements Serializable {
return rc;
}
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return (int) id;
+ }
+
+ /**
+ * @see Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object other) {
+ if (other != null && (other instanceof PCPoint)) {
+ PCPoint o = (PCPoint) other;
+ return o.id == this.id;
+ }
+ return false;
+ }
+
public void setX(int x) {
this.x = x;
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java
index 843ecadd..a4ab73f5 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java
@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Map;
import javax.jdo.JDOException;
import javax.jdo.JDOFatalInternalException;
+import javax.jdo.JDOHelper;
import javax.jdo.JDOQLTypedQuery;
import javax.jdo.JDOUserException;
import javax.jdo.PersistenceManager;
@@ -56,7 +57,13 @@ public abstract class QueryTest extends AbstractReaderTest {
public static final String MYLIB_TESTDATA = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml";
/** List of inserted instances (see methods insertPCPoints and getFromInserted). */
- protected final List<PCPoint> inserted = new ArrayList<>();
+ protected final List<PCPoint> persistentPCPoints = new ArrayList<>();
+
+ /**
+ * List of transient copies of inserted instances (see methods insertPCPoints and
+ * getFromInserted).
+ */
+ protected final List<PCPoint> transientPCPoints = new ArrayList<>();
/**
* The company model reader is used to read company model instances from an XML file. Instances
@@ -103,7 +110,8 @@ public abstract class QueryTest extends AbstractReaderTest {
for (int i = 0; i < numInsert; i++) {
PCPoint pc = new PCPoint(i, i);
pm.makePersistent(pc);
- inserted.add(pc);
+ persistentPCPoints.add(pc);
+ transientPCPoints.add(new PCPoint(pc));
}
tx.commit();
tx = null;
@@ -122,7 +130,7 @@ public abstract class QueryTest extends AbstractReaderTest {
List<PCPoint> result = new ArrayList<>();
for (PCPoint pc : list) {
- for (PCPoint pci : inserted) {
+ for (PCPoint pci : persistentPCPoints) {
if (pc.getX() == pci.getX()) {
result.add(pci);
break;
@@ -132,6 +140,28 @@ public abstract class QueryTest extends AbstractReaderTest {
return result;
}
+ public PCPoint getTransientPCPoint(int x) {
+ PCPoint result = null;
+ for (PCPoint pc : transientPCPoints) {
+ if (x == pc.getX()) {
+ result = pc;
+ break;
+ }
+ }
+ return result;
+ }
+
+ public PCPoint getPersistentPCPoint(PersistenceManager pm, int x) {
+ PCPoint result = null;
+ for (PCPoint pc : persistentPCPoints) {
+ if (x == pc.getX()) {
+ Object oid = JDOHelper.getObjectId(pc);
+ result = (PCPoint) pm.getObjectId(oid);
+ }
+ }
+ return result;
+ }
+
// Company model and mylib helper methods
/**
@@ -252,6 +282,17 @@ public abstract class QueryTest extends AbstractReaderTest {
: getBean(getCompanyModelReaderForPersistentInstances(), clazz, beanName);
}
+ protected <T> T getPersistentCompanyModelInstance(
+ PersistenceManager pm, Class<T> clazz, String beanName) {
+ T instance = null;
+ if (beanName != null) {
+ instance = getBean(getCompanyModelReaderForPersistentInstances(), clazz, beanName);
+ Object id = JDOHelper.getObjectId(instance);
+ instance = (T) pm.getObjectById(id, false);
+ }
+ return instance;
+ }
+
/**
* Returns a transient company model instance for the given bean name.
*
@@ -280,6 +321,16 @@ public abstract class QueryTest extends AbstractReaderTest {
}
return result;
}
+
+ protected <T> List<T> getPersistentCompanyModelInstancesAsList(
+ PersistenceManager pm, Class<T> elementType, String... beanNames) {
+ List<T> result = new ArrayList<>(beanNames.length);
+ for (String beanName : beanNames) {
+ result.add(getPersistentCompanyModelInstance(pm, elementType, beanName));
+ }
+ return result;
+ }
+
/**
* Returns a list of transient company model instances for beans names in the given argument.
*
@@ -895,11 +946,14 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param positive determines if the compilation is supposed to succeed or to fail.
*/
protected void compileAPIQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, boolean positive) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ boolean positive) {
if (logger.isDebugEnabled()) {
logger.debug("Compiling API query: " + queryElementHolder);
}
- compile(assertion, queryElementHolder, false, queryElementHolder.toString(), positive);
+ compile(assertion, pm, queryElementHolder, false, queryElementHolder.toString(), positive);
}
/**
@@ -914,10 +968,13 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param positive determines if the compilation is supposed to succeed or to fail.
*/
protected void compileSingleStringQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, boolean positive) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ boolean positive) {
if (logger.isDebugEnabled())
logger.debug("Compiling single string query: " + queryElementHolder);
- compile(assertion, queryElementHolder, true, queryElementHolder.toString(), positive);
+ compile(assertion, pm, queryElementHolder, true, queryElementHolder.toString(), positive);
}
/**
@@ -932,10 +989,10 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param positive determines if the compilation is supposed to succeed or to fail.
*/
protected void compileSingleStringQuery(
- String assertion, String singleStringQuery, boolean positive) {
+ String assertion, PersistenceManager pm, String singleStringQuery, boolean positive) {
if (logger.isDebugEnabled())
logger.debug("Compiling single string query: " + singleStringQuery);
- compile(assertion, null, true, singleStringQuery, positive);
+ compile(assertion, pm, null, true, singleStringQuery, positive);
}
/**
@@ -958,11 +1015,11 @@ public abstract class QueryTest extends AbstractReaderTest {
*/
private void compile(
String assertion,
+ PersistenceManager pm,
QueryElementHolder<?> queryElementHolder,
boolean asSingleString,
String singleStringQuery,
boolean positive) {
- getPM();
try {
Query<?> query;
if (queryElementHolder != null) {
@@ -972,9 +1029,9 @@ public abstract class QueryTest extends AbstractReaderTest {
query = queryElementHolder.getAPIQuery(pm);
}
} else {
- query = getPM().newQuery(singleStringQuery);
+ query = pm.newQuery(singleStringQuery);
}
- compile(assertion, query, singleStringQuery, positive);
+ compile(assertion, pm, query, singleStringQuery, positive);
} catch (JDOUserException e) {
// This exception handler considers a JDOUserException
// to be thrown in newQuery methods.
@@ -1002,8 +1059,8 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param queryText the text representation of the query
* @param positive positive test
*/
- protected void compile(String assertion, Query<?> query, String queryText, boolean positive) {
- getPM();
+ protected void compile(
+ String assertion, PersistenceManager pm, Query<?> query, String queryText, boolean positive) {
Transaction tx = pm.currentTransaction();
tx.begin();
try {
@@ -1040,11 +1097,14 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param expectedResult the expected query result.
*/
protected void executeAPIQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, Object expectedResult) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ Object expectedResult) {
if (logger.isDebugEnabled()) {
logger.debug("Executing API query: " + queryElementHolder);
}
- execute(assertion, queryElementHolder, false, expectedResult);
+ execute(assertion, pm, queryElementHolder, false, expectedResult);
}
/**
@@ -1058,10 +1118,13 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param expectedResult the expected query result.
*/
protected void executeSingleStringQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, Object expectedResult) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ Object expectedResult) {
if (logger.isDebugEnabled())
logger.debug("Executing single string query: " + queryElementHolder);
- execute(assertion, queryElementHolder, true, expectedResult);
+ execute(assertion, pm, queryElementHolder, true, expectedResult);
}
/**
@@ -1070,8 +1133,11 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param expectedResult expected query result
*/
protected void executeJDOQLTypedQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, Object expectedResult) {
- executeJDOQLTypedQuery(assertion, queryElementHolder, null, false, expectedResult);
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ Object expectedResult) {
+ executeJDOQLTypedQuery(assertion, pm, queryElementHolder, null, false, expectedResult);
}
/**
@@ -1083,12 +1149,12 @@ public abstract class QueryTest extends AbstractReaderTest {
*/
protected void executeJDOQLTypedQuery(
String assertion,
+ PersistenceManager pm,
QueryElementHolder<?> queryElementHolder,
Class<?> resultClass,
boolean resultClauseSpecified,
Object expectedResult) {
String singleStringQuery = queryElementHolder.toString();
- getPM();
Transaction tx = pm.currentTransaction();
tx.begin();
try {
@@ -1159,7 +1225,7 @@ public abstract class QueryTest extends AbstractReaderTest {
/**
* Converts the given query element holder instance to a JDO query instance, based on argument
* <code>asSingleString</code>. Afterwards, delegates to method {@link QueryTest#execute(String,
- * Query, String, boolean, Object, Object, boolean)}.
+ * PersistenceManager, Query, String, boolean, Object, Object, boolean)}.
*
* @param assertion the assertion to prompt if the test case fails.
* @param queryElementHolder the query to execute.
@@ -1170,10 +1236,10 @@ public abstract class QueryTest extends AbstractReaderTest {
*/
private Object execute(
String assertion,
+ PersistenceManager pm,
QueryElementHolder<?> queryElementHolder,
boolean asSingleString,
Object expectedResult) {
- getPM();
Query<?> query =
asSingleString
? queryElementHolder.getSingleStringQuery(pm)
@@ -1181,6 +1247,7 @@ public abstract class QueryTest extends AbstractReaderTest {
Object result =
execute(
assertion,
+ pm,
query,
queryElementHolder.toString(),
queryElementHolder.hasOrdering(),
@@ -1206,6 +1273,7 @@ public abstract class QueryTest extends AbstractReaderTest {
*/
protected Object executeJDOQuery(
String assertion,
+ PersistenceManager pm,
Query<?> query,
String singleStringQuery,
boolean hasOrdering,
@@ -1216,7 +1284,7 @@ public abstract class QueryTest extends AbstractReaderTest {
logger.debug("Executing JDO query: " + singleStringQuery);
}
return execute(
- assertion, query, singleStringQuery, hasOrdering, parameters, expectedResult, positive);
+ assertion, pm, query, singleStringQuery, hasOrdering, parameters, expectedResult, positive);
}
/**
@@ -1239,6 +1307,7 @@ public abstract class QueryTest extends AbstractReaderTest {
@SuppressWarnings("unchecked")
protected <T> void executeSQLQuery(
String assertion,
+ PersistenceManager pm,
String sql,
Class<T> candidateClass,
Class<?> resultClass,
@@ -1249,7 +1318,7 @@ public abstract class QueryTest extends AbstractReaderTest {
String schema = getPMFProperty("javax.jdo.mapping.Schema");
sql = MessageFormat.format(sql, new Object[] {schema});
if (logger.isDebugEnabled()) logger.debug("Executing SQL query: " + sql);
- Query<T> query = getPM().newQuery("javax.jdo.query.SQL", sql);
+ Query<T> query = pm.newQuery("javax.jdo.query.SQL", sql);
if (unique) {
query.setUnique(unique);
}
@@ -1259,7 +1328,7 @@ public abstract class QueryTest extends AbstractReaderTest {
if (resultClass != null) {
query.setResultClass(resultClass);
}
- execute(assertion, query, sql, false, parameters, expectedResult, positive);
+ execute(assertion, pm, query, sql, false, parameters, expectedResult, positive);
}
/**
@@ -1297,6 +1366,7 @@ public abstract class QueryTest extends AbstractReaderTest {
@SuppressWarnings("unchecked")
private Object execute(
String assertion,
+ PersistenceManager pm,
Query<?> query,
String singleStringQuery,
boolean hasOrdering,
@@ -1304,7 +1374,6 @@ public abstract class QueryTest extends AbstractReaderTest {
Object expectedResult,
boolean positive) {
Object result = null;
- getPM();
Transaction tx = pm.currentTransaction();
tx.begin();
try {
@@ -1401,11 +1470,14 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param expectedNrOfDeletedObjects the expected number of deleted objects.
*/
protected void deletePersistentAllByAPIQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, long expectedNrOfDeletedObjects) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ long expectedNrOfDeletedObjects) {
if (logger.isDebugEnabled()) {
logger.debug("Deleting persistent by API query: " + queryElementHolder);
}
- delete(assertion, queryElementHolder, false, expectedNrOfDeletedObjects);
+ delete(assertion, pm, queryElementHolder, false, expectedNrOfDeletedObjects);
}
/**
@@ -1421,11 +1493,14 @@ public abstract class QueryTest extends AbstractReaderTest {
* @param expectedNrOfDeletedObjects the expected number of deleted objects.
*/
protected void deletePersistentAllBySingleStringQuery(
- String assertion, QueryElementHolder<?> queryElementHolder, long expectedNrOfDeletedObjects) {
+ String assertion,
+ PersistenceManager pm,
+ QueryElementHolder<?> queryElementHolder,
+ long expectedNrOfDeletedObjects) {
if (logger.isDebugEnabled()) {
logger.debug("Deleting persistent by single string query: " + queryElementHolder);
}
- delete(assertion, queryElementHolder, true, expectedNrOfDeletedObjects);
+ delete(assertion, pm, queryElementHolder, true, expectedNrOfDeletedObjects);
}
/**
@@ -1447,16 +1522,17 @@ public abstract class QueryTest extends AbstractReaderTest {
*/
private void delete(
String assertion,
+ PersistenceManager pm,
QueryElementHolder<?> queryElementHolder,
boolean asSingleString,
long expectedNrOfDeletedObjects) {
- getPM();
Query<?> query =
asSingleString
? queryElementHolder.getSingleStringQuery(pm)
: queryElementHolder.getAPIQuery(pm);
delete(
assertion,
+ pm,
query,
queryElementHolder.toString(),
queryElementHolder.getParamValues(),
@@ -1465,6 +1541,7 @@ public abstract class QueryTest extends AbstractReaderTest {
if (positive) {
execute(
assertion,
+ pm,
queryElementHolder,
asSingleString,
queryElementHolder.isUnique() ? null : Collections.emptyList());
@@ -1490,12 +1567,12 @@ public abstract class QueryTest extends AbstractReaderTest {
@SuppressWarnings("unchecked")
private void delete(
String assertion,
+ PersistenceManager pm,
Query<?> query,
String singleStringQuery,
Object parameters,
long expectedNrOfDeletedObjects) {
boolean positive = expectedNrOfDeletedObjects >= 0;
- getPM();
Transaction tx = pm.currentTransaction();
tx.begin();
try {
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/AutoCloseable.java b/tck/src/main/java/org/apache/jdo/tck/query/api/AutoCloseable.java
index a504c0e9..c038f674 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/AutoCloseable.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/AutoCloseable.java
@@ -30,6 +30,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> AutoCloseable <br>
@@ -50,9 +52,10 @@ public class AutoCloseable extends QueryTest {
* the query result is not accessible after the block.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testTryWithResource() {
- PersistenceManager pm = getPM();
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
@@ -132,9 +135,7 @@ public class AutoCloseable extends QueryTest {
tx.commit();
} finally {
- if (tx != null && tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -143,9 +144,10 @@ public class AutoCloseable extends QueryTest {
* the query result is not accessible after the block, if the block is ended with an exception.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testTryWithResourceThrowingException() {
- PersistenceManager pm = getPM();
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -228,21 +230,19 @@ public class AutoCloseable extends QueryTest {
tx.commit();
} finally {
- if (tx != null && tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/ChangeQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/ChangeQuery.java
index d6673084..0130a0c9 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ChangeQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/ChangeQuery.java
@@ -81,7 +81,7 @@ public class ChangeQuery extends QueryTest {
// execute query
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, true, parameters, expectedResult, true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, true, parameters, expectedResult, true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareImports.java b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareImports.java
index 5c531037..d6b7abdb 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareImports.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareImports.java
@@ -26,7 +26,12 @@ import org.apache.jdo.tck.pc.company.Company;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Declare Imports <br>
@@ -36,25 +41,16 @@ import org.junit.jupiter.api.Test;
* statements to the query instance. All imports must be declared in the same method call, and the
* imports must be separated by semicolons.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DeclareImports extends QueryTest {
/** */
private static final String ASSERTION_FAILED = "Assertion A14.6-8 (DeclareImports) failed: ";
- /** */
@Test
- public void test() {
- pm = getPM();
-
- runTestDeclareImports01(pm);
- runTestDeclareImports02(pm);
- runTestDeclareImports03(pm);
-
- pm.close();
- pm = null;
- }
-
- private void runTestDeclareImports01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareImports01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -68,21 +64,21 @@ public class DeclareImports extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "y == param", results, expected);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestDeclareImports02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareImports02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -97,14 +93,16 @@ public class DeclareImports extends QueryTest {
// Just check whether query with import declaration compiles
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestDeclareImports03(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareImports03() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -121,12 +119,23 @@ public class DeclareImports extends QueryTest {
// Just check whether query with import declarations compiles
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareParameters.java b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareParameters.java
index fda3ef0f..b548c447 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareParameters.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareParameters.java
@@ -24,7 +24,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Declare Parameters <br>
@@ -34,6 +39,7 @@ import org.junit.jupiter.api.Test;
* parameter statements to the query instance. This method defines the parameter types and names
* which will be used by a subsequent <code>execute</code> method.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DeclareParameters extends QueryTest {
/** */
@@ -41,16 +47,9 @@ public class DeclareParameters extends QueryTest {
/** */
@Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestDeclareParameters01(pm);
- runTestDeclareParameters02(pm);
- runTestDeclareParameters03(pm);
- }
-
- /** */
- private void runTestDeclareParameters01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareParameters01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -63,20 +62,20 @@ public class DeclareParameters extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestDeclareParameters02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareParameters02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -89,21 +88,21 @@ public class DeclareParameters extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(
ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestDeclareParameters03(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareParameters03() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -116,18 +115,27 @@ public class DeclareParameters extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p = new PCPoint(1, 1);
- expected.add(p);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(1));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == a && y == b", results, expected);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareVariables.java b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareVariables.java
index 9a95239b..12fb5711 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareVariables.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareVariables.java
@@ -22,7 +22,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Declare Variables <br>
@@ -33,6 +38,7 @@ import org.junit.jupiter.api.Test;
* variables that will be used in the filter but not provided as values by the <code>execute</code>
* method.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class DeclareVariables extends QueryTest {
/** */
@@ -40,18 +46,9 @@ public class DeclareVariables extends QueryTest {
/** */
@Test
- public void test() {
- pm = getPM();
-
- runTestDeclareVariables01(pm);
- runTestDeclareVariables02(pm);
-
- pm.close();
- pm = null;
- }
-
- /** */
- private void runTestDeclareVariables01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareVariables01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -65,14 +62,16 @@ public class DeclareVariables extends QueryTest {
// Just check whether query compiles
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestDeclareVariables02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDeclareVariables02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -87,9 +86,20 @@ public class DeclareVariables extends QueryTest {
// Just check whether query compiles
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
index 803f7e5f..74300c02 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
@@ -24,7 +24,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Execute Query <br>
@@ -35,6 +40,7 @@ import org.junit.jupiter.api.Test;
* filter. Each parameter of the <code>execute</code> method(s) is an object which is either the
* value of the corresponding parameter or the wrapped value of a primitive parameter.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ExecuteQuery extends QueryTest {
/** */
@@ -42,16 +48,9 @@ public class ExecuteQuery extends QueryTest {
/** */
@Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestExecuteQuery01(pm);
- runTestExecuteQuery02(pm);
- runTestExecuteQuery03(pm);
- }
-
- /** */
- private void runTestExecuteQuery01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQuery01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -63,21 +62,21 @@ public class ExecuteQuery extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p5);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(4));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 4", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQuery01 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestExecuteQuery02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQuery02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -91,21 +90,21 @@ public class ExecuteQuery extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQuery02 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestExecuteQuery03(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQuery03() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -119,20 +118,29 @@ public class ExecuteQuery extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(
ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQuery03 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java
index 8b66f3e4..b1ff125a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java
@@ -24,7 +24,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Execute Query with Array <br>
@@ -35,6 +40,7 @@ import org.junit.jupiter.api.Test;
* Object</code>s, in which the positional <code>Object</code> is the value to use in the query for
* that parameter. Unlike <code>execute</code>, there is no limit on the number of parameters.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ExecuteQueryWithArray extends QueryTest {
/** */
@@ -43,15 +49,9 @@ public class ExecuteQueryWithArray extends QueryTest {
/** */
@Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestExecuteQueryWithArray01(pm);
- runTestExecuteQueryWithArray02(pm);
- }
-
- /** */
- private void runTestExecuteQueryWithArray01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQueryWithArray01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
@@ -67,22 +67,22 @@ public class ExecuteQueryWithArray extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQueryWithArray01 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestExecuteQueryWithArray02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQueryWithArray02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -97,20 +97,29 @@ public class ExecuteQueryWithArray extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(
ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQueryWithArray02 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java
index 6283ef76..dba3e1ca 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java
@@ -26,7 +26,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Execute Query with Map <br>
@@ -38,6 +43,7 @@ import org.junit.jupiter.api.Test;
* the value is the value to use in the query for that parameter. Unlike <code>execute</code>, there
* is no limit on the number of parameters.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class ExecuteQueryWithMap extends QueryTest {
/** */
@@ -46,15 +52,9 @@ public class ExecuteQueryWithMap extends QueryTest {
/** */
@Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestExecuteQueryWithMap01(pm);
- runTestExecuteQueryWithMap02(pm);
- }
-
- /** */
- private void runTestExecuteQueryWithMap01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQueryWithMap01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -70,21 +70,21 @@ public class ExecuteQueryWithMap extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQueryWithMap01 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- private void runTestExecuteQueryWithMap02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestExecuteQueryWithMap02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -101,20 +101,29 @@ public class ExecuteQueryWithMap extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(
ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
tx.commit();
- tx = null;
if (debug) logger.debug("Test ExecuteQueryWithMap02 - Passed\n");
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/GetFetchPlan.java b/tck/src/main/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
index 65c549c5..9cc6a73f 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
@@ -19,14 +19,15 @@ package org.apache.jdo.tck.query.api;
import java.util.Collection;
import javax.jdo.FetchPlan;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import org.apache.jdo.tck.pc.mylib.PCClass;
import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Get Fetch Plan. <br>
@@ -46,28 +47,37 @@ public class GetFetchPlan extends QueryTest {
private static final String FETCH_GROUP_2 = "fetchGroup2";
/** */
- private Query<PCClass> createQuery() {
- Query<PCClass> query = getPM().newQuery(PCClass.class, "true");
+ private Query<PCClass> createQuery(PersistenceManager pm) {
+ Query<PCClass> query = pm.newQuery(PCClass.class, "true");
query.getFetchPlan().setGroup(FETCH_GROUP_1);
return query;
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testFetchGroup1() {
- // localSetUp closes the PM
- Query<PCClass> query = createQuery();
- checkSameFetchPlanInstances(query);
- checkFetchGroup1(query);
- cleanupPM();
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<PCClass> query = createQuery(pm);
+ checkSameFetchPlanInstances(query);
+ checkFetchGroup1(query);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testFetchGroup2() {
- // localSetUp closes the PM
- Query<PCClass> query = createQuery();
- checkFetchGroup2(query);
- checkFetchGroup1(query);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<PCClass> query = createQuery(pm);
+ checkFetchGroup2(query);
+ checkFetchGroup1(query);
+ } finally {
+ cleanupPM(pm);
+ }
}
private void checkSameFetchPlanInstances(Query<PCClass> query) {
@@ -116,16 +126,4 @@ public class GetFetchPlan extends QueryTest {
query.getFetchPlan().removeGroup(FETCH_GROUP_2);
}
}
-
- @BeforeAll
- @Override
- public void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- public void tearDown() {
- super.tearDown();
- }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/GetIgnoreCache.java b/tck/src/main/java/org/apache/jdo/tck/query/api/GetIgnoreCache.java
index e5e3c80b..c9ce3ddb 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetIgnoreCache.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/GetIgnoreCache.java
@@ -21,7 +21,12 @@ import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Get IgnoreCache <br>
@@ -30,6 +35,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> <code>Query.getIgnoreCache</code> returns the current setting of
* the IgnoreCache option.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class GetIgnoreCache extends QueryTest {
/** */
@@ -37,19 +43,9 @@ public class GetIgnoreCache extends QueryTest {
/** */
@Test
- public void test() {
- pmf = getPMF();
- pm = getPM();
-
- runTestGetIgnoreCache01(pm);
- runTestGetIgnoreCache02(pm);
-
- pm.close();
- pm = null;
- }
-
- /** */
- void runTestGetIgnoreCache01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestGetIgnoreCache01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -69,14 +65,16 @@ public class GetIgnoreCache extends QueryTest {
}
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestGetIgnoreCache02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestGetIgnoreCache02() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
boolean ignoreCacheDefault = pmf.getIgnoreCache();
// set PM's ignoreCache to a different value
@@ -102,9 +100,20 @@ public class GetIgnoreCache extends QueryTest {
fail(ASSERTION_FAILED, "Could NOT change the Query's ignoreCache flag.");
}
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java b/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java
index 0e6a73f4..6a7cd06b 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java
@@ -22,7 +22,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Get PersistenceManager <br>
@@ -31,6 +36,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> <code>Query.getPersistenceManager()</code> returns the associated
* <code>PersistenceManager</code> instance.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class GetPersistenceManager extends QueryTest {
/** */
@@ -39,18 +45,9 @@ public class GetPersistenceManager extends QueryTest {
/** */
@Test
- public void test() {
- pm = getPM();
-
- runTestGetPersistenceManager01(pm);
- runTestGetPersistenceManager02(pm);
-
- pm.close();
- pm = null;
- }
-
- /** */
- void runTestGetPersistenceManager01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestGetPersistenceManager01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.setOptimistic(false);
@@ -70,16 +67,18 @@ public class GetPersistenceManager extends QueryTest {
query.compile();
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestGetPersistenceManager02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestGetPersistenceManager02() {
if (!isOptimisticSupported()) return;
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.setOptimistic(true);
@@ -99,9 +98,20 @@ public class GetPersistenceManager extends QueryTest {
query.compile();
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java b/tck/src/main/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java
index 69f4cbac..ebc9d1c7 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java
@@ -17,6 +17,7 @@
package org.apache.jdo.tck.query.api;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
@@ -28,6 +29,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Metadata Search Order. <br>
@@ -56,6 +59,7 @@ public class MetadataSearchOrder extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPackageJDOInDefaultPackage() {
int index = 0;
executeNamedQuery(null, "packageJDOInDefaultPackage", expectedResult[index]);
@@ -63,6 +67,7 @@ public class MetadataSearchOrder extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPackageJDO() {
int index = 1;
executeNamedQuery(Person.class, "packageJDO", expectedResult[index]);
@@ -70,6 +75,7 @@ public class MetadataSearchOrder extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testClassJDO() {
int index = 2;
executeNamedQuery(PCClass.class, "classJDO", expectedResult[index]);
@@ -77,6 +83,7 @@ public class MetadataSearchOrder extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPackageORM() {
int index = 3;
executeNamedQuery(Person.class, "packageORM", expectedResult[index]);
@@ -84,6 +91,7 @@ public class MetadataSearchOrder extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testClassJDOQuery() {
int index = 4;
executeNamedQuery(Person.class, "classJDOQuery", expectedResult[index]);
@@ -91,20 +99,32 @@ public class MetadataSearchOrder extends QueryTest {
private void executeNamedQuery(
Class<?> candidateClass, String namedQuery, Object expectedResult) {
- Query<?> query = getPM().newNamedQuery(candidateClass, namedQuery);
- executeJDOQuery(
- ASSERTION_FAILED, query, "Named query " + namedQuery, false, null, expectedResult, true);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<?> query = pm.newNamedQuery(candidateClass, namedQuery);
+ executeJDOQuery(
+ ASSERTION_FAILED,
+ pm,
+ query,
+ "Named query " + namedQuery,
+ false,
+ null,
+ expectedResult,
+ true);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewNamedQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
index 7cd9c574..0fb8d77b 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
@@ -18,6 +18,7 @@
package org.apache.jdo.tck.query.api;
import java.util.Arrays;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Person;
@@ -27,6 +28,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> New Named Query. <br>
@@ -56,42 +59,55 @@ public class NewNamedQuery extends QueryTest {
/** */
@Test
- public void testPositive() {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void testPositive0() {
int index = 0;
executeNamedQuery(Person.class, "validNotUnique", expectedResult[index], true);
+ }
- index = 1;
+ /** */
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void testPositive1() {
+ int index = 1;
executeNamedQuery(Person.class, "validUnique", expectedResult[index], true);
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
executeNamedQuery(Person.class, "invalidUnique", null, false);
}
private void executeNamedQuery(
Class<?> candidateClass, String namedQuery, Object expectedResult, boolean positive) {
- Query<?> query = getPM().newNamedQuery(candidateClass, namedQuery);
- executeJDOQuery(
- ASSERTION_FAILED,
- query,
- "Named query " + namedQuery,
- false,
- null,
- expectedResult,
- positive);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<?> query = pm.newNamedQuery(candidateClass, namedQuery);
+ executeJDOQuery(
+ ASSERTION_FAILED,
+ pm,
+ query,
+ "Named query " + namedQuery,
+ false,
+ null,
+ expectedResult,
+ positive);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java
index b8bd3718..c29392d6 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java
@@ -66,7 +66,7 @@ public class NewQuerySingleString extends QueryTest {
@Test
public void testPositive() {
for (int i = 0; i < VALID_QUERIES.length; i++) {
- executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], expectedResult[i]);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, VALID_QUERIES[i], expectedResult[i]);
}
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java
index 92ee682d..2374f8d4 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java
@@ -50,8 +50,8 @@ public class NewQueryWithCandidateClass extends QueryTest {
Object results = query.execute();
// check query result
- printOutput(results, inserted);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+ printOutput(results, persistentPCPoints);
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
tx.commit();
tx = null;
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java
index 0b7bd011..97038faf 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java
@@ -46,12 +46,12 @@ public class NewQueryWithCandidateClassAndCollection extends QueryTest {
try {
tx.begin();
- Query<PCPoint> query = pm.newQuery(PCPoint.class, inserted);
+ Query<PCPoint> query = pm.newQuery(PCPoint.class, persistentPCPoints);
Object results = query.execute();
// check query result
- printOutput(results, inserted);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+ printOutput(results, persistentPCPoints);
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
tx.commit();
tx = null;
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java
index a3431c0a..29efd3dd 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java
@@ -52,8 +52,8 @@ public class NewQueryWithCandidateClassAndExtent extends QueryTest {
Object results = query.execute();
// check query result
- printOutput(results, inserted);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+ printOutput(results, persistentPCPoints);
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
tx.commit();
tx = null;
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java
index 30515e1b..8feb60ac 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java
@@ -48,7 +48,7 @@ public class NewQueryWithCandidateClassCollectionFilter extends QueryTest {
try {
tx.begin();
- Query<PCPoint> query = pm.newQuery(PCPoint.class, inserted, "x ==2");
+ Query<PCPoint> query = pm.newQuery(PCPoint.class, persistentPCPoints, "x ==2");
Object results = query.execute();
// check query result
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java
index 8edbd93a..bf11cb18 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java
@@ -49,8 +49,8 @@ public class NewQueryWithExtent extends QueryTest {
Object results = query.execute();
// check query result
- printOutput(results, inserted);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+ printOutput(results, persistentPCPoints);
+ checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
tx.commit();
tx = null;
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/QueryCancel.java b/tck/src/main/java/org/apache/jdo/tck/query/api/QueryCancel.java
index f9ec9bc8..a2387c55 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/QueryCancel.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/QueryCancel.java
@@ -33,6 +33,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
import org.opentest4j.AssertionFailedError;
/**
@@ -76,48 +78,54 @@ public class QueryCancel extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testCancel() throws InterruptedException {
- PersistenceManager pm = getPM();
- // Test query
- Query<PCPoint> query = pm.newQuery(SSJDOQL);
- query.compile();
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ // Test query
+ Query<PCPoint> query = pm.newQuery(SSJDOQL);
+ query.compile();
- // Thread executing the query
- CyclicBarrier barrier = new CyclicBarrier(2);
- ThreadExceptionHandler group = new ThreadExceptionHandler();
- QueryExecutor runnable = new QueryExecutor(pm, query, barrier);
- Thread t = new Thread(group, runnable, "Query Executor");
- t.start();
+ // Thread executing the query
+ CyclicBarrier barrier = new CyclicBarrier(2);
+ ThreadExceptionHandler group = new ThreadExceptionHandler();
+ QueryExecutor runnable = new QueryExecutor(pm, query, barrier);
+ Thread t = new Thread(group, runnable, "Query Executor");
+ t.start();
- try {
- // Wait for the other thread
- barrier.await();
+ try {
+ // Wait for the other thread
+ barrier.await();
- // Wait a couple of millis such that the other thread can start query execution
- Thread.sleep(MAIN_SLEEP_MILLIS);
+ // Wait a couple of millis such that the other thread can start query execution
+ Thread.sleep(MAIN_SLEEP_MILLIS);
- // cancel query
- query.cancel(t);
- if (!isQueryCancelSupported()) {
- fail(
- ASSERTION_FAILED,
- "Query.cancel should throw a JDOQueryInterruptedException, "
- + "if query canceling is not supported ");
- }
- } catch (JDOUnsupportedOptionException | InterruptedException | BrokenBarrierException ex) {
- if (isQueryCancelSupported()) {
- fail(
- ASSERTION_FAILED,
- "Query.cancel should not result in a JDOQueryInterruptedException, "
- + "if query canceling is supported ");
+ // cancel query
+ query.cancel(t);
+ if (!isQueryCancelSupported()) {
+ fail(
+ ASSERTION_FAILED,
+ "Query.cancel should throw a JDOQueryInterruptedException, "
+ + "if query canceling is not supported ");
+ }
+ } catch (JDOUnsupportedOptionException | InterruptedException | BrokenBarrierException ex) {
+ if (isQueryCancelSupported()) {
+ fail(
+ ASSERTION_FAILED,
+ "Query.cancel should not result in a JDOQueryInterruptedException, "
+ + "if query canceling is supported ");
+ }
}
- }
- t.join();
- Throwable problem = group.getUncaughtException(t);
- if (problem != null) {
- if (problem instanceof AssertionFailedError) throw (AssertionFailedError) problem;
- else throw new JDOFatalException("Thread " + t.getName() + " results in exception ", problem);
+ t.join();
+ Throwable problem = group.getUncaughtException(t);
+ if (problem != null) {
+ if (problem instanceof AssertionFailedError) throw (AssertionFailedError) problem;
+ else
+ throw new JDOFatalException("Thread " + t.getName() + " results in exception ", problem);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@@ -126,48 +134,54 @@ public class QueryCancel extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testCancelAll() throws Exception {
- PersistenceManager pm = getPM();
- // Test query
- Query<PCPoint> query = pm.newQuery(SSJDOQL);
- query.compile();
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ // Test query
+ Query<PCPoint> query = pm.newQuery(SSJDOQL);
+ query.compile();
- // Thread executing the query
- CyclicBarrier barrier = new CyclicBarrier(2);
- ThreadExceptionHandler group = new ThreadExceptionHandler();
- QueryExecutor runnable = new QueryExecutor(pm, query, barrier);
- Thread t = new Thread(group, runnable, "Query Executor");
- t.start();
+ // Thread executing the query
+ CyclicBarrier barrier = new CyclicBarrier(2);
+ ThreadExceptionHandler group = new ThreadExceptionHandler();
+ QueryExecutor runnable = new QueryExecutor(pm, query, barrier);
+ Thread t = new Thread(group, runnable, "Query Executor");
+ t.start();
- try {
- // cancel query
- // Wait for the other thread
- barrier.await();
+ try {
+ // cancel query
+ // Wait for the other thread
+ barrier.await();
- // Wait a couple of millis such that the other thread can start query execution
- Thread.sleep(MAIN_SLEEP_MILLIS);
+ // Wait a couple of millis such that the other thread can start query execution
+ Thread.sleep(MAIN_SLEEP_MILLIS);
- query.cancelAll();
- if (!isQueryCancelSupported()) {
- fail(
- ASSERTION_FAILED,
- "Query.cancel should throw a JDOQueryInterruptedException, "
- + "if query canceling is not supported ");
- }
- } catch (JDOUnsupportedOptionException ex) {
- if (isQueryCancelSupported()) {
- fail(
- ASSERTION_FAILED,
- "Query.cancel should not result in a JDOQueryInterruptedException, "
- + "if query canceling is supported ");
+ query.cancelAll();
+ if (!isQueryCancelSupported()) {
+ fail(
+ ASSERTION_FAILED,
+ "Query.cancel should throw a JDOQueryInterruptedException, "
+ + "if query canceling is not supported ");
+ }
+ } catch (JDOUnsupportedOptionException ex) {
+ if (isQueryCancelSupported()) {
+ fail(
+ ASSERTION_FAILED,
+ "Query.cancel should not result in a JDOQueryInterruptedException, "
+ + "if query canceling is supported ");
+ }
}
- }
- t.join();
- Throwable problem = group.getUncaughtException(t);
- if (problem != null) {
- if (problem instanceof AssertionFailedError) throw (AssertionFailedError) problem;
- else throw new JDOFatalException("Thread " + t.getName() + " results in exception ", problem);
+ t.join();
+ Throwable problem = group.getUncaughtException(t);
+ if (problem != null) {
+ if (problem instanceof AssertionFailedError) throw (AssertionFailedError) problem;
+ else
+ throw new JDOFatalException("Thread " + t.getName() + " results in exception ", problem);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@@ -218,13 +232,13 @@ public class QueryCancel extends QueryTest {
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/QueryExtentions.java b/tck/src/main/java/org/apache/jdo/tck/query/api/QueryExtentions.java
index 35f5e090..7a0f2918 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/QueryExtentions.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/QueryExtentions.java
@@ -56,7 +56,7 @@ public class QueryExtentions extends QueryTest {
query.setExtensions(extentions);
query.addExtension("unknown key 2", "unknown value 2");
executeJDOQuery(
- ASSERTION_FAILED, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java
index f1471076..b6c9d31f 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import javax.jdo.JDOQLTypedQuery;
import javax.jdo.JDOQLTypedSubquery;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.jdo.Transaction;
import javax.jdo.query.CollectionExpression;
@@ -42,6 +43,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> SampleReadQueries <br>
@@ -154,7 +157,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery01a() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery01a " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -168,9 +176,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -184,7 +190,12 @@ public class SampleReadQueries extends QueryTest {
* the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery01b() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery01b " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -198,9 +209,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -215,7 +224,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery01d() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery01d " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -229,9 +243,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -245,7 +257,12 @@ public class SampleReadQueries extends QueryTest {
* the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery01f() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery01f " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -261,9 +278,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -275,7 +290,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery02a() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery02a " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -290,9 +310,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -303,7 +321,12 @@ public class SampleReadQueries extends QueryTest {
* greater than the constant 30000, and returns a Collection ordered based on employee salary.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery02b() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery02b " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -318,9 +341,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -332,7 +353,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery02d() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery02d " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -346,9 +372,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -359,7 +383,12 @@ public class SampleReadQueries extends QueryTest {
* greater than the constant 30000, and returns a Collection ordered based on employee salary.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery02f() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery02f " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -375,9 +404,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -391,7 +418,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery03a() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery03a " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -407,9 +439,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -422,7 +452,12 @@ public class SampleReadQueries extends QueryTest {
* cannot be unwrapped for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery03b() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery03b " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -442,9 +477,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -457,7 +490,12 @@ public class SampleReadQueries extends QueryTest {
* cannot be unwrapped for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery03c() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery03c " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -474,9 +512,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -490,7 +526,12 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery03d() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery03d " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -504,9 +545,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -519,7 +558,12 @@ public class SampleReadQueries extends QueryTest {
* cannot be unwrapped for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery03f() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("testQuery03f " + Thread.currentThread().getName());
+ }
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -541,9 +585,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -557,7 +599,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery04a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -572,9 +616,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -587,7 +629,9 @@ public class SampleReadQueries extends QueryTest {
* then it cannot be navigated for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery04b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -605,9 +649,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -620,7 +662,9 @@ public class SampleReadQueries extends QueryTest {
* then it cannot be navigated for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery04c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -636,9 +680,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -652,7 +694,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery04d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -669,9 +713,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -684,7 +726,9 @@ public class SampleReadQueries extends QueryTest {
* then it cannot be navigated for the comparison, and the candidate instance is rejected.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery04f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -704,9 +748,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -719,7 +761,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery05a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -736,9 +780,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -750,7 +792,9 @@ public class SampleReadQueries extends QueryTest {
* greater than the value passed as a parameter.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery05b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -770,9 +814,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -784,7 +826,9 @@ public class SampleReadQueries extends QueryTest {
* greater than the value passed as a parameter.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery05c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -802,9 +846,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -817,7 +859,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery05d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -831,9 +875,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -846,7 +888,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery05f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -867,9 +911,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -881,7 +923,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery06a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -897,9 +941,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -910,7 +952,9 @@ public class SampleReadQueries extends QueryTest {
* collection, which in this example consists of three department names.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery06b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -928,9 +972,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -941,7 +983,9 @@ public class SampleReadQueries extends QueryTest {
* collection, which in this example consists of three department names.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery06c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -957,9 +1001,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -971,7 +1013,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery06d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -988,9 +1032,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1001,7 +1043,9 @@ public class SampleReadQueries extends QueryTest {
* collection, which in this example consists of three department names.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery06f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1022,9 +1066,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1035,7 +1077,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery07a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1050,9 +1094,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1062,7 +1104,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query selects names of all Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery07b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1080,9 +1124,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1092,7 +1134,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query selects names of all Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery07c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1108,9 +1152,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1121,7 +1163,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery07d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1137,9 +1181,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1149,7 +1191,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query selects names of all Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery07f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1168,9 +1212,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1182,7 +1224,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery08a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1199,9 +1243,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1212,7 +1254,9 @@ public class SampleReadQueries extends QueryTest {
* department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery08b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1232,9 +1276,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1245,7 +1287,9 @@ public class SampleReadQueries extends QueryTest {
* department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery08c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1263,9 +1307,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1277,7 +1319,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery08d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1291,9 +1335,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1304,7 +1346,9 @@ public class SampleReadQueries extends QueryTest {
* department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery08f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1324,9 +1368,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1338,7 +1380,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1358,9 +1402,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1371,7 +1413,9 @@ public class SampleReadQueries extends QueryTest {
* department, and uses the constructor for the result class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1394,9 +1438,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1407,7 +1449,9 @@ public class SampleReadQueries extends QueryTest {
* department, and uses the constructor for the result class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1428,9 +1472,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1442,7 +1484,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1459,9 +1503,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1472,7 +1514,9 @@ public class SampleReadQueries extends QueryTest {
* department, and uses the constructor for the result class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09e() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1489,9 +1533,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1502,7 +1544,9 @@ public class SampleReadQueries extends QueryTest {
* department, and uses the constructor for the result class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery09f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1525,9 +1569,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1538,7 +1580,9 @@ public class SampleReadQueries extends QueryTest {
* returns a single value.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery10a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1554,9 +1598,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1567,7 +1609,9 @@ public class SampleReadQueries extends QueryTest {
* returns a single value.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery10b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1586,9 +1630,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1599,7 +1641,9 @@ public class SampleReadQueries extends QueryTest {
* returns a single value.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery10c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1616,9 +1660,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1630,7 +1672,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery10d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1644,9 +1688,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1657,7 +1699,9 @@ public class SampleReadQueries extends QueryTest {
* returns a single value.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery10f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1676,9 +1720,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1688,7 +1730,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query averages and sums the salaries of Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery11a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1704,9 +1748,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1716,7 +1758,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query averages and sums the salaries of Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery11b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1735,9 +1779,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1747,7 +1789,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query averages and sums the salaries of Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery11c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1764,9 +1808,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1777,7 +1819,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery11d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1791,9 +1835,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1803,7 +1845,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query averages and sums the salaries of Employees who work in the parameter department.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery11f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1823,9 +1867,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1837,7 +1879,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery12a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1858,9 +1902,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1871,7 +1913,9 @@ public class SampleReadQueries extends QueryTest {
* more than one employee and aggregates by department name.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery12b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1892,9 +1936,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1906,7 +1948,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery12d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1925,9 +1969,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1938,7 +1980,9 @@ public class SampleReadQueries extends QueryTest {
* more than one employee and aggregates by department name.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery12e() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1957,9 +2001,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -1970,7 +2012,9 @@ public class SampleReadQueries extends QueryTest {
* more than one employee and aggregates by department name.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery12f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -1993,9 +2037,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2005,7 +2047,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single instance of Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery13a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2020,9 +2064,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2032,7 +2074,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single instance of Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery13b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2050,9 +2094,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2062,7 +2104,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single instance of Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery13c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2078,9 +2122,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2091,7 +2133,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery13d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2105,9 +2149,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2117,7 +2159,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single instance of Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery13f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2136,9 +2180,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2148,7 +2190,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single field of a single Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery14a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2167,9 +2211,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2179,7 +2221,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single field of a single Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery14b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2200,9 +2244,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2212,7 +2254,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single field of a single Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery14c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2231,9 +2275,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2244,7 +2286,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery14d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2259,9 +2303,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2271,7 +2313,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns a single field of a single Employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery14f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2291,9 +2335,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2306,7 +2348,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery15a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2321,9 +2365,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2335,7 +2377,9 @@ public class SampleReadQueries extends QueryTest {
* the field must be named FullTimeEmployee and be of type FullTimeEmployee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery15b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2353,9 +2397,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2367,7 +2409,9 @@ public class SampleReadQueries extends QueryTest {
* the field must be named FullTimeEmployee and be of type FullTimeEmployee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery15c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2383,9 +2427,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2398,7 +2440,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery15d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2412,9 +2456,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2426,7 +2468,9 @@ public class SampleReadQueries extends QueryTest {
* the field must be named FullTimeEmployee and be of type FullTimeEmployee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery15f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2445,9 +2489,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2459,7 +2501,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery16a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2474,9 +2518,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2487,7 +2529,9 @@ public class SampleReadQueries extends QueryTest {
* stores the result in a user-defined class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery16b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2505,9 +2549,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2518,7 +2560,9 @@ public class SampleReadQueries extends QueryTest {
* stores the result in a user-defined class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery16c() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2534,9 +2578,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2548,7 +2590,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery16d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2562,9 +2606,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2575,7 +2617,9 @@ public class SampleReadQueries extends QueryTest {
* stores the result in a user-defined class.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery16f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2594,9 +2638,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2607,7 +2649,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery17a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2623,9 +2667,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2635,7 +2677,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns the names of all Employees of all "Research" departments.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery17b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2651,9 +2695,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2664,7 +2706,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery17d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2677,9 +2721,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2689,7 +2731,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns the names of all Employees of all "Research" departments.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery17e() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2702,9 +2746,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2715,7 +2757,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery17f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2732,9 +2776,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2745,7 +2787,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery18a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2763,9 +2807,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2775,7 +2817,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns names of employees who work more than the average of all employees.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery18b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2793,9 +2837,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2806,7 +2848,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery18d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2819,9 +2863,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2831,7 +2873,9 @@ public class SampleReadQueries extends QueryTest {
* <p>This query returns names of employees who work more than the average of all employees.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery18f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2849,9 +2893,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2865,7 +2907,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery19a() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2884,9 +2928,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2899,7 +2941,9 @@ public class SampleReadQueries extends QueryTest {
* the subquery is the manager of the candidate employee.
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery19b() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2918,9 +2962,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2934,7 +2976,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery19d() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2947,9 +2991,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -2963,7 +3005,9 @@ public class SampleReadQueries extends QueryTest {
*/
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testQuery19f() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -2983,9 +3027,7 @@ public class SampleReadQueries extends QueryTest {
}
tx.commit();
} finally {
- if (tx.isActive()) {
- tx.rollback();
- }
+ cleanupPM(pm);
}
}
@@ -3158,16 +3200,15 @@ public class SampleReadQueries extends QueryTest {
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
-
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SaveAsNamedQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SaveAsNamedQuery.java
index 6391c5c1..18a2c022 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SaveAsNamedQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SaveAsNamedQuery.java
@@ -62,7 +62,7 @@ public class SaveAsNamedQuery extends QueryTest {
query.setRange(0, 5);
query.setIgnoreCache(true);
executeJDOQuery(
- ASSERTION_FAILED, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
// Save query under this name
String savedName = "MySavedName";
@@ -74,6 +74,7 @@ public class SaveAsNamedQuery extends QueryTest {
Assertions.assertNotNull(namedQuery);
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
namedQuery,
SINGLE_STRING_QUERY,
false,
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java
index d2f35fdc..2e472855 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java
@@ -50,7 +50,7 @@ public class SetCandidateCollection extends QueryTest {
tx.begin();
Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(inserted);
+ query.setCandidates(persistentPCPoints);
Object results = query.execute();
// check query result
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetGrouping.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetGrouping.java
index cb41cc74..d256d36a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetGrouping.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetGrouping.java
@@ -50,7 +50,7 @@ public class SetGrouping extends QueryTest {
query.setGrouping("lastname");
String singleStringQuery = "SELECT lastname FROM Person GROUP BY lastname";
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetIgnoreCache.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetIgnoreCache.java
index 8109915d..94b5adbc 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetIgnoreCache.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetIgnoreCache.java
@@ -22,7 +22,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Set IgnoreCache <br>
@@ -31,6 +36,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> <code>Query.setIgnoreCache(boolean flag)</code> sets the
* IgnoreCache option for queries.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class SetIgnoreCache extends QueryTest {
/** */
@@ -38,18 +44,9 @@ public class SetIgnoreCache extends QueryTest {
/** */
@Test
- public void test() {
- pm = getPM();
-
- runTestSetIgnoreCache01(pm);
- runTestSetIgnoreCache02(pm);
-
- pm.close();
- pm = null;
- }
-
- /** */
- void runTestSetIgnoreCache01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestSetIgnoreCache01() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
tx.setOptimistic(false);
try {
@@ -80,19 +77,21 @@ public class SetIgnoreCache extends QueryTest {
query.compile();
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestSetIgnoreCache02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestSetIgnoreCache02() {
if (!isOptimisticSupported()) {
if (debug) logger.debug("Optimistic tx not supported");
return;
}
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.setOptimistic(true);
@@ -124,9 +123,20 @@ public class SetIgnoreCache extends QueryTest {
query.compile();
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java
index 564dbf66..8cbeb216 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java
@@ -18,14 +18,19 @@
package org.apache.jdo.tck.query.api;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import java.util.ListIterator;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Set Ordering <br>
@@ -34,6 +39,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> <code>Query.setOrdering(String ordering)</code> binds the ordering
* statements to the query instance.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class SetOrdering extends QueryTest {
/** */
@@ -41,15 +47,9 @@ public class SetOrdering extends QueryTest {
/** */
@Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestAscending(pm);
- runTestDescending(pm);
- }
-
- /** */
- void runTestAscending(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestAscending() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -61,18 +61,20 @@ public class SetOrdering extends QueryTest {
Object results = query.execute();
// check result
- printOutput(results, inserted);
- checkQueryResultWithOrder(ASSERTION_FAILED, results, inserted);
+ printOutput(results, persistentPCPoints);
+ checkQueryResultWithOrder(ASSERTION_FAILED, results, transientPCPoints);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestDescending(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestDescending() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -84,24 +86,29 @@ public class SetOrdering extends QueryTest {
Object results = query.execute();
// check result
- List<PCPoint> expected = new ArrayList<>();
- ListIterator<PCPoint> li = inserted.listIterator(inserted.size());
- // construct expected results by iterating inserted objects backwards
- while (li.hasPrevious()) {
- PCPoint obj = li.previous();
- expected.add(obj);
- }
- expected = getFromInserted(expected);
+ List<PCPoint> expected = new ArrayList<>(transientPCPoints);
+ Collections.reverse(expected);
printOutput(results, expected);
checkQueryResultWithOrder(ASSERTION_FAILED, results, expected);
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
+
/**
* @see org.apache.jdo.tck.JDO_Test#localSetUp()
*/
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetRange.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetRange.java
index 4d4e2adf..c1960846 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetRange.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetRange.java
@@ -49,7 +49,7 @@ public class SetRange extends QueryTest {
query.setRange(0, 5);
String singleStringQuery = "SELECT FROM Person RANGE 0, 5";
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResult.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetResult.java
index 2f553062..f04a8bdd 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResult.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetResult.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.api;
import java.util.Arrays;
import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Person;
@@ -27,6 +28,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Set Result. <br>
@@ -48,40 +51,52 @@ public class SetResult extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive() {
int index = 0;
- Query<Person> query = getPM().newQuery(Person.class);
- query.setResult("lastname");
- String singleStringQuery = "SELECT lastname FROM Person";
- executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<Person> query = pm.newQuery(Person.class);
+ query.setResult("lastname");
+ String singleStringQuery = "SELECT lastname FROM Person";
+ executeJDOQuery(
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- Query<Person> query = getPM().newQuery(Person.class);
+ PersistenceManager pm = getPMF().getPersistenceManager();
try {
- query.setResult("noname");
- query.compile();
- fail(
- ASSERTION_FAILED
- + "Compilation for query "
- + "'SELECT noname FROM Person' "
- + "succeeded, though the result clause is invalid.");
- } catch (JDOUserException ignored) {
+ Query<Person> query = pm.newQuery(Person.class);
+ try {
+ query.setResult("noname");
+ query.compile();
+ fail(
+ ASSERTION_FAILED
+ + "Compilation for query "
+ + "'SELECT noname FROM Person' "
+ + "succeeded, though the result clause is invalid.");
+ } catch (JDOUserException ignored) {
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResultClass.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetResultClass.java
index 0e6c6317..8c135761 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResultClass.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetResultClass.java
@@ -58,7 +58,7 @@ public class SetResultClass extends QueryTest {
query.setResult("firstname, lastname");
String singleStringQuery = "SELECT firstname, lastname INTO FullName FROM Person";
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetUnique.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetUnique.java
index b5bb264c..6dda89a7 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetUnique.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetUnique.java
@@ -51,14 +51,14 @@ public class SetUnique extends QueryTest {
query.setFilter("lastname == 'emp1Last'");
String singleStringQuery = "SELECT FROM Person WHERE lastname == 'emp1Last'";
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
index = 1;
query = getPM().newQuery(Person.class);
query.setUnique(false);
singleStringQuery = "SELECT FROM Person";
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java
index 352f1d57..8c772f3a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java
@@ -109,6 +109,7 @@ public class SetterReplacePreviousValues extends QueryTest {
Object[] parameters = new Object[] {Long.valueOf(1)};
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
@@ -119,6 +120,7 @@ public class SetterReplacePreviousValues extends QueryTest {
query.declareParameters("long param");
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
@@ -132,6 +134,7 @@ public class SetterReplacePreviousValues extends QueryTest {
query.setFilter("personid == 2L");
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
@@ -142,6 +145,7 @@ public class SetterReplacePreviousValues extends QueryTest {
query.setFilter("personid == 2L");
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
@@ -155,6 +159,7 @@ public class SetterReplacePreviousValues extends QueryTest {
query.declareVariables("Employee e");
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
@@ -165,6 +170,7 @@ public class SetterReplacePreviousValues extends QueryTest {
query.declareVariables("Employee e");
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
VALID_QUERIES[index].toString(),
false,
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SingleStringQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SingleStringQuery.java
index 4f58e3fd..c4e1508e 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SingleStringQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SingleStringQuery.java
@@ -75,6 +75,7 @@ public class SingleStringQuery extends QueryTest {
Query<FullTimeEmployee> query = getPM().newQuery(SINGLE_STRING_QUERY);
executeJDOQuery(
ASSERTION_FAILED,
+ pm,
query,
SINGLE_STRING_QUERY,
true,
@@ -96,7 +97,7 @@ public class SingleStringQuery extends QueryTest {
query.setOrdering(null);
query.setRange(null);
executeJDOQuery(
- ASSERTION_FAILED, query, singleStringQuery, false, null, expectedResult[index], true);
+ ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java
index f6f8b9d0..0acec3ad 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.api;
import java.util.Arrays;
import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
@@ -29,6 +30,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Unmodifiable Query. <br>
@@ -50,46 +53,70 @@ public class UnmodifiableQuery extends QueryTest {
/** The expected results of valid queries. */
private final Object[] expectedResult = {
Arrays.asList(
- new Object[] {
- new FullName("emp1First", "emp1Last"),
- new FullName("emp2First", "emp2Last"),
- new FullName("emp3First", "emp3Last"),
- new FullName("emp4First", "emp4Last"),
- new FullName("emp5First", "emp5Last")
- })
+ new FullName("emp1First", "emp1Last"),
+ new FullName("emp2First", "emp2Last"),
+ new FullName("emp3First", "emp3Last"),
+ new FullName("emp4First", "emp4Last"),
+ new FullName("emp5First", "emp5Last"))
};
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive() {
int index = 0;
- Query<Person> query = getPM().newQuery(SINGLE_STRING_QUERY);
- query.setUnmodifiable();
- query.setResultClass(FullName.class);
- query.setRange(0, 5);
- query.setIgnoreCache(true);
- executeJDOQuery(
- ASSERTION_FAILED, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
-
- query = getPM().newNamedQuery(Person.class, "unmodifiable");
- query.setResultClass(FullName.class);
- query.setRange(0, 5);
- query.setIgnoreCache(true);
- executeJDOQuery(
- ASSERTION_FAILED, query, SINGLE_STRING_QUERY, false, null, expectedResult[index], true);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<Person> query = pm.newQuery(SINGLE_STRING_QUERY);
+ query.setUnmodifiable();
+ query.setResultClass(FullName.class);
+ query.setRange(0, 5);
+ query.setIgnoreCache(true);
+ executeJDOQuery(
+ ASSERTION_FAILED,
+ pm,
+ query,
+ SINGLE_STRING_QUERY,
+ false,
+ null,
+ expectedResult[index],
+ true);
+
+ query = pm.newNamedQuery(Person.class, "unmodifiable");
+ query.setResultClass(FullName.class);
+ query.setRange(0, 5);
+ query.setIgnoreCache(true);
+ executeJDOQuery(
+ ASSERTION_FAILED,
+ pm,
+ query,
+ SINGLE_STRING_QUERY,
+ false,
+ null,
+ expectedResult[index],
+ true);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- Query<Person> query = getPM().newQuery(SINGLE_STRING_QUERY);
- query.setUnmodifiable();
- checkSetters(query);
-
- query = getPM().newNamedQuery(Person.class, "unmodifiable");
- checkSetters(query);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ Query<Person> query = pm.newQuery(SINGLE_STRING_QUERY);
+ query.setUnmodifiable();
+ checkSetters(query);
+
+ query = pm.newNamedQuery(Person.class, "unmodifiable");
+ checkSetters(query);
+ } finally {
+ cleanupPM(pm);
+ }
}
private void checkSetters(Query<?> query) {
@@ -175,13 +202,13 @@ public class UnmodifiableQuery extends QueryTest {
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/delete/DeleteQueryElements.java b/tck/src/main/java/org/apache/jdo/tck/query/delete/DeleteQueryElements.java
index 36cbec5a..35a403e1 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/delete/DeleteQueryElements.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/delete/DeleteQueryElements.java
@@ -200,7 +200,7 @@ public class DeleteQueryElements extends QueryTest {
/*JDOQLTyped*/ null,
/*paramValues*/ paramValues);
- deletePersistentAllByAPIQuery(ASSERTION_FAILED, holder, 1);
+ deletePersistentAllByAPIQuery(ASSERTION_FAILED, pm, holder, 1);
}
/** */
@@ -229,15 +229,15 @@ public class DeleteQueryElements extends QueryTest {
/*JDOQLTyped*/ null,
/*paramValues*/ paramValues);
- deletePersistentAllBySingleStringQuery(ASSERTION_FAILED, holder, 1);
+ deletePersistentAllBySingleStringQuery(ASSERTION_FAILED, pm, holder, 1);
}
/** */
@Test
public void testNegative() {
for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- deletePersistentAllByAPIQuery(ASSERTION_FAILED, invalidQuery, -1);
- deletePersistentAllBySingleStringQuery(ASSERTION_FAILED, invalidQuery, -1);
+ deletePersistentAllByAPIQuery(ASSERTION_FAILED, pm, invalidQuery, -1);
+ deletePersistentAllBySingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, -1);
}
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Cast.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Cast.java
index c34b4304..ad8398ec 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Cast.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Cast.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.company.Employee;
@@ -47,89 +48,101 @@ public class Cast extends QueryTest {
/** */
@Test
+ // @Execution(ExecutionMode.CONCURRENT)
+ // ToDo: the test methods hangs when executed in parallel
public void testPositive0() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp5");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ // DataNucleus: java.lang.ClassCastException:
+ // org.datanucleus.api.jdo.query.PersistableExpressionImpl
+ // cannot be cast to org.apache.jdo.tck.pc.company.QFullTimeEmployee
+ QFullTimeEmployee cast = (QFullTimeEmployee) cand.cast(FullTimeEmployee.class);
+ query.filter(cast.salary.gt(15000.0));
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- // DataNucleus: java.lang.ClassCastException:
- // org.datanucleus.api.jdo.query.PersistableExpressionImpl
- // cannot be cast to org.apache.jdo.tck.pc.company.QFullTimeEmployee
- QFullTimeEmployee cast = (QFullTimeEmployee) cand.cast(FullTimeEmployee.class);
- query.filter(cast.salary.gt(15000.0));
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "((FullTimeEmployee)this).salary > 15000.0",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.FullTimeEmployee",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "((FullTimeEmployee)this).salary > 15000.0",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.FullTimeEmployee",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ // @Execution(ExecutionMode.CONCURRENT)
+ // ToDo: the test methods hangs when executed in parallel
public void testPositive1() {
List<Department> expected =
getTransientCompanyModelInstancesAsList(Department.class, "dept1", "dept2");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ QEmployee e = QEmployee.variable("e");
+ // DataNucleus: java.lang.ClassCastException:
+ // org.datanucleus.api.jdo.query.PersistableExpressionImpl
+ // cannot be cast to org.apache.jdo.tck.pc.company.QFullTimeEmployee
+ QFullTimeEmployee cast = (QFullTimeEmployee) e.cast(FullTimeEmployee.class);
+ query.filter(cand.employees.contains(e).and(cast.salary.gt(15000.0)));
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- // DataNucleus: java.lang.ClassCastException:
- // org.datanucleus.api.jdo.query.PersistableExpressionImpl
- // cannot be cast to org.apache.jdo.tck.pc.company.QFullTimeEmployee
- QFullTimeEmployee cast = (QFullTimeEmployee) e.cast(FullTimeEmployee.class);
- query.filter(cand.employees.contains(e).and(cast.salary.gt(15000.0)));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && ((FullTimeEmployee)e).salary > 15000.0",
- /*VARIABLES*/ "Employee e",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.FullTimeEmployee",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.contains(e) && ((FullTimeEmployee)e).salary > 15000.0",
+ /*VARIABLES*/ "Employee e",
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.FullTimeEmployee",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java
index 59beb93d..f43ba3ae 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java
@@ -18,6 +18,7 @@
package org.apache.jdo.tck.query.jdoql;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.mylib.MylibReader;
import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
import org.apache.jdo.tck.pc.mylib.QPrimitiveTypes;
@@ -27,6 +28,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Character and String Literals. <br>
@@ -80,86 +83,102 @@ public class CharacterAndStringLiterals extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
Object expected = getTransientMylibInstancesAsList("primitiveTypesCharacterStringLiterals");
-
- JDOQLTypedQuery<PrimitiveTypes> query = getPM().newJDOQLTypedQuery(PrimitiveTypes.class);
- QPrimitiveTypes cand = QPrimitiveTypes.candidate();
- query.filter(cand.stringNull.startsWith("Even").or(cand.charNotNull.eq('0')));
-
- QueryElementHolder<PrimitiveTypes> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ PrimitiveTypes.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "stringNull.startsWith('Even') || charNotNull == 'O'",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<PrimitiveTypes> query = pm.newJDOQLTypedQuery(PrimitiveTypes.class);
+ QPrimitiveTypes cand = QPrimitiveTypes.candidate();
+ query.filter(cand.stringNull.startsWith("Even").or(cand.charNotNull.eq('0')));
+
+ QueryElementHolder<PrimitiveTypes> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ PrimitiveTypes.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "stringNull.startsWith('Even') || charNotNull == 'O'",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
Object expected = getTransientMylibInstancesAsList("primitiveTypesCharacterStringLiterals");
-
- JDOQLTypedQuery<PrimitiveTypes> query = getPM().newJDOQLTypedQuery(PrimitiveTypes.class);
- QPrimitiveTypes cand = QPrimitiveTypes.candidate();
- query.filter(cand.stringNull.startsWith("Even").or(cand.charNotNull.eq('0')));
-
- QueryElementHolder<PrimitiveTypes> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ PrimitiveTypes.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "stringNull.startsWith(\"Even\") || charNotNull == \"O\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<PrimitiveTypes> query = pm.newJDOQLTypedQuery(PrimitiveTypes.class);
+ QPrimitiveTypes cand = QPrimitiveTypes.candidate();
+ query.filter(cand.stringNull.startsWith("Even").or(cand.charNotNull.eq('0')));
+
+ QueryElementHolder<PrimitiveTypes> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ PrimitiveTypes.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "stringNull.startsWith(\"Even\") || charNotNull == \"O\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, invalidQuery, false);
- compileSingleStringQuery(ASSERTION_FAILED, invalidQuery, false);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingCollectionFieldToNull.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingCollectionFieldToNull.java
index f6d29d21..067c0296 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingCollectionFieldToNull.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingCollectionFieldToNull.java
@@ -47,7 +47,7 @@ public class ComparingCollectionFieldToNull extends QueryTest {
/** */
@Test
public void testPositive() {
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
QEmployee cand = QEmployee.candidate();
query.filter(cand.personid.eq(1L).and(cand.projects.eq(null)));
@@ -69,9 +69,9 @@ public class ComparingCollectionFieldToNull extends QueryTest {
/*JDOQLTyped*/ query,
/*paramValues*/ null);
- executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expectedResult);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expectedResult);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expectedResult);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingPersistentAndNonPersistentInstance.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingPersistentAndNonPersistentInstance.java
index 06bf4a17..4003e5ac 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingPersistentAndNonPersistentInstance.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ComparingPersistentAndNonPersistentInstance.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import javax.jdo.query.Expression;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
@@ -31,6 +32,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Comparing persistent and non-persistent instance <br>
@@ -48,86 +51,96 @@ public class ComparingPersistentAndNonPersistentInstance extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
List<Employee> expected = getTransientCompanyModelInstancesAsList(Employee.class);
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Employee> empParam = query.parameter("param", Employee.class);
- query.filter(cand.eq(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("param", getTransientCompanyModelInstance(Employee.class, "emp1"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this == param",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Employee param",
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Employee> empParam = query.parameter("param", Employee.class);
+ query.filter(cand.eq(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("param", getTransientCompanyModelInstance(Employee.class, "emp1"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this == param",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Employee param",
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
Object expected = getTransientCompanyModelInstancesAsList(Employee.class, "emp1");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Employee> empParamExpression = query.parameter("param", Employee.class);
- QEmployee empParam = QEmployee.parameter("param");
- query.filter(cand.personid.eq(empParam.personid));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("param", getTransientCompanyModelInstance(Employee.class, "emp1"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.personid == param.personid",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Employee param",
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Employee> empParamExpression = query.parameter("param", Employee.class);
+ QEmployee empParam = QEmployee.parameter("param");
+ query.filter(cand.personid.eq(empParam.personid));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("param", getTransientCompanyModelInstance(Employee.class, "emp1"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.personid == param.personid",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Employee param",
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/DenoteUniquenessInFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/DenoteUniquenessInFilter.java
index b11e9294..89dfc3ec 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/DenoteUniquenessInFilter.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/DenoteUniquenessInFilter.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.company.QDepartment;
@@ -29,6 +30,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Element Returned in Query Result <br>
@@ -55,12 +58,13 @@ public class DenoteUniquenessInFilter extends QueryTest {
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
// Uniqueness not specified.
// emp1 qualifies for both contains clause => result is dept1
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
QDepartment cand = QDepartment.candidate();
QEmployee e1 = QEmployee.variable("e1");
QEmployee e2 = QEmployee.variable("e2");
@@ -88,60 +92,67 @@ public class DenoteUniquenessInFilter extends QueryTest {
/*JDOQLTyped*/ query,
/*paramValues*/ null);
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// Uniqueness specified.
// Only emp3 qualifies for both contains clause.
// Condition e1 != e2 violated => result is empty
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class);
-
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e1 = QEmployee.variable("e1");
- QEmployee e2 = QEmployee.variable("e2");
- query.filter(
- cand.employees
- .contains(e1)
- .and(
- e1.personid
- .eq(3l)
- .and(cand.employees.contains(e2).and(e2.weeklyhours.eq(19d).and(e1.ne(e2))))));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e1) && (e1.personid == 3 && "
- + "(employees.contains(e2) && (e2.weeklyhours == 19 && "
- + "e1 != e2)))",
- /*VARIABLES*/ "Employee e1; Employee e2",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ QEmployee e1 = QEmployee.variable("e1");
+ QEmployee e2 = QEmployee.variable("e2");
+ query.filter(
+ cand.employees
+ .contains(e1)
+ .and(
+ e1.personid
+ .eq(3l)
+ .and(
+ cand.employees.contains(e2).and(e2.weeklyhours.eq(19d).and(e1.ne(e2))))));
+
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.contains(e1) && (e1.personid == 3 && "
+ + "(employees.contains(e2) && (e2.weeklyhours == 19 && "
+ + "e1 != e2)))",
+ /*VARIABLES*/ "Employee e1; Employee e2",
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
// Uniqueness specified.
// Only emp1 matches the first contains clause.
@@ -149,53 +160,58 @@ public class DenoteUniquenessInFilter extends QueryTest {
// Thus, there are two different values for e1 and e2
// satifying the entire filter => result is dept1
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
-
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e1 = QEmployee.variable("e1");
- QEmployee e2 = QEmployee.variable("e2");
- query.filter(
- cand.employees
- .contains(e1)
- .and(
- e1.personid
- .eq(1l)
- .and(cand.employees.contains(e2).and(e2.weeklyhours.eq(40d).and(e1.ne(e2))))));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e1) && (e1.personid == 1 && "
- + "(employees.contains(e2) && (e2.weeklyhours == 40 && "
- + "e1 != e2)))",
- /*VARIABLES*/ "Employee e1; Employee e2",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ QEmployee e1 = QEmployee.variable("e1");
+ QEmployee e2 = QEmployee.variable("e2");
+ query.filter(
+ cand.employees
+ .contains(e1)
+ .and(
+ e1.personid
+ .eq(1l)
+ .and(
+ cand.employees.contains(e2).and(e2.weeklyhours.eq(40d).and(e1.ne(e2))))));
+
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.contains(e1) && (e1.personid == 1 && "
+ + "(employees.contains(e2) && (e2.weeklyhours == 40 && "
+ + "e1 != e2)))",
+ /*VARIABLES*/ "Employee e1; Employee e2",
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ExecutingMultipleQueriesSimultaneouslyIsThreadSafe.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ExecutingMultipleQueriesSimultaneouslyIsThreadSafe.java
index d6521c44..84f5c6bb 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ExecutingMultipleQueriesSimultaneouslyIsThreadSafe.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/ExecutingMultipleQueriesSimultaneouslyIsThreadSafe.java
@@ -126,7 +126,7 @@ public class ExecutingMultipleQueriesSimultaneouslyIsThreadSafe
query.setCandidates(pm.getExtent(PCPoint.class, false));
List<PCPoint> results = query.executeList();
for (PCPoint result : results) {
- inserted.add(result);
+ persistentPCPoints.add(result);
}
tx.commit();
tx = null;
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Having.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Having.java
index 38243a9a..0199988a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Having.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/Having.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.Arrays;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.company.Employee;
@@ -29,6 +30,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Having. <br>
@@ -81,6 +84,7 @@ public class Having extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
Object expected =
Arrays.asList(
@@ -92,37 +96,42 @@ public class Having extends QueryTest {
getTransientCompanyModelInstance(Department.class, "dept2"), Double.valueOf(0.0)
}
});
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.groupBy(cand.department).having(cand.department.count().gt(0L));
- query.result(false, cand.department, cand.weeklyhours.avg());
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "department, AVG(weeklyhours)",
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ "department HAVING COUNT(department) > 0",
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, null, true, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.groupBy(cand.department).having(cand.department.count().gt(0L));
+ query.result(false, cand.department, cand.weeklyhours.avg());
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ "department, AVG(weeklyhours)",
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ "department HAVING COUNT(department) > 0",
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, null, true, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// HAVING clause uses field that isn't contained in the SELECT clause.
Object expected =
@@ -135,53 +144,63 @@ public class Having extends QueryTest {
getTransientCompanyModelInstance(Department.class, "dept2"), Double.valueOf(0.0)
}
});
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.groupBy(cand.department).having(cand.personid.count().gt(1L));
- query.result(false, cand.department, cand.weeklyhours.avg());
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "department, AVG(weeklyhours)",
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ "department HAVING COUNT(personid) > 1",
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, null, true, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.groupBy(cand.department).having(cand.personid.count().gt(1L));
+ query.result(false, cand.department, cand.weeklyhours.avg());
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ "department, AVG(weeklyhours)",
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ "department HAVING COUNT(personid) > 1",
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, null, true, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, invalidQuery, false);
- compileSingleStringQuery(ASSERTION_FAILED, invalidQuery, false);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java
index b2f052be..ac7de28c 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.company.Person;
@@ -30,6 +31,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Identifiers Equal Field Names. <br>
@@ -47,179 +50,208 @@ public class IdentifiersEqualFieldNames extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
List<Person> expected = getTransientCompanyModelInstancesAsList(Person.class, "emp1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.filter(cand.firstname.eq("emp1First"));
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.filter(cand.firstname.eq("emp1First"));
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.firstname == 'emp1First'",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.firstname == 'emp1First'",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(
Person.class, "emp1", "emp2", "emp3", "emp4", "emp5");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.filter(cand.personid.lt((long) Byte.MAX_VALUE));
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.personid < Byte.MAX_VALUE",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.filter(cand.personid.lt((long) Byte.MAX_VALUE));
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.personid < Byte.MAX_VALUE",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ query.filter(
+ cand.employees
+ .size()
+ .gt(org.apache.jdo.tck.pc.company.Department.RECOMMENDED_NO_OF_EMPS));
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- query.filter(
- cand.employees.size().gt(org.apache.jdo.tck.pc.company.Department.RECOMMENDED_NO_OF_EMPS));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.size() > org.apache.jdo.tck.pc.company.Department.RECOMMENDED_NO_OF_EMPS",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.size() > org.apache.jdo.tck.pc.company.Department.RECOMMENDED_NO_OF_EMPS",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ query.filter(cand.employees.size().gt(Department.RECOMMENDED_NO_OF_EMPS));
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- query.filter(cand.employees.size().gt(Department.RECOMMENDED_NO_OF_EMPS));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.size() > Department.RECOMMENDED_NO_OF_EMPS",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.size() > Department.RECOMMENDED_NO_OF_EMPS",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive4() {
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ query.filter(cand.employees.size().gt(Department.RECOMMENDED_NO_OF_EMPS));
+
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.size() > RECOMMENDED_NO_OF_EMPS",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- query.filter(cand.employees.size().gt(Department.RECOMMENDED_NO_OF_EMPS));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.size() > RECOMMENDED_NO_OF_EMPS",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
index 8be2cfdd..db7482aa 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import javax.jdo.query.BooleanExpression;
import javax.jdo.query.IfThenElseExpression;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
@@ -33,6 +34,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Use of If Else expression in filter <br>
@@ -99,179 +102,208 @@ public class IfElseInFilter extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
// simple If/Else using literals
List<FullTimeEmployee> expected =
getTransientCompanyModelInstancesAsList(FullTimeEmployee.class, "emp1", "emp5");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<FullTimeEmployee> query = pm.newJDOQLTypedQuery(FullTimeEmployee.class);
+ QFullTimeEmployee cand = QFullTimeEmployee.candidate();
+ IfThenElseExpression<Double> ifExpr =
+ query.ifThenElse(cand.department.name.eq("Development"), 15000.0, 25000.0);
+ query.filter(cand.salary.gt(ifExpr));
+ query.orderBy(cand.personid.asc());
- JDOQLTypedQuery<FullTimeEmployee> query = getPM().newJDOQLTypedQuery(FullTimeEmployee.class);
- QFullTimeEmployee cand = QFullTimeEmployee.candidate();
- IfThenElseExpression<Double> ifExpr =
- query.ifThenElse(cand.department.name.eq("Development"), 15000.0, 25000.0);
- query.filter(cand.salary.gt(ifExpr));
- query.orderBy(cand.personid.asc());
+ QueryElementHolder<FullTimeEmployee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ FullTimeEmployee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.salary > (IF (this.department.name == 'Development') 15000 ELSE 25000)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.personid",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- QueryElementHolder<FullTimeEmployee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ FullTimeEmployee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.salary > (IF (this.department.name == 'Development') 15000 ELSE 25000)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.personid",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
+
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// simple If/Else using relationships
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ IfThenElseExpression<Long> ifExpr =
+ query.ifThenElse(
+ Long.class,
+ cand.manager.eq((Employee) null),
+ cand.mentor.department.deptid,
+ cand.manager.department.deptid);
+ query.filter(ifExpr.eq(cand.department.deptid));
+ query.orderBy(cand.personid.asc());
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- IfThenElseExpression<Long> ifExpr =
- query.ifThenElse(
- Long.class,
- cand.manager.eq((Employee) null),
- cand.mentor.department.deptid,
- cand.manager.department.deptid);
- query.filter(ifExpr.eq(cand.department.deptid));
- query.orderBy(cand.personid.asc());
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "(IF (this.manager == null) this.mentor.department.deptid ELSE this.manager.department.deptid) == this.department.deptid",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.personid",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "(IF (this.manager == null) this.mentor.department.deptid ELSE this.manager.department.deptid) == this.department.deptid",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.personid",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
+
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
// multiple If/Else with distinct conditions
List<FullTimeEmployee> expected =
getTransientCompanyModelInstancesAsList(FullTimeEmployee.class, "emp1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<FullTimeEmployee> query = pm.newJDOQLTypedQuery(FullTimeEmployee.class);
+ QFullTimeEmployee cand = QFullTimeEmployee.candidate();
+ BooleanExpression cond1 = cand.salary.gt(0.0).and(cand.salary.lt(10000.1));
+ BooleanExpression cond2 = cand.salary.gt(10000.1).and(cand.salary.lt(20000.1));
+ BooleanExpression cond3 = cand.salary.gt(20000.1).and(cand.salary.lt(30000.1));
+ IfThenElseExpression<Integer> ifExpr =
+ query.ifThen(cond1, 1).ifThen(cond2, 2).ifThen(cond3, 3).elseEnd(4);
+ query.filter(ifExpr.eq(2));
+ query.orderBy(cand.personid.asc());
- JDOQLTypedQuery<FullTimeEmployee> query = getPM().newJDOQLTypedQuery(FullTimeEmployee.class);
- QFullTimeEmployee cand = QFullTimeEmployee.candidate();
- BooleanExpression cond1 = cand.salary.gt(0.0).and(cand.salary.lt(10000.1));
- BooleanExpression cond2 = cand.salary.gt(10000.1).and(cand.salary.lt(20000.1));
- BooleanExpression cond3 = cand.salary.gt(20000.1).and(cand.salary.lt(30000.1));
- IfThenElseExpression<Integer> ifExpr =
- query.ifThen(cond1, 1).ifThen(cond2, 2).ifThen(cond3, 3).elseEnd(4);
- query.filter(ifExpr.eq(2));
- query.orderBy(cand.personid.asc());
+ QueryElementHolder<FullTimeEmployee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ FullTimeEmployee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "(IF (0.0 <= this.salary && this.salary < 10000.1) 1 ELSE "
+ + "IF (10000.1 <= this.salary && this.salary < 20000.1) 2 ELSE "
+ + "IF (20000.1 <= this.salary && this.salary < 30000.1) 3 ELSE 4) == 2",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.personid",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- QueryElementHolder<FullTimeEmployee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ FullTimeEmployee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "(IF (0.0 <= this.salary && this.salary < 10000.1) 1 ELSE "
- + "IF (10000.1 <= this.salary && this.salary < 20000.1) 2 ELSE "
- + "IF (20000.1 <= this.salary && this.salary < 30000.1) 3 ELSE 4) == 2",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.personid",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
+
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
// multiple If/Else with overlapping conditions
List<FullTimeEmployee> expected =
getTransientCompanyModelInstancesAsList(FullTimeEmployee.class, "emp1");
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<FullTimeEmployee> query = pm.newJDOQLTypedQuery(FullTimeEmployee.class);
+ QFullTimeEmployee cand = QFullTimeEmployee.candidate();
+ BooleanExpression cond1 = cand.salary.lt(10000.1);
+ BooleanExpression cond2 = cand.salary.lt(20000.1);
+ BooleanExpression cond3 = cand.salary.lt(30000.1);
+ IfThenElseExpression<Integer> ifExpr =
+ query.ifThen(cond1, 1).ifThen(cond2, 2).ifThen(cond3, 3).elseEnd(4);
+ query.filter(ifExpr.eq(2));
- JDOQLTypedQuery<FullTimeEmployee> query = getPM().newJDOQLTypedQuery(FullTimeEmployee.class);
- QFullTimeEmployee cand = QFullTimeEmployee.candidate();
- BooleanExpression cond1 = cand.salary.lt(10000.1);
- BooleanExpression cond2 = cand.salary.lt(20000.1);
- BooleanExpression cond3 = cand.salary.lt(30000.1);
- IfThenElseExpression<Integer> ifExpr =
- query.ifThen(cond1, 1).ifThen(cond2, 2).ifThen(cond3, 3).elseEnd(4);
- query.filter(ifExpr.eq(2));
+ QueryElementHolder<FullTimeEmployee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ FullTimeEmployee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "(IF (this.salary < 10000.1) 1 ELSE "
+ + "IF (this.salary < 20000.1) 2 ELSE IF (this.salary < 30000.1) 3 ELSE 4) == 2",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.personid",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
- QueryElementHolder<FullTimeEmployee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ FullTimeEmployee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "(IF (this.salary < 10000.1) 1 ELSE "
- + "IF (this.salary < 20000.1) 2 ELSE IF (this.salary < 30000.1) 3 ELSE 4) == 2",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.personid",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, invalidQuery, false);
- compileSingleStringQuery(ASSERTION_FAILED, invalidQuery, false);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/MultipleIdenticalImports.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/MultipleIdenticalImports.java
index 75fffb83..82bb0a41 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/MultipleIdenticalImports.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/MultipleIdenticalImports.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import javax.jdo.query.Expression;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
@@ -32,6 +33,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Multiple identical imports <br>
@@ -48,130 +51,145 @@ public class MultipleIdenticalImports extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testImportDepartmentTwice() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Department> empParam = query.parameter("d", Department.class);
- query.filter(cand.department.eq(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("d", getPersistentCompanyModelInstance(Department.class, "dept1"));
-
- // Import Department twice
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "department == d",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Department d",
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department; "
- + "import org.apache.jdo.tck.pc.company.Department;",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Department> empParam = query.parameter("d", Department.class);
+ query.filter(cand.department.eq(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("d", getPersistentCompanyModelInstance(pm, Department.class, "dept1"));
+
+ // Import Department twice
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "department == d",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Department d",
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department; "
+ + "import org.apache.jdo.tck.pc.company.Department;",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testImportDepartmentExplicitlyAndPerTypeImportOnDemand() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Department> empParam = query.parameter("d", Department.class);
- query.filter(cand.department.eq(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("d", getPersistentCompanyModelInstance(Department.class, "dept1"));
-
- // Import Department explictly and per type-import-on-demand
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "department == d",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Department d",
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department; "
- + "import org.apache.jdo.tck.pc.company.*",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Department> empParam = query.parameter("d", Department.class);
+ query.filter(cand.department.eq(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("d", getPersistentCompanyModelInstance(pm, Department.class, "dept1"));
+
+ // Import Department explictly and per type-import-on-demand
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "department == d",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Department d",
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department; "
+ + "import org.apache.jdo.tck.pc.company.*",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testTypeImportOnDemandTwice() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Department> empParam = query.parameter("d", Department.class);
- query.filter(cand.department.eq(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("d", getPersistentCompanyModelInstance(Department.class, "dept1"));
-
- // type-import-on-demand twice
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "department == d",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Department d",
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.*; "
- + "import org.apache.jdo.tck.pc.company.*",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Department> empParam = query.parameter("d", Department.class);
+ query.filter(cand.department.eq(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("d", getPersistentCompanyModelInstance(pm, Department.class, "dept1"));
+
+ // type-import-on-demand twice
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "department == d",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Department d",
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.*; "
+ + "import org.apache.jdo.tck.pc.company.*",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java
index c3b31ae9..54c370fa 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
import org.apache.jdo.tck.pc.company.MedicalInsurance;
@@ -30,6 +31,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Navigation Through a Reference and comparing a Relationship with null <br>
@@ -76,276 +79,324 @@ public class NavigationComparisonWithNull extends QueryTest {
/** this.manager == null */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
// 0: simple manager check being null
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp0", "emp4", "emp7");
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.eq((Employee) null));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager == null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.eq((Employee) null));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager == null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.manager != null */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// 1: simple manager check being not null
List<Employee> expected =
getTransientCompanyModelInstancesAsList(
Employee.class, "emp1", "emp2", "emp3", "emp5", "emp6", "emp8", "emp9", "emp10");
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.ne((Employee) null));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager != null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.ne((Employee) null));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager != null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** !(this.manager == null) */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
// 2: simple manager check being not null using not operator
List<Employee> expected =
getTransientCompanyModelInstancesAsList(
Employee.class, "emp1", "emp2", "emp3", "emp5", "emp6", "emp8", "emp9", "emp10");
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.eq((Employee) null).not());
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "!(this.manager == null)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.eq((Employee) null).not());
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "!(this.manager == null)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.manager.manager == null Disabled, because it currently fails on the RI. */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
// 3: manager's manager check
List<Employee> expected =
getTransientCompanyModelInstancesAsList(
Employee.class, "emp0", "emp1", "emp4", "emp5", "emp6", "emp7", "emp8", "emp9");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.manager.eq((Employee) null));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager.manager == null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.manager.eq((Employee) null));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager.manager == null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.manager != null AND this.manager.manager == null */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive4() {
// 4: manager's manager check with extra check on first level manager
List<Employee> expected =
getTransientCompanyModelInstancesAsList(
Employee.class, "emp1", "emp5", "emp6", "emp8", "emp9");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.ne((Employee) null).and(cand.manager.manager.eq((Employee) null)));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager != null && this.manager.manager == null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.ne((Employee) null).and(cand.manager.manager.eq((Employee) null)));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager != null && this.manager.manager == null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.manager.manager != null */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive5() {
// 5 : manager's manager check not being null
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp2", "emp3", "emp10");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.manager.ne((Employee) null));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager.manager != null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.manager.ne((Employee) null));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager.manager != null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** !(this.manager.manager == null) */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive6() {
// 6 : manager's manager check not being null using not operator
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp2", "emp3", "emp10");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- QEmployee e = QEmployee.variable("e");
- query.filter(cand.manager.manager.eq((Employee) null).not());
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "!(this.manager.manager == null)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ QEmployee e = QEmployee.variable("e");
+ query.filter(cand.manager.manager.eq((Employee) null).not());
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "!(this.manager.manager == null)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.employee.manager.manager == null Disabled, because it currently fails on the RI. */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive7() {
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns1", "medicalIns4", "medicalIns5", "medicalIns98");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.manager.manager.eq((Employee) null));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee.manager.manager == null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.manager.manager.eq((Employee) null));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee.manager.manager == null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/**
@@ -353,122 +404,140 @@ public class NavigationComparisonWithNull extends QueryTest {
* null
*/
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive8() {
// 8 : multiple relationships
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns1", "medicalIns5");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(
- cand.employee
- .ne((Employee) null)
- .and(cand.employee.manager.ne((Employee) null))
- .and(cand.employee.manager.manager.eq((Employee) null)));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee != null && this.employee.manager != null && "
- + "this.employee.manager.manager == null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(
+ cand.employee
+ .ne((Employee) null)
+ .and(cand.employee.manager.ne((Employee) null))
+ .and(cand.employee.manager.manager.eq((Employee) null)));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee != null && this.employee.manager != null && "
+ + "this.employee.manager.manager == null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** this.employee.manager.manager != null */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive9() {
// 9 : multiple relationships
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns2", "medicalIns3");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.manager.manager.ne((Employee) null));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee.manager.manager != null",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.manager.manager.ne((Employee) null));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee.manager.manager != null",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** !(this.employee.manager.manager == null) */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive10() {
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns2", "medicalIns3");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.manager.manager.eq((Employee) null).not());
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "!(this.employee.manager.manager == null)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.manager.manager.eq((Employee) null).not());
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "!(this.employee.manager.manager == null)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java
index 05e5b5df..0514592a 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java
@@ -83,9 +83,9 @@ public class NavigationThroughACollectionField extends QueryTest {
/*JDOQLTyped*/ query,
/*paramValues*/ null);
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java
index 79b08cb7..597544a9 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
import org.apache.jdo.tck.pc.company.Employee;
@@ -30,6 +31,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Navigation Through a Null-Valued Field <br>
@@ -62,152 +65,172 @@ public class NavigationThroughANullValuedField extends QueryTest {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// navigation through reference relationship field
// the relationship medicalInsurance is not set for emp2 and emp3 =>
// they should not be part of the result
List<Employee> expected = getTransientCompanyModelInstancesAsList(Employee.class, "emp1");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.medicalInsurance.carrier == \"Carrier1\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.medicalInsurance.carrier == \"Carrier1\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
// navigation through reference relationship field
// emp5 and emp6 have have emp4 as manager
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp5", "emp6");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.lastname.eq("emp4Last"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager.lastname == \"emp4Last\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.lastname.eq("emp4Last"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager.lastname == \"emp4Last\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
// multiple navigation through reference relationship field
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp2", "emp3", "emp10");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.manager.manager.lastname.eq("emp0Last"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.manager.manager.lastname == \"emp0Last\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.manager.manager.lastname.eq("emp0Last"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.manager.manager.lastname == \"emp0Last\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive4() {
// navigation through collection relationship field
// employees emp2 and emp3 do not have a medicalInsurance, but emp1
// matches the filter such that dept1 qualifies for inclusion in the
// result set.
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
-
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- query.filter(cand.employees.contains(e).and(e.medicalInsurance.carrier.eq("Carrier1")));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && e.medicalInsurance.carrier == \"Carrier1\"",
- /*VARIABLES*/ "Employee e",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ QEmployee e = QEmployee.variable("e");
+ query.filter(cand.employees.contains(e).and(e.medicalInsurance.carrier.eq("Carrier1")));
+
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.contains(e) && e.medicalInsurance.carrier == \"Carrier1\"",
+ /*VARIABLES*/ "Employee e",
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java
index 143d4493..4a254cf5 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
import org.apache.jdo.tck.pc.company.MedicalInsurance;
@@ -30,6 +31,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Navigation Through a References uses Dot Operator <br>
@@ -60,38 +63,44 @@ public class NavigationThroughReferencesUsesDotOperator extends QueryTest {
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
// navigation through one relationship
List<Employee> expected = getTransientCompanyModelInstancesAsList(Employee.class, "emp1");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "medicalInsurance.carrier == \"Carrier1\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "medicalInsurance.carrier == \"Carrier1\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
// navigation through multiple relationships
List<MedicalInsurance> expected =
@@ -102,111 +111,125 @@ public class NavigationThroughReferencesUsesDotOperator extends QueryTest {
"medicalIns3",
"medicalIns4",
"medicalIns5");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.department.name.eq("Development"));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee.department.name == \"Development\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.department.name.eq("Development"));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee.department.name == \"Development\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
// navigation through a self referencing relationship
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns2", "medicalIns3");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.manager.firstname.eq("emp1First"));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee.manager.firstname == \"emp1First\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.manager.firstname.eq("emp1First"));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee.manager.firstname == \"emp1First\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
// navigation through a self referencing relationship multiple times
List<MedicalInsurance> expected =
getTransientCompanyModelInstancesAsList(
MedicalInsurance.class, "medicalIns2", "medicalIns3");
-
- JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
- QMedicalInsurance cand = QMedicalInsurance.candidate();
- query.filter(cand.employee.manager.manager.firstname.eq("emp0First"));
-
- QueryElementHolder<MedicalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ MedicalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "this.employee.manager.manager.firstname == \"emp0First\"",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<MedicalInsurance> query = pm.newJDOQLTypedQuery(MedicalInsurance.class);
+ QMedicalInsurance cand = QMedicalInsurance.candidate();
+ query.filter(cand.employee.manager.manager.firstname.eq("emp0First"));
+
+ QueryElementHolder<MedicalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ MedicalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "this.employee.manager.manager.firstname == \"emp0First\"",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java
index 23edec1a..8a76af8c 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.Arrays;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Person;
import org.apache.jdo.tck.query.QueryElementHolder;
@@ -27,6 +28,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Negative Range. <br>
@@ -44,130 +47,150 @@ public class NegativeRange extends QueryTest {
private static final String ASSERTION_FAILED = "Assertion A14.6.8-2 (NegativeRange) failed: ";
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNonUnique0() {
Object expected = Arrays.asList();
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ 4,
- /*TO*/ 4,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ 4,
+ /*TO*/ 4,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNonUnique1() {
Object expected = Arrays.asList();
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ 4,
- /*TO*/ 3,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ 4,
+ /*TO*/ 3,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUnique0() {
Object expected = null;
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ Boolean.TRUE,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ 4,
- /*TO*/ 4,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ Boolean.TRUE,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ 4,
+ /*TO*/ 4,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testUnique1() {
Object expected = null;
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ Boolean.TRUE,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ 4,
- /*TO*/ 3,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ Boolean.TRUE,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ 4,
+ /*TO*/ 3,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java
index d17d7b1f..897e6a91 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import javax.jdo.query.Expression;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Employee;
@@ -32,6 +33,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Null Collections and Contains Method <br>
@@ -51,89 +54,99 @@ public class NullCollectionsAndContainsMethod extends QueryTest {
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testContains1() {
List<Employee> expected = getTransientCompanyModelInstancesAsList(Employee.class);
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Project> empParam = query.parameter("p", Project.class);
- query.filter(cand.personid.eq(1L).and(cand.projects.contains(empParam)));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("p", getPersistentCompanyModelInstance(Project.class, "proj1"));
-
- // contains
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "personid == 1 && projects.contains(p)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "org.apache.jdo.tck.pc.company.Project p",
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Project> empParam = query.parameter("p", Project.class);
+ query.filter(cand.personid.eq(1L).and(cand.projects.contains(empParam)));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("p", getPersistentCompanyModelInstance(pm, Project.class, "proj1"));
+
+ // contains
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "personid == 1 && projects.contains(p)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "org.apache.jdo.tck.pc.company.Project p",
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testContains2() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp2", "emp3");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Project> empParam = query.parameter("p", Project.class);
- query.filter(cand.projects.contains(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("p", getPersistentCompanyModelInstance(Project.class, "proj1"));
-
- // contains
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "projects.contains(p)",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "org.apache.jdo.tck.pc.company.Project p",
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Project> empParam = query.parameter("p", Project.class);
+ query.filter(cand.projects.contains(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put("p", getPersistentCompanyModelInstance(pm, Project.class, "proj1"));
+
+ // contains
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "projects.contains(p)",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "org.apache.jdo.tck.pc.company.Project p",
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
@@ -145,7 +158,7 @@ public class NullCollectionsAndContainsMethod extends QueryTest {
addTearDownClass(CompanyModelReader.getTearDownClasses());
loadAndPersistCompanyModel(getPM());
getPM().currentTransaction().begin();
- Employee emp1 = getPersistentCompanyModelInstance(Employee.class, "emp1");
+ Employee emp1 = getPersistentCompanyModelInstance(pm, Employee.class, "emp1");
emp1.setProjects(null);
getPM().currentTransaction().commit();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java
index 46b79031..dece5ca3 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java
@@ -67,9 +67,9 @@ public class NullCollectionsAndIsEmpty extends QueryTest {
/*JDOQLTyped*/ query,
/*paramValues*/ null);
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
}
/**
@@ -80,7 +80,7 @@ public class NullCollectionsAndIsEmpty extends QueryTest {
addTearDownClass(CompanyModelReader.getTearDownClasses());
loadAndPersistCompanyModel(getPM());
getPM().currentTransaction().begin();
- Employee emp1 = getPersistentCompanyModelInstance(Employee.class, "emp1");
+ Employee emp1 = getPersistentCompanyModelInstance(pm, Employee.class, "emp1");
emp1.setProjects(null);
getPM().currentTransaction().commit();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java
index 5198b37b..62b53316 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java
@@ -18,8 +18,8 @@
package org.apache.jdo.tck.query.jdoql;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import java.util.ListIterator;
import javax.jdo.JDOQLTypedQuery;
import javax.jdo.PersistenceManager;
import javax.jdo.Query;
@@ -35,6 +35,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Ordering Specification <br>
@@ -68,6 +70,7 @@ public class OrderingSpecification extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositiveCompanyQueries0() {
// nulls first
List<DentalInsurance> expected =
@@ -79,36 +82,41 @@ public class OrderingSpecification extends QueryTest {
"dentalIns3",
"dentalIns4",
"dentalIns5");
-
- JDOQLTypedQuery<DentalInsurance> query = getPM().newJDOQLTypedQuery(DentalInsurance.class);
- QDentalInsurance cand = QDentalInsurance.candidate();
- query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsFirst());
-
- QueryElementHolder<DentalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ DentalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls first",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<DentalInsurance> query = pm.newJDOQLTypedQuery(DentalInsurance.class);
+ QDentalInsurance cand = QDentalInsurance.candidate();
+ query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsFirst());
+
+ QueryElementHolder<DentalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ DentalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls first",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositiveCompanyQueries1() {
// nulls last
List<DentalInsurance> expected =
@@ -120,42 +128,50 @@ public class OrderingSpecification extends QueryTest {
"dentalIns4",
"dentalIns5",
"dentalIns99");
-
- JDOQLTypedQuery<DentalInsurance> query = getPM().newJDOQLTypedQuery(DentalInsurance.class);
- QDentalInsurance cand = QDentalInsurance.candidate();
- query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsLast());
-
- QueryElementHolder<DentalInsurance> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ DentalInsurance.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls last",
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<DentalInsurance> query = pm.newJDOQLTypedQuery(DentalInsurance.class);
+ QDentalInsurance cand = QDentalInsurance.candidate();
+ query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsLast());
+
+ QueryElementHolder<DentalInsurance> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ DentalInsurance.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "this.lifetimeOrthoBenefit ascending nulls last",
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestOrderingSpecification01(pm);
- runTestOrderingSpecification02(pm);
- checkOrderingTypes(pm);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ runTestOrderingSpecification01(pm);
+ runTestOrderingSpecification02(pm);
+ checkOrderingTypes(pm);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@@ -172,8 +188,8 @@ public class OrderingSpecification extends QueryTest {
Object results = query.execute();
// check query result
- printOutput(results, inserted);
- checkQueryResultWithOrder(ASSERTION_FAILED, "null", results, inserted);
+ printOutput(results, transientPCPoints);
+ checkQueryResultWithOrder(ASSERTION_FAILED, "null", results, transientPCPoints);
if (debug) logger.debug("Test OrderingSpecification01(): Passed");
tx.commit();
@@ -197,14 +213,8 @@ public class OrderingSpecification extends QueryTest {
Object results = query.execute();
// check query result
- List<PCPoint> expected = new ArrayList<>();
- ListIterator<PCPoint> li = inserted.listIterator(inserted.size());
- // construct expected results by iterating inserted objects backwards
- while (li.hasPrevious()) {
- PCPoint obj = li.previous();
- expected.add(obj);
- }
- expected = getFromInserted(expected);
+ List<PCPoint> expected = new ArrayList<>(transientPCPoints);
+ Collections.reverse(expected);
printOutput(results, expected);
checkQueryResultWithOrder(ASSERTION_FAILED, "null", results, expected);
if (debug) logger.debug("Test OrderingSpecification02(): Passed");
@@ -258,13 +268,13 @@ public class OrderingSpecification extends QueryTest {
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java
index ecca2c1f..9350cc38 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Person;
import org.apache.jdo.tck.pc.company.QPerson;
@@ -28,6 +29,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Positive Range. <br>
@@ -42,143 +45,163 @@ public class PositiveRange extends QueryTest {
private static final String ASSERTION_FAILED = "Assertion A14.6.8-1 (PositiveRange) failed: ";
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(
Person.class, "emp1", "emp2", "emp3", "emp4", "emp5");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ 0,
- /*TO*/ 5,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ 0,
+ /*TO*/ 5,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp1", "emp2", "emp3", "emp4");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ 0,
- /*TO*/ 4,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ 0,
+ /*TO*/ 4,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp2", "emp3", "emp4", "emp5");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ 1,
- /*TO*/ 5,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ 1,
+ /*TO*/ 5,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp2", "emp3", "emp4");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ 1,
- /*TO*/ 4,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ 1,
+ /*TO*/ 4,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java
index 7456e397..710409af 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import java.util.List;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Person;
import org.apache.jdo.tck.pc.company.QPerson;
@@ -28,6 +29,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Range as String. <br>
@@ -43,143 +46,164 @@ public class RangeAsString extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive0() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(
Person.class, "emp1", "emp2", "emp3", "emp4", "emp5");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ "0",
- /*TO*/ "5",
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ "0",
+ /*TO*/ "5",
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive1() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp1", "emp2", "emp3", "emp4");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ "0",
- /*TO*/ "4",
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ "0",
+ /*TO*/ "4",
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
+
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive2() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp2", "emp3", "emp4", "emp5");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ "1",
- /*TO*/ "5",
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ "1",
+ /*TO*/ "5",
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive3() {
List<Person> expected =
getTransientCompanyModelInstancesAsList(Person.class, "emp2", "emp3", "emp4");
-
- JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
- QPerson cand = QPerson.candidate();
- query.orderBy(cand.personid.asc());
-
- QueryElementHolder<Person> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Person.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ null,
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ "personid ASCENDING",
- /*FROM*/ "1",
- /*TO*/ "4",
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Person> query = pm.newJDOQLTypedQuery(Person.class);
+ QPerson cand = QPerson.candidate();
+ query.orderBy(cand.personid.asc());
+
+ QueryElementHolder<Person> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Person.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ "personid ASCENDING",
+ /*FROM*/ "1",
+ /*TO*/ "4",
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java
index e804ab26..b0c96f81 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java
@@ -21,6 +21,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.PersistenceManager;
import javax.jdo.query.Expression;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
import org.apache.jdo.tck.pc.company.Department;
@@ -33,6 +34,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Namespace of Type Names Separate From Fields, Variables, Parameters <br>
@@ -50,84 +53,95 @@ public class SeparateNamespaceForTypeNames extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testParameterName() {
List<Employee> expected =
getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3");
-
- JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- Expression<Department> empParam = query.parameter("Department", Department.class);
- query.filter(cand.department.eq(empParam));
-
- Map<String, Object> paramValues = new HashMap<>();
- paramValues.put("Department", getPersistentCompanyModelInstance(Department.class, "dept1"));
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "department == Department",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "Department Department",
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ paramValues);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
+ QEmployee cand = QEmployee.candidate();
+ Expression<Department> empParam = query.parameter("Department", Department.class);
+ query.filter(cand.department.eq(empParam));
+
+ Map<String, Object> paramValues = new HashMap<>();
+ paramValues.put(
+ "Department", getPersistentCompanyModelInstance(pm, Department.class, "dept1"));
+
+ QueryElementHolder<Employee> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "department == Department",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ "Department Department",
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Department",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ paramValues);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
/** */
@SuppressWarnings("unchecked")
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testVaiableName() {
List<Department> expected = getTransientCompanyModelInstancesAsList(Department.class, "dept1");
-
- JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee variable = QEmployee.variable("Employee");
- query.filter(cand.employees.contains(variable).and(variable.firstname.eq("emp1First")));
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(Employee) && Employee.firstname == \"emp1First\"",
- /*VARIABLES*/ "Employee Employee",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Employee",
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null,
- /*JDOQLTyped*/ query,
- /*paramValues*/ null);
-
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
- executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
+ QDepartment cand = QDepartment.candidate();
+ QEmployee variable = QEmployee.variable("Employee");
+ query.filter(cand.employees.contains(variable).and(variable.firstname.eq("emp1First")));
+
+ QueryElementHolder<Department> holder =
+ new QueryElementHolder<>(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Department.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "employees.contains(Employee) && Employee.firstname == \"emp1First\"",
+ /*VARIABLES*/ "Employee Employee",
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ "import org.apache.jdo.tck.pc.company.Employee",
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null,
+ /*JDOQLTyped*/ query,
+ /*paramValues*/ null);
+
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeJDOQLTypedQuery(ASSERTION_FAILED, pm, holder, expected);
+ } finally {
+ cleanupPM(pm);
+ }
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
index e92f1884..a60f2306 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/InvalidUseOfKeywords.java
@@ -17,10 +17,16 @@
package org.apache.jdo.tck.query.jdoql.keywords;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.company.Person;
import org.apache.jdo.tck.query.QueryElementHolder;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Invalid uses of keywords. <br>
@@ -29,6 +35,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> Keywords must not be used as package names, class names, parameter
* names, or variable names in queries.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class InvalidUseOfKeywords extends QueryTest {
/** */
@@ -81,14 +88,41 @@ public class InvalidUseOfKeywords extends QueryTest {
/** */
@Test
- public void testNegative() {
- for (String invalidSingleStringQuery : INVALID_SINGLE_STRING_QUERIES) {
- compileSingleStringQuery(ASSERTION_FAILED, invalidSingleStringQuery, false);
+ @Execution(ExecutionMode.CONCURRENT)
+ public void testNegative1() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (String invalidSingleStringQuery : INVALID_SINGLE_STRING_QUERIES) {
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidSingleStringQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
+ }
- for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, invalidQuery, false);
- compileSingleStringQuery(ASSERTION_FAILED, invalidQuery, false);
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void testNegative2() {
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
+
+ @BeforeAll
+ @Override
+ protected void setUp() {
+ super.setUp();
+ }
+
+ @AfterAll
+ @Override
+ protected void tearDown() {
+ super.tearDown();
+ }
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
index f1cbd79c..8afae850 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/KeywordsAsFieldNames.java
@@ -17,6 +17,7 @@
package org.apache.jdo.tck.query.jdoql.keywords;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.pc.query.JDOQLKeywordsAsFieldNames;
import org.apache.jdo.tck.query.QueryElementHolder;
import org.apache.jdo.tck.query.QueryTest;
@@ -24,6 +25,8 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Keywords as field names. <br>
@@ -81,30 +84,42 @@ public class KeywordsAsFieldNames extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive() {
- for (QueryElementHolder<?> validQuery : VALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, validQuery, true);
- compileSingleStringQuery(ASSERTION_FAILED, validQuery, true);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> validQuery : VALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, validQuery, true);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, validQuery, true);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegative() {
- for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
- compileAPIQuery(ASSERTION_FAILED, invalidQuery, false);
- compileSingleStringQuery(ASSERTION_FAILED, invalidQuery, false);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (QueryElementHolder<?> invalidQuery : INVALID_QUERIES) {
+ compileAPIQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
index 8f46d35e..3e72795d 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
@@ -71,8 +71,8 @@ public class SingleString extends QueryTest {
/*JDOQLTyped*/ null,
/*paramValues*/ paramValues);
- executeAPIQuery(ASSERTION_FAILED, holder, expected);
- executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+ executeAPIQuery(ASSERTION_FAILED, pm, holder, expected);
+ executeSingleStringQuery(ASSERTION_FAILED, pm, holder, expected);
}
/**
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
index 64fa3daf..c4c5efba 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UppercaseLowercase.java
@@ -17,11 +17,14 @@
package org.apache.jdo.tck.query.jdoql.keywords;
+import javax.jdo.PersistenceManager;
import org.apache.jdo.tck.query.QueryTest;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Keywords in uppercase and lowercase. <br>
@@ -51,28 +54,40 @@ public class UppercaseLowercase extends QueryTest {
/** */
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testPositive() {
- for (String validSingleStringQuery : VALID_SINGLE_STRING_QUERIES) {
- compileSingleStringQuery(ASSERTION_FAILED, validSingleStringQuery, true);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (String validSingleStringQuery : VALID_SINGLE_STRING_QUERIES) {
+ compileSingleStringQuery(ASSERTION_FAILED, pm, validSingleStringQuery, true);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@Test
+ @Execution(ExecutionMode.CONCURRENT)
public void testNegitve() {
- for (String invalidSingleStringQuery : INVALID_SINGLE_STRING_QUERIES) {
- compileSingleStringQuery(ASSERTION_FAILED, invalidSingleStringQuery, false);
+ PersistenceManager pm = getPMF().getPersistenceManager();
+ try {
+ for (String invalidSingleStringQuery : INVALID_SINGLE_STRING_QUERIES) {
+ compileSingleStringQuery(ASSERTION_FAILED, pm, invalidSingleStringQuery, false);
+ }
+ } finally {
+ cleanupPM(pm);
}
}
@BeforeAll
@Override
- public void setUp() {
+ protected void setUp() {
super.setUp();
}
@AfterAll
@Override
- public void tearDown() {
+ protected void tearDown() {
super.tearDown();
}
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java
index 72db106e..55f132a9 100644
--- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java
+++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java
@@ -24,7 +24,12 @@ import javax.jdo.Query;
import javax.jdo.Transaction;
import org.apache.jdo.tck.pc.mylib.PCPoint;
import org.apache.jdo.tck.query.QueryTest;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
/**
* <B>Title:</B> Use of this to Access Hidden Field <br>
@@ -33,6 +38,7 @@ import org.junit.jupiter.api.Test;
* <B>Assertion Description: </B> A hidden field may be accessed using the <code>'this'</code>
* qualifier: <code>this.fieldName</code>.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class UseOfThisToAcessHiddenField extends QueryTest {
/** */
@@ -41,17 +47,11 @@ public class UseOfThisToAcessHiddenField extends QueryTest {
/** */
@Test
- public void testPositve() {
- PersistenceManager pm = getPM();
-
- runTestUseOfThisToAcessHiddenField01(pm);
- runTestUseOfThisToAcessHiddenField02(pm);
- }
-
- /** */
- void runTestUseOfThisToAcessHiddenField01(PersistenceManager pm) {
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestUseOfThisToAcessHiddenField01() {
if (debug) logger.debug("\nExecuting test UseOfThisToAcessHiddenField01() ...");
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -65,24 +65,24 @@ public class UseOfThisToAcessHiddenField extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p3 = new PCPoint(2, 2);
- expected.add(p3);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(2));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "this.x == x", results, expected);
if (debug) logger.debug("Test UseOfThisToAcessHiddenField01(): Passed");
tx.commit();
- tx = null;
} finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
+ cleanupPM(pm);
}
}
/** */
- void runTestUseOfThisToAcessHiddenField02(PersistenceManager pm) {
+ @Test
+ @Execution(ExecutionMode.CONCURRENT)
+ public void runTestUseOfThisToAcessHiddenField02() {
if (debug) logger.debug("\nExecuting test UseOfThisToAcessHiddenField02() ...");
+ PersistenceManager pm = getPMF().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
@@ -96,20 +96,29 @@ public class UseOfThisToAcessHiddenField extends QueryTest {
// check query result
List<PCPoint> expected = new ArrayList<>();
- PCPoint p4 = new PCPoint(3, 3);
- expected.add(p4);
- expected = getFromInserted(expected);
+ expected.add(getTransientPCPoint(3));
printOutput(results, expected);
checkQueryResultWithoutOrder(ASSERTION_FAILED, "this.y == y", results, expected);
if (debug) logger.debug("Test UseOfThisToAcessHiddenField02(): Passed");
... 43040 lines suppressed ...