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/15 23:06:41 UTC
(db-jdo) 03/03: JDO-831: Removed TCK classes that are combined in a single classes
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
commit 6e9ca77edee5ddf2ba263f5238ac117881f4c793
Author: Michael Bouschen <Mi...@akquinet.de>
AuthorDate: Tue Jan 16 00:06:22 2024 +0100
JDO-831: Removed TCK classes that are combined in a single classes
---
.../apache/jdo/tck/query/api/AutoCloseable.java | 262 ----------------
.../java/org/apache/jdo/tck/query/api/Close.java | 115 -------
.../org/apache/jdo/tck/query/api/CloseAll.java | 89 ------
.../apache/jdo/tck/query/api/DeclareImports.java | 147 ---------
.../jdo/tck/query/api/DeclareParameters.java | 147 ---------
.../apache/jdo/tck/query/api/DeclareVariables.java | 105 -------
.../org/apache/jdo/tck/query/api/ExecuteQuery.java | 152 ---------
.../jdo/tck/query/api/ExecuteQueryWithArray.java | 131 --------
.../jdo/tck/query/api/ExecuteQueryWithMap.java | 135 --------
.../org/apache/jdo/tck/query/api/GetFetchPlan.java | 129 --------
.../apache/jdo/tck/query/api/GetIgnoreCache.java | 119 --------
.../jdo/tck/query/api/GetPersistenceManager.java | 117 -------
...sistenceManagerFromRestoredSerializedQuery.java | 118 -------
.../jdo/tck/query/api/InvalidNamedQuery.java | 49 ---
.../jdo/tck/query/api/NamedQueryNotFound.java | 49 ---
.../query/api/NamedQueryRepeatableAnnotations.java | 50 ---
.../apache/jdo/tck/query/api/NewNamedQuery.java | 122 --------
...ryFromExistingQueryBoundToPMFromSameVendor.java | 145 ---------
.../api/NewQueryFromRestoredSerializedQuery.java | 121 --------
.../jdo/tck/query/api/NewQuerySingleString.java | 81 -----
.../tck/query/api/NewQueryWithCandidateClass.java | 71 -----
.../NewQueryWithCandidateClassAndCollection.java | 71 -----
.../api/NewQueryWithCandidateClassAndExtent.java | 73 -----
.../api/NewQueryWithCandidateClassAndFilter.java | 78 -----
...NewQueryWithCandidateClassCollectionFilter.java | 77 -----
.../jdo/tck/query/api/NewQueryWithExtent.java | 70 -----
.../tck/query/api/NewQueryWithExtentAndFilter.java | 75 -----
.../api/NewQueryWithSpecifiedLanguageAndQuery.java | 95 ------
.../jdo/tck/query/api/SetCandidateCollection.java | 88 ------
.../jdo/tck/query/api/SetCandidateExtent.java | 86 ------
.../org/apache/jdo/tck/query/api/SetFilter.java | 79 -----
.../org/apache/jdo/tck/query/api/SetGrouping.java | 64 ----
.../apache/jdo/tck/query/api/SetIgnoreCache.java | 142 ---------
.../org/apache/jdo/tck/query/api/SetOrdering.java | 120 --------
.../org/apache/jdo/tck/query/api/SetRange.java | 63 ----
.../org/apache/jdo/tck/query/api/SetResult.java | 111 -------
.../apache/jdo/tck/query/api/SetResultClass.java | 72 -----
.../org/apache/jdo/tck/query/api/SetUnique.java | 72 -----
.../tck/query/api/SetterReplacePreviousValues.java | 190 ------------
.../jdo/tck/query/result/VariableInResult.java | 290 ------------------
.../result/VariableInResultMultipleNavigation.java | 267 ----------------
.../query/result/VariableInResultNavigation.java | 338 ---------------------
tck/src/main/resources/conf/query-orig.conf | 100 ------
43 files changed, 5075 deletions(-)
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
deleted file mode 100644
index c038f674..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/AutoCloseable.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import javax.jdo.JDOUserException;
-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> AutoCloseable <br>
- * <B>Keywords:</B> query close <br>
- * <B>Assertion IDs:</B> A14.6.7-3. <br>
- * <B>Assertion Description: </B> In a non-managed environment, if the query is created with
- * try-with-resources all results of execute(...) methods on this query instance are automatically
- * closed at the end of that block and all resources associated with it are released.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class AutoCloseable extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.7-3 (AutoCloseable) failed: ";
-
- /**
- * This methods creates a query instance with try-with-resources and checks that an iterator for
- * the query result is not accessible after the block.
- */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testTryWithResource() {
-
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
-
- try {
- tx.begin();
-
- Query<PCPoint> query = null;
- List<PCPoint> queryResult = null;
- Iterator<PCPoint> iterator = null;
- try (Query<PCPoint> query1 = pm.newQuery(PCPoint.class)) {
- query = query1;
- queryResult = query1.executeList();
- iterator = queryResult.iterator();
- if (!iterator.hasNext()) {
- fail(ASSERTION_FAILED, "(1) Iterator of open query result should have elements.");
- }
- } catch (Exception ex) {
- fail(ASSERTION_FAILED, "(2) Unexpected exception " + ex);
- }
-
- // check iterator retrieved in try-with-resource block
- if (iterator.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "(3) Iterator of closed query result should return false on hasNext().");
- }
- try {
- PCPoint next = iterator.next();
- fail(
- ASSERTION_FAILED,
- "(4) Iterator of closed query result should throw NoSuchElementException on next().");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
-
- // create new Iterator and check its behaviour
- Iterator<PCPoint> iterator2 = queryResult.iterator();
- if (iterator2.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "(5) Iterator of closed query result should return false on hasNext().");
- }
- try {
- PCPoint next = iterator2.next();
- fail(
- ASSERTION_FAILED,
- "(6) Iterator of closed query result should throw NoSuchElementException on next().");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
-
- // check query result itself
- try {
- int size = queryResult.size();
- fail(ASSERTION_FAILED, "(7) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
- try {
- PCPoint elem = queryResult.get(0);
- fail(ASSERTION_FAILED, "(8) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
- try {
- boolean empty = queryResult.isEmpty();
- fail(ASSERTION_FAILED, "(9) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
- // Check query instance is still usable
- queryResult = query.executeList();
- if (queryResult.isEmpty()) {
- fail(
- ASSERTION_FAILED,
- "(10) query instance should be usable and execution should return a non empty result.");
- }
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /**
- * This methods creates a query instance with try-with-resources and checks that an iterator for
- * 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 = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = null;
- List<PCPoint> queryResult = null;
- Iterator<PCPoint> iterator = null;
- try (Query<PCPoint> query1 = pm.newQuery(PCPoint.class)) {
- query = query1;
- queryResult = query1.executeList();
- iterator = queryResult.iterator();
- if (!iterator.hasNext()) {
- fail(ASSERTION_FAILED, "(1) Iterator of open query result should have elements.");
- }
- throw new DummyException();
- } catch (DummyException ex) {
- // expected exception
- } catch (Exception ex) {
- fail(ASSERTION_FAILED, "(2) Unexpected exception " + ex);
- }
-
- // check iterator retrieved in try-with-resource block
- if (iterator.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "(3) Iterator of closed query result should return false on hasNext().");
- }
- try {
- PCPoint next = iterator.next();
- fail(
- ASSERTION_FAILED,
- "(4) Iterator of closed query result should throw NoSuchElementException on next().");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
-
- // create new Iterator and check its behaviour
- Iterator<PCPoint> iterator2 = queryResult.iterator();
- if (iterator2.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "(5) Iterator of closed query result should return false on hasNext().");
- }
- try {
- PCPoint next = iterator2.next();
- fail(
- ASSERTION_FAILED,
- "(6) Iterator of closed query result should throw NoSuchElementException on next().");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
-
- // check query result itself
- try {
- int size = queryResult.size();
- fail(ASSERTION_FAILED, "(7) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
- try {
- PCPoint elem = queryResult.get(0);
- fail(ASSERTION_FAILED, "(8) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
- try {
- boolean empty = queryResult.isEmpty();
- fail(ASSERTION_FAILED, "(9) closed query result should not be accessible.");
- } catch (JDOUserException ex) {
- // expected exception when accessing closed query result
- }
-
- // Check query instance is still usable
- queryResult = query.executeList();
- if (queryResult.isEmpty()) {
- fail(
- ASSERTION_FAILED,
- "(10) query instance should be usable and execution should return a non empty result.");
- }
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-
- /** DummyException used in method testTryWithResourceThrowingException. */
- private static final class DummyException extends Exception {
- private static final long serialVersionUID = 1L;
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/Close.java b/tck/src/main/java/org/apache/jdo/tck/query/api/Close.java
deleted file mode 100644
index 22b5dd23..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/Close.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-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.Test;
-
-/**
- * <B>Title:</B> Close <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.7-1. <br>
- * <B>Assertion Description: </B> <code>Query.close(Object)</code> closes the result of one <code>
- * execute(...)</code> method, and releases resources associated with it. After this method
- * completes, the query result can no longer be used, for example to iterate the returned elements.
- * Any elements returned previously by iteration of the results remain in their current state. Any
- * iterators acquired from the queryResult will return <code>false</code> to <code>hasNext()</code>
- * and will throw <code>NoSuchElementException</code> to <code>next(</code>).
- */
-public class Close extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.7-1 (Close) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- if (debug) logger.debug("\nExecuting test Close()...");
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- List<PCPoint> results = query.executeList();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
-
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
-
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
-
- expected = getFromInserted(expected);
-
- // printOutput(results);
-
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug)
- logger.debug("Test Close: Results are as expected and accessible before query is closed");
-
- Iterator<PCPoint> resIterator = results.iterator();
- query.close(results);
-
- if (resIterator.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "Iterator.hasNext() should return false after closing the query result.");
- }
- try {
- resIterator.next();
- fail(
- ASSERTION_FAILED,
- "Iterator.hasNext() should throw NoSuchElementException after closing the query result.");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/CloseAll.java b/tck/src/main/java/org/apache/jdo/tck/query/api/CloseAll.java
deleted file mode 100644
index 3b7c21a6..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/CloseAll.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-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.Test;
-
-/**
- * <B>Title:</B> Close All <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.7-2. <br>
- * <B>Assertion Description: </B> <code>Query.closeAll()</code> closes all results of <code>
- * execute(...)</code> methods on this <code>Query</code> instance, as in A14.6.7-1. The <code>Query
- * </code> instance is still valid and can still be used.
- */
-public class CloseAll extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.7-2 (CloseAll) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- if (debug) logger.debug("\nExecuting test CloseAll()...");
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- List<PCPoint> results = query.executeList();
- Iterator<PCPoint> resIterator = results.iterator();
-
- query.closeAll();
-
- if (resIterator.hasNext()) {
- fail(
- ASSERTION_FAILED,
- "Iterator.hasNext() should return false after closing all query results.");
- }
-
- try {
- resIterator.next();
- fail(
- ASSERTION_FAILED,
- "Iterator.hasNext() should throw NoSuchElementException after closing all query results.");
- } catch (NoSuchElementException ex) {
- // expected exception
- }
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index d6b7abdb..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareImports.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-8. <br>
- * <B>Assertion Description: </B> <code>Query.declareImports(String imports)</code> binds the import
- * 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
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareImports01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareImports("import java.lang.Integer");
- query.declareParameters("Integer param");
- query.setFilter("y == param");
- Object results = query.execute(Integer.valueOf(2));
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "y == param", results, expected);
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareImports02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<Department> query = pm.newQuery(Department.class);
- query.setCandidates(pm.getExtent(Department.class, false));
- query.declareImports("import org.apache.jdo.tck.pc.company.Employee");
- query.declareVariables("Employee e");
- query.setFilter("employees.contains(e) && e.firstname==\"Michael\"");
- Object results = query.execute();
-
- // Just check whether query with import declaration compiles
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareImports03() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<Company> query = pm.newQuery(Company.class);
- query.setCandidates(pm.getExtent(Company.class, false));
- query.declareImports(
- "import org.apache.jdo.tck.pc.company.Employee; import org.apache.jdo.tck.pc.company.Department");
- query.declareVariables("Department d; Employee e");
- query.setFilter(
- "departments.contains(d) && (d.employees.contains(e) && e.firstname==\"Michael\")");
- Object results = query.execute();
-
- // Just check whether query with import declarations compiles
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index b548c447..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareParameters.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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> Declare Parameters <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-10. <br>
- * <B>Assertion Description: </B> <code>Query.declareParameters(String parameters)</code> binds the
- * 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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-10 (DeclareParameters) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareParameters01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param");
- query.setFilter("x == param");
- Object results = query.execute(Integer.valueOf(2));
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareParameters02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param1, Integer param2");
- query.setFilter("x == param1 && y == param2");
- Object results = query.execute(Integer.valueOf(2), Integer.valueOf(2));
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(
- ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareParameters03() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("int a, int b");
- query.setFilter("x == a && y == b");
- Object results = query.execute(Integer.valueOf(1), Integer.valueOf(1));
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(1));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == a && y == b", results, expected);
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 12fb5711..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/DeclareVariables.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.PersistenceManager;
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-9. <br>
- * <B>Assertion Description: </B> <code>Query.declareVariables(String variables)</code> binds the
- * unbound variable statements to the query instance. This method defines the types and names of
- * 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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-9 (DeclareVariables) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareVariables01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<Department> query = pm.newQuery(Department.class);
- query.setCandidates(pm.getExtent(Department.class, false));
- query.declareVariables("org.apache.jdo.tck.pc.company.Employee e");
- query.setFilter("employees.contains(e) && e.firstname==\"Michael\"");
- Object results = query.execute();
-
- // Just check whether query compiles
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDeclareVariables02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<Department> query = pm.newQuery(Department.class);
- query.setCandidates(pm.getExtent(Department.class, false));
- query.declareVariables(
- "org.apache.jdo.tck.pc.company.Employee e; org.apache.jdo.tck.pc.company.Project p;");
- query.setFilter("employees.contains(e) && (e.projects.contains(p) && p.projid == 1)");
- Object results = query.execute();
-
- // Just check whether query compiles
-
- tx.commit();
- } 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/api/ExecuteQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
deleted file mode 100644
index 74300c02..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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> Execute Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.1-3. <br>
- * <B>Assertion Description: </B> The <code>Query.execute</code> methods execute the query using the
- * parameters and return the result, which is a collection of instances that satisfy the boolean
- * 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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.1-3 (ExecuteQuery) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQuery01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.setFilter("x == 4");
- List<PCPoint> results = query.executeList();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(4));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 4", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQuery01 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQuery02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param");
- query.setFilter("x == param");
- query.setParameters(Integer.valueOf(2));
- List<PCPoint> results = query.executeList();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQuery02 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQuery03() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param1, Integer param2");
- query.setFilter("x == param1 && y == param2");
- query.setParameters(Integer.valueOf(2), Integer.valueOf(2));
- List<PCPoint> results = query.executeList();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(
- ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQuery03 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index b1ff125a..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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> Execute Query with Array <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.1-6. <br>
- * <B>Assertion Description: </B> The <code>executeWithArray</code> method is similar to the <code>
- * execute</code> method, but takes its parameters from an array instance. The array contains <code>
- * 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 {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6.1-6 (ExecuteQueryWithArray) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQueryWithArray01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
-
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param");
- query.setFilter("x == param");
-
- Object[] actualParams = {Integer.valueOf(2)};
- Object results = query.executeWithArray(actualParams);
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
-
- tx.commit();
- if (debug) logger.debug("Test ExecuteQueryWithArray01 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQueryWithArray02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param1, Integer param2");
- query.setFilter("x == param1 && y == param2");
-
- Object[] actualParams = {Integer.valueOf(2), Integer.valueOf(2)};
- Object results = query.executeWithArray(actualParams);
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(
- ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQueryWithArray02 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index dba3e1ca..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-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> Execute Query with Map <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.1-5. <br>
- * <B>Assertion Description: </B> The <code>Query.executeWithMap</code> method is similar to the
- * <code>execute</code> method, but takes its parameters from a <code>Map</code> instance. The
- * <code>Map</code> contains key/value pairs, in which the key is the declared parameter name, and
- * 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 {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6.1-5 (ExecuteQueryWithMap) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQueryWithMap01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param");
- query.setFilter("x == param");
-
- Map<String, Object> actualParams = new HashMap<>();
- actualParams.put("param", Integer.valueOf(2));
- Object results = query.executeWithMap(actualParams);
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == param", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQueryWithMap01 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestExecuteQueryWithMap02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.declareParameters("Integer param1, Integer param2");
- query.setFilter("x == param1 && y == param2");
-
- Map<String, Object> actualParams = new HashMap<>();
- actualParams.put("param1", Integer.valueOf(2));
- actualParams.put("param2", Integer.valueOf(2));
- Object results = query.executeWithMap(actualParams);
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(getTransientPCPoint(2));
- printOutput(results, expected);
- checkQueryResultWithoutOrder(
- ASSERTION_FAILED, "x == param1 && y == param2", results, expected);
- tx.commit();
- if (debug) logger.debug("Test ExecuteQueryWithMap02 - Passed\n");
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 9cc6a73f..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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.Assertions;
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-21. <br>
- * <B>Assertion Description: </B> This method retrieves the fetch plan associated with the Query. It
- * always returns the identical instance for the same Query instance. Any change made to the fetch
- * plan affects subsequent query execution.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class GetFetchPlan extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-21 (FetchPan) failed: ";
-
- private static final String FETCH_GROUP_1 = "fetchGroup1";
- private static final String FETCH_GROUP_2 = "fetchGroup2";
-
- /** */
- 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() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- Query<PCClass> query = createQuery(pm);
- checkSameFetchPlanInstances(query);
- checkFetchGroup1(query);
- } finally {
- cleanupPM(pm);
- }
- }
-
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testFetchGroup2() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- Query<PCClass> query = createQuery(pm);
- checkFetchGroup2(query);
- checkFetchGroup1(query);
- } finally {
- cleanupPM(pm);
- }
- }
-
- private void checkSameFetchPlanInstances(Query<PCClass> query) {
- FetchPlan fetchPlan1 = query.getFetchPlan();
- FetchPlan fetchPlan2 = query.getFetchPlan();
- if (fetchPlan1 != fetchPlan2) {
- fail(
- ASSERTION_FAILED
- + "Calling getFetchPlan twice on the same "
- + "query instance results in two different fetch plan instances.");
- }
- }
-
- /**
- * Checks if the given query loads fields assigned to fetchGroup1
- *
- * @param query the query
- */
- @SuppressWarnings("unchecked")
- private void checkFetchGroup1(Query<PCClass> query) {
- FetchPlan fetchplan = query.getFetchPlan();
- Collection<String> fetchgroups = fetchplan.getGroups();
- Assertions.assertTrue(
- fetchgroups.contains(FETCH_GROUP_1) && !fetchgroups.contains(FETCH_GROUP_2),
- "FetchPlan should include fetchGroup1 and not fetchGroup2");
- }
-
- /**
- * Checks if the given query loads fields assigned to "fetchGroup1" plus fetch group
- * "fetchGroup2". For this purpose, the method temporarily adds fetch group "fetchGroup2" to the
- * fetch plan of the given query instance. That fetch group loads field number2. Finally, that
- * fetch group is removed from the fetch plan again.
- *
- * @param query the query
- */
- @SuppressWarnings("unchecked")
- private void checkFetchGroup2(Query<PCClass> query) {
- FetchPlan fetchplan = query.getFetchPlan();
- fetchplan.addGroup(FETCH_GROUP_2);
- Collection<String> fetchgroups = fetchplan.getGroups();
- try {
- Assertions.assertTrue(
- fetchgroups.contains(FETCH_GROUP_1) && fetchgroups.contains(FETCH_GROUP_2),
- "FetchPlan should include fetchGroup1 and fetchGroup2");
- } finally {
- query.getFetchPlan().removeGroup(FETCH_GROUP_2);
- }
- }
-}
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
deleted file mode 100644
index c9ce3ddb..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetIgnoreCache.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-13. <br>
- * <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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-13 (GetIgnoreCache) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestGetIgnoreCache01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
- Query<?> query = pm.newQuery();
-
- // the ignoreCache flag of PM must default to the PMF setting
- if (pm.getIgnoreCache() == pmf.getIgnoreCache()) {
- if (debug) logger.debug("PM ignoreCache defaults to the PMF setting.");
- } else {
- fail(ASSERTION_FAILED, "PM ignoreCache does NOT default to the PMF setting.");
- }
- // the ignoreCache flag of Query must default to the setting in PM
- if (query.getIgnoreCache() == pm.getIgnoreCache()) {
- if (debug) logger.debug("Query ignoreCache defaults to the PM setting.");
- } else {
- fail(ASSERTION_FAILED, "Query ignoreCache does NOT default to the PM setting.");
- }
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestGetIgnoreCache02() {
- PersistenceManager pm = getPMF().getPersistenceManager();
-
- boolean ignoreCacheDefault = pmf.getIgnoreCache();
- // set PM's ignoreCache to a different value
- pm.setIgnoreCache(!ignoreCacheDefault);
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
- Query<?> query = pm.newQuery();
-
- // Query.ignoreCache must be equal to the new value in PM
- if (query.getIgnoreCache() == !ignoreCacheDefault) {
- if (debug) logger.debug("Query ignoreCache flag is equal to new PM setting.");
- } else {
- fail(ASSERTION_FAILED, "Query ignoreCache flag is NOT equal to new PM setting.");
- }
-
- // change the Query's ignoreCache flag
- query.setIgnoreCache(ignoreCacheDefault);
- if (query.getIgnoreCache() == ignoreCacheDefault) {
- if (debug) logger.debug("Query ignoreCache flag successfully changed");
- } else {
- fail(ASSERTION_FAILED, "Could NOT change the Query's ignoreCache flag.");
- }
- tx.commit();
- } 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/api/GetPersistenceManager.java b/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java
deleted file mode 100644
index 6a7cd06b..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManager.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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> Get PersistenceManager <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-2. <br>
- * <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 {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6-2 (GetPersistenceManager) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestGetPersistenceManager01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.setOptimistic(false);
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- PersistenceManager pm1 = query.getPersistenceManager();
- if (pm.equals(pm1)) {
- if (debug) logger.debug("Pessimistic: GetPersistenceManager Test: Passed.");
- } else {
- fail(
- ASSERTION_FAILED,
- "Pessimistic: query.getPersistenceManager() returned different pm than the one it was created from.");
- }
-
- query.compile();
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestGetPersistenceManager02() {
- if (!isOptimisticSupported()) return;
-
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.setOptimistic(true);
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- PersistenceManager pm1 = query.getPersistenceManager();
- if (pm.equals(pm1)) {
- if (debug) logger.debug("Optimistic: GetPersistenceManager Test: Passed");
- } else {
- fail(
- ASSERTION_FAILED,
- "Optimistic: query.getPersistenceManager() returned different pm than the one it was created from.");
- }
-
- query.compile();
- tx.commit();
- } 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/api/GetPersistenceManagerFromRestoredSerializedQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManagerFromRestoredSerializedQuery.java
deleted file mode 100644
index 9248d6e0..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/GetPersistenceManagerFromRestoredSerializedQuery.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.mylib.PCPoint;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Get PersistenceManager From Restored Serialized Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-3. <br>
- * <B>Assertion Description: </B> If a <code>Query</code> instance has been restored from a
- * serialized form, <code>Query.getPersistenceManager()</code> returns <code>null</code>.
- */
-public class GetPersistenceManagerFromRestoredSerializedQuery extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6-3 (GetPersistenceManagerFromRestoredSerializedQuery) failed: ";
-
- /**
- * @throws Exception exception
- */
- @Test
- public void test() throws Exception {
- pm = getPM();
-
- // initDatabase(pm, PCPoint.class);
- runTestGetPersistenceManagerFromRestoredSerializedQuery(pm);
-
- pm.close();
- pm = null;
- }
-
- /** */
- void serializeQuery(PersistenceManager pm) throws IOException {
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.setFilter("x == 3");
- query.compile();
-
- ObjectOutputStream oos = null;
- try {
- if (debug) logger.debug("Attempting to serialize Query object.");
- oos = new ObjectOutputStream(new FileOutputStream(SERIALZED_QUERY));
- oos.writeObject(query);
- if (debug) logger.debug("Query object serialized.");
- } finally {
- if (oos != null) {
- try {
- oos.close();
- } catch (Exception ignored) {
- }
- }
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- void runTestGetPersistenceManagerFromRestoredSerializedQuery(PersistenceManager pm)
- throws IOException, ClassNotFoundException {
- if (debug)
- logger.debug("\nExecuting test GetPersistenceManagerFromRestoredSerializedQuery() ...");
-
- Query<PCPoint> restoredQuery = null;
- ObjectInputStream ois = null;
- PersistenceManager pm1 = null;
-
- serializeQuery(pm);
-
- try {
- if (debug) logger.debug("Attempting to de-serialize Query object.");
- ois = new ObjectInputStream(new FileInputStream(SERIALZED_QUERY));
- restoredQuery = (Query<PCPoint>) ois.readObject();
- if (restoredQuery == null) {
- fail(ASSERTION_FAILED, "Deserialzed query is null");
- }
- if (debug) logger.debug("Query object restored.");
- } finally {
- if (ois != null) {
- try {
- ois.close();
- } catch (Exception ignored) {
- }
- }
- }
-
- pm1 = restoredQuery.getPersistenceManager();
- if (pm1 == null) {
- if (debug) logger.debug("Test GetPersistenceManagerFromRestoredSerializedQuery(): Passed");
- } else {
- fail(ASSERTION_FAILED, "Deserialzed query instance should not have a pm associated");
- }
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/InvalidNamedQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/InvalidNamedQuery.java
deleted file mode 100644
index 3c780139..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/InvalidNamedQuery.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.JDOUserException;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Invalid Named Query. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-16. <br>
- * <B>Assertion Description: </B> Named queries must be compilable. Attempts to get a named query
- * that cannot be compiled result in JDOUserException.
- */
-public class InvalidNamedQuery extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.5-16 (InvalidNamedQuery) failed: ";
-
- /** */
- @Test
- public void testNegative() {
- try {
- getPM().newNamedQuery(Person.class, "invalidQuery");
- fail(
- ASSERTION_FAILED
- + "Lookup of named query 'invalidQuery' "
- + " succeeded, though the query is not compilable.");
- } catch (JDOUserException ignored) {
- }
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryNotFound.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryNotFound.java
deleted file mode 100644
index c3290f79..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryNotFound.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.JDOUserException;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Named Query not Found. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-14. <br>
- * <B>Assertion Description: </B> If the metadata is not found in the above, a JDOUserException is
- * thrown.
- */
-public class NamedQueryNotFound extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.5-14 (NamedQueryNotFound) failed: ";
-
- /** */
- @Test
- public void testNegative() {
- try {
- getPM().newNamedQuery(Person.class, "nonExistingNamedQuery");
- fail(
- ASSERTION_FAILED
- + "The lookup of named query 'nonExistingNamedQuery' "
- + "is successful, though that named query is undefined.");
- } catch (JDOUserException ignored) {
- }
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java
deleted file mode 100644
index dce68386..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NamedQueryRepeatableAnnotations.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.JDOUserException;
-import org.apache.jdo.tck.pc.query.NamedQueriesSample;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> NamedQueryRepeatableAnnotations <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> Unknown <br>
- * <B>Assertion Description: </B> We test use of @Query where multiple have been defined in a class,
- * so reliant on Java 8 @Repeatable.
- */
-public class NamedQueryRepeatableAnnotations extends QueryTest {
-
- private static final String ASSERTION_FAILED =
- "Assertion A19.?? (NamedQueryRepeatableAnnotations) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- try {
- getPM().newNamedQuery(NamedQueriesSample.class, "NameIsJohn");
- } catch (JDOUserException e) {
- fail(ASSERTION_FAILED + "Lookup of query failed but should have been found");
- }
- try {
- getPM().newNamedQuery(NamedQueriesSample.class, "NameIsFred");
- } catch (JDOUserException e) {
- fail(ASSERTION_FAILED + "Lookup of query failed but should have been found");
- }
- }
-}
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
deleted file mode 100644
index 0fb8d77b..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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;
-import org.apache.jdo.tck.query.QueryTest;
-import org.apache.jdo.tck.query.result.classes.FullName;
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-12. <br>
- * <B>Assertion Description: </B> Construct a new query instance with the given candidate class from
- * a named query.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class NewNamedQuery extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.5-12 (NewNamedQuery) failed: ";
-
- /** 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")
- };
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testPositive0() {
- int index = 0;
- executeNamedQuery(Person.class, "validNotUnique", expectedResult[index], true);
- }
-
- /** */
- @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) {
- 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
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java
deleted file mode 100644
index 89e5b0c3..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query From Existing Query Bound to PersistenceManag er From Same Vendor <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-3. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Object query)</code> constructs
- * a <code>Query</code> instance from another query, where the parameter is currently bound to a
- * <code>PersistenceManager</code> from the same JDO vendor. Any of the elements Class, Filter,
- * Import declarations, Variable declarations, Parameter declarations, and Ordering from the
- * parameter <code>Query</code> are copied to the new <code>Query</code> instance, but a candidate
- * <code>Collection</code> or <code>Extent</code> element is discarded.
- */
-public class NewQueryFromExistingQueryBoundToPMFromSameVendor extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-3 (NewQueryFromExistingQueryBoundToPMFromSameVendor) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
-
- runTestNewQueryFromExistingQueryBoundToPMFromSameVendor01(pm);
- runTestNewQueryFromExistingQueryBoundToPMFromSameVendor02(pm);
- }
-
- /** */
- @SuppressWarnings("unchecked")
- void runTestNewQueryFromExistingQueryBoundToPMFromSameVendor01(PersistenceManager pm) {
- if (debug)
- logger.debug("\nExecuting test NewQueryFromExistingQueryBoundToPMFromSameVendor01()...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
-
- Query<PCPoint> query1 = pm.newQuery(query);
- query1.compile();
-
- Object results = query1.execute();
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug)
- logger.debug("Test NewQueryFromExistingQueryBoundToPMFromSameVendor01() - Passed\n");
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- void runTestNewQueryFromExistingQueryBoundToPMFromSameVendor02(PersistenceManager pm) {
- if (debug)
- logger.debug("\nExecuting test NewQueryFromExistingQueryBoundToPMFromSameVendor02()...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- Query<PCPoint> query1 = pm.newQuery(query);
- query1.setCandidates(pm.getExtent(PCPoint.class, true));
- query1.compile();
-
- Object results = query1.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug)
- logger.debug("Test NewQueryFromExistingQueryBoundToPMFromSameVendor02() - Passed\n");
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java
deleted file mode 100644
index 63afb518..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query From Existing Serialized Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-2. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Object query)</code> constructs
- * a <code>Query</code> instance from another query, where the parameter is a serialized/re-stored
- * <code>Query</code> instance from the same JDO vendor but a different execution environment. Any
- * of the elements Class, Filter, Import declarations, Variable declarations, Parameter
- * declarations, and Ordering from the parameter <code>Query</code> are copied to the new <code>
- * Query</code> instance, but a candidate <code>Collection</code> or <code>Extent</code> element is
- * discarded.
- */
-public class NewQueryFromRestoredSerializedQuery extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-2 (NewQueryFromRestoredSerializedQuery) failed: ";
-
- /**
- * @throws Exception exception
- */
- @SuppressWarnings("unchecked")
- @Test
- public void testPositive() throws IOException, ClassNotFoundException {
- PersistenceManager pm = getPM();
- if (debug) logger.debug("\nExecuting test NewQueryFromRestoredSerializedQuery01() ...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.setFilter("x == 3");
- query.compile();
-
- ObjectOutputStream oos = null;
- try {
- if (debug) logger.debug("Attempting to serialize Query object.");
- oos = new ObjectOutputStream(new FileOutputStream(SERIALZED_QUERY));
- oos.writeObject(query);
- if (debug) logger.debug("Query object serialized.");
- } finally {
- if (oos != null) {
- try {
- oos.flush();
- } catch (Exception ignored) {
- }
- try {
- oos.close();
- } catch (Exception ignored) {
- }
- }
- }
-
- ObjectInputStream in = new ObjectInputStream(new FileInputStream(SERIALZED_QUERY));
- Query<PCPoint> query1 = (Query<PCPoint>) in.readObject();
-
- // init and execute query
- query = pm.newQuery(query1);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p4 = new PCPoint(3, 3);
- expected.add(p4);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 3", results, expected);
- if (debug) logger.debug("Test NewQueryFromRestoredSerializedQuery01(): Passed");
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index c29392d6..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Employee;
-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.Test;
-
-/**
- * <B>Title:</B> Single String Query. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-11. <br>
- * <B>Assertion Description: </B> Construct a new query instance using the specified String as the
- * single-string representation of the query.
- */
-public class NewQuerySingleString extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-11 (NewQuerySingleString) failed: ";
-
- /**
- * The array of valid queries which may be executed as single string queries and as API queries.
- */
- private static final QueryElementHolder<?>[] VALID_QUERIES = {
- 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*/ null,
- /*TO*/ null)
- };
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3", "emp4", "emp5")
- };
-
- /** */
- @Test
- public void testPositive() {
- for (int i = 0; i < VALID_QUERIES.length; i++) {
- executeSingleStringQuery(ASSERTION_FAILED, pm, VALID_QUERIES[i], expectedResult[i]);
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index 2374f8d4..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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.Test;
-
-/**
- * <B>Title:</B> New Query with Candidate Class <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-5. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls)</code> constructs a
- * query instance with the candidate class specified.
- */
-public class NewQueryWithCandidateClass extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-5 (NewQueryWithCandidateClass) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- Object results = query.execute();
-
- // check query result
- printOutput(results, persistentPCPoints);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 97038faf..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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.Test;
-
-/**
- * <B>Title:</B> New Query with Candidate Class and Collection <br>
- * <B>Keywords:</B> query extent <br>
- * <B>Assertion ID:</B> A14.5-7. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, Collection cln)
- * </code> constructs a query instance with the candidate class and candidate <code>Collection
- * </code> specified.
- */
-public class NewQueryWithCandidateClassAndCollection extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-7 (NewQueryWithCandidateClassAndCollection) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class, persistentPCPoints);
- Object results = query.execute();
-
- // check query result
- printOutput(results, persistentPCPoints);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 29efd3dd..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.Extent;
-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.Test;
-
-/**
- * <B>Title:</B> New Query with Candidate Class and Extent <br>
- * <B>Keywords:</B> query extent <br>
- * <B>Assertion ID:</B> A14.5-6. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, Extent cln)</code>
- * constructs a query instance with the candidate class and candidate <code>Extent</code> specified.
- */
-public class NewQueryWithCandidateClassAndExtent extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-6 (NewQueryWithCandidateClassAndExtent) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- Extent<PCPoint> extent = pm.getExtent(PCPoint.class, true);
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(extent);
- Object results = query.execute();
-
- // check query result
- printOutput(results, persistentPCPoints);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java
deleted file mode 100644
index 9532dd3c..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query with Candidate Class and Filter <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-8. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, String filter)</code>
- * constructs a query instance with the candidate class and filter specified.
- */
-public class NewQueryWithCandidateClassAndFilter extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-8 (NewQueryWithCandidateClassAndFilter) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class, "x == 1");
- query.setClass(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint pcp1 = new PCPoint(1, 1);
- expected.add(pcp1);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 1", results, expected);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 8feb60ac..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query with Candidate Class, Collection, and Filter <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-9. <br>
- * <B>Assertion Description: </B> <code>
- * PersistenceManager.newQuery(Class cls, Collection cln, String filter)</code> constructs a query
- * instance with the candidate class, the candidate <code>Collection</code>, and filter specified.
- */
-public class NewQueryWithCandidateClassCollectionFilter extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-9 (NewQueryWithCandidateClassCollectionFilter) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class, persistentPCPoints, "x ==2");
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint pc1 = new PCPoint(2, 2);
- expected.add(pc1);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x ==2", results, expected);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index bf11cb18..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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.Test;
-
-/**
- * <B>Title:</B> New Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion IDs:</B> A14.5-1. <br>
- * <B>Assertion Description: </B> PersistenceManagerFactory.newQuery() constructs and empty Query
- * instance.
- */
-public class NewQueryWithExtent extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.5-1 (NewQueryWithExtent) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(pm.getExtent(PCPoint.class, false));
- query.setClass(PCPoint.class);
- Object results = query.execute();
-
- // check query result
- printOutput(results, persistentPCPoints);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, persistentPCPoints);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java
deleted file mode 100644
index e4b6983b..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion IDs:</B> A14.5-10. <br>
- * <B>Assertion Description: </B> Construct a new query instance with the candidate Extent and
- * filter specified; the candidate class is taken from the Extent.
- */
-public class NewQueryWithExtentAndFilter extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-1 (NewQueryWithExtentAndFilter) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- tx.begin();
- try {
- Query<PCPoint> query = pm.newQuery(pm.getExtent(PCPoint.class, false), "x == 1");
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint pcp1 = new PCPoint(1, 1);
- expected.add(pcp1);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 1", results, expected);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java b/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java
deleted file mode 100644
index dc6f2cca..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> New Query With Specified Language and Query <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.5-4. <br>
- * <B>Assertion Description: </B> <code>PersistenceManager.newQuery(String language, Object query)
- * </code> constructs a query instance using the specified language and the specified query . The
- * query instance returned will be of a class defined by the query language. The language parameter
- * for the JDO Query language as herein documented is "javax.jdo.query.JDOQL".
- */
-public class NewQueryWithSpecifiedLanguageAndQuery extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.5-4 (NewQueryWithSpecifiedLanguageAndQuery) failed: ";
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- if (debug) logger.debug("\nExecuting test NewQueryWithSpecifiedLanguageAndQuery()...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- Query<PCPoint> query1 = pm.newQuery("javax.jdo.query.JDOQL", query);
- query1.setCandidates(pm.getExtent(PCPoint.class, false));
- query1.compile();
- Object results = query1.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug) logger.debug("Test NewQueryWithSpecifiedLanguageAndQuery() - Passed\n");
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index 2e472855..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> Set Candidate Collection <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-5. <br>
- * <B>Assertion Description: </B> <code>Query.setCandidates(Collection
- * candidateCollection)</code> binds the candidate <code>Collection</code> to the query instance.
- */
-public class SetCandidateCollection extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6-5 (SetCandidateCollection) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- if (debug) logger.debug("\nExecuting test SetCandidateCollection()...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(persistentPCPoints);
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug) logger.debug("Test SetCandidateCollection: Passed");
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java
deleted file mode 100644
index 0a5acf38..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Test;
-
-/**
- * <B>Title:</B> Set Candidate Extent <br>
- * <B>Keywords:</B> query extent <br>
- * <B>Assertion ID:</B> A14.6-6. <br>
- * <B>Assertion Description: </B> <code>Query.setCandidates(Extent
- * candidateExtent)</code> binds the candidate <code>Extent</code> to the query instance.
- */
-public class SetCandidateExtent extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-6 (SetCandidateExtent) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- if (debug) logger.debug("\nExecuting test SetCandidateExtent()...");
-
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- PCPoint p1 = new PCPoint(0, 0);
- PCPoint p2 = new PCPoint(1, 1);
- PCPoint p3 = new PCPoint(2, 2);
- PCPoint p4 = new PCPoint(3, 3);
- PCPoint p5 = new PCPoint(4, 4);
- expected.add(p1);
- expected.add(p2);
- expected.add(p3);
- expected.add(p4);
- expected.add(p5);
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
- if (debug) logger.debug("Test SetCandidateExtent: Passed");
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SetFilter.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetFilter.java
deleted file mode 100644
index f9cf44b6..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetFilter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.jdo.Extent;
-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.Test;
-
-/**
- * <B>Title:</B> Set Filter <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-7. <br>
- * <B>Assertion Description: </B> <code>Query.setFilter(String filter)</code> binds the query filter
- * to the query instance.
- */
-public class SetFilter extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-7 (SetFilter) failed: ";
-
- /** */
- @Test
- public void testPositive() {
- PersistenceManager pm = getPM();
- Transaction tx = pm.currentTransaction();
- Class<PCPoint> clazz = PCPoint.class;
- try {
- Extent<PCPoint> extent = pm.getExtent(clazz, true);
- tx.begin();
- Query<PCPoint> query = pm.newQuery(clazz);
- query.setClass(clazz);
- query.setCandidates(extent);
- query.setFilter("x == 2");
- Object results = query.execute();
-
- // check query result
- List<PCPoint> expected = new ArrayList<>();
- expected.add(new PCPoint(2, 2));
- expected = getFromInserted(expected);
- printOutput(results, expected);
- checkQueryResultWithoutOrder(ASSERTION_FAILED, "x == 2", results, expected);
-
- tx.commit();
- tx = null;
- } finally {
- if ((tx != null) && tx.isActive()) tx.rollback();
- }
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index d256d36a..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetGrouping.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.Arrays;
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Set Grouping. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-17. <br>
- * <B>Assertion Description: </B> void setGrouping (String grouping); Specify the grouping of
- * results for aggregates.
- */
-public class SetGrouping extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-17 (SetGrouping) failed: ";
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- Arrays.asList("emp1Last", "emp2Last", "emp3Last", "emp4Last", "emp5Last")
- };
-
- /** */
- @Test
- public void testPositive() {
- int index = 0;
- Query<Person> query = getPM().newQuery(Person.class);
- query.setResult("lastname");
- query.setGrouping("lastname");
- String singleStringQuery = "SELECT lastname FROM Person GROUP BY lastname";
- executeJDOQuery(
- ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index 94b5adbc..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetIgnoreCache.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-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 IgnoreCache <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-12. <br>
- * <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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-12 (SetIgnoreCache) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestSetIgnoreCache01() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- tx.setOptimistic(false);
- try {
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- if (debug) logger.debug("Pessimistic: IgnoreCache - Setting value = true");
- query.setIgnoreCache(true);
- if (query.getIgnoreCache()) {
- if (debug) logger.debug("Pessimistic: IgnoreCache - value = " + query.getIgnoreCache());
- } else {
- fail(
- ASSERTION_FAILED,
- "query.getIgnoreCache() returns false after setting the flag to true");
- }
-
- if (debug) logger.debug("Pessimistic: IgnoreCache - Setting value = false");
- query.setIgnoreCache(false);
- if (!query.getIgnoreCache()) {
- if (debug) logger.debug("Pessimistic: IgnoreCache - value = " + query.getIgnoreCache());
- } else {
- fail(
- ASSERTION_FAILED,
- "query.getIgnoreCache() returns true after setting the flag to false");
- }
- query.compile();
-
- tx.commit();
- } finally {
- cleanupPM(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);
- tx.begin();
-
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
-
- if (debug) logger.debug("Optimistic: IgnoreCache - Setting value = true");
- query.setIgnoreCache(true);
- if (query.getIgnoreCache()) {
- if (debug) logger.debug("Optimistic: IgnoreCache - value = " + query.getIgnoreCache());
- } else {
- fail(
- ASSERTION_FAILED,
- "query.getIgnoreCache() returns false after setting the flag to true");
- }
-
- if (debug) logger.debug("Optimistic: IgnoreCache - Setting value = false");
- query.setIgnoreCache(false);
- if (!query.getIgnoreCache()) {
- if (debug) logger.debug("Optimistic: IgnoreCache - value = " + query.getIgnoreCache());
- } else {
- fail(
- ASSERTION_FAILED,
- "query.getIgnoreCache() returns true after setting the flag to false");
- }
-
- query.compile();
-
- tx.commit();
- } 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/api/SetOrdering.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java
deleted file mode 100644
index 3dbfd734..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetOrdering.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-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>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-11. <br>
- * <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 {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-11 (SetOrdering) failed: ";
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestAscending() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- // ascending
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.setOrdering("x ascending");
- Object results = query.execute();
-
- // check result
- printOutput(results, transientPCPoints);
- checkQueryResultWithOrder(ASSERTION_FAILED, results, transientPCPoints);
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void runTestDescending() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- Transaction tx = pm.currentTransaction();
- try {
- tx.begin();
-
- // descending
- Query<PCPoint> query = pm.newQuery(PCPoint.class);
- query.setCandidates(pm.getExtent(PCPoint.class, false));
- query.setOrdering("x descending");
- Object results = query.execute();
-
- // check result
- List<PCPoint> expected = new ArrayList<>(transientPCPoints);
- Collections.reverse(expected);
- printOutput(results, expected);
- checkQueryResultWithOrder(ASSERTION_FAILED, results, expected);
-
- tx.commit();
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(PCPoint.class);
- loadAndPersistPCPoints(getPM());
- }
-}
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
deleted file mode 100644
index c1960846..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetRange.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Employee;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Set Range. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-20. <br>
- * <B>Assertion Description: </B> setRange(int fromIncl, int toExcl); Specify the number of
- * instances to skip over and the maximum number of result instances to return.
- */
-public class SetRange extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-20 (SetRange) failed: ";
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3", "emp4", "emp5")
- };
-
- /** */
- @Test
- public void testPositive() {
- int index = 0;
- Query<Person> query = getPM().newQuery(Person.class);
- query.setRange(0, 5);
- String singleStringQuery = "SELECT FROM Person RANGE 0, 5";
- executeJDOQuery(
- ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index f04a8bdd..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResult.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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;
-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 Result. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-16. <br>
- * <B>Assertion Description: </B> void setResult (String result); Specify the results of the query
- * if not instances of the candidate class.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class SetResult extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-16 (SetResult) failed: ";
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- Arrays.asList("emp1Last", "emp2Last", "emp3Last", "emp4Last", "emp5Last")
- };
-
- /** */
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testPositive() {
- int index = 0;
- 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() {
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- 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
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index 8c135761..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetResultClass.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import java.util.Arrays;
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.apache.jdo.tck.query.result.classes.FullName;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Set Result Class. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-19. <br>
- * <B>Assertion Description: </B> void setResultClass (Class resultClass); Specify the class to be
- * used to return result instances.
- */
-public class SetResultClass extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-19 (SetResultClass) failed: ";
-
- /** 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")
- })
- };
-
- /** */
- @Test
- public void testPositive() {
- int index = 0;
- Query<Person> query = getPM().newQuery(Person.class);
- query.setResultClass(FullName.class);
- query.setResult("firstname, lastname");
- String singleStringQuery = "SELECT firstname, lastname INTO FullName FROM Person";
- executeJDOQuery(
- ASSERTION_FAILED, pm, query, singleStringQuery, false, null, expectedResult[index], true);
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index 6dda89a7..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetUnique.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Employee;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Set Unique. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6-18. <br>
- * <B>Assertion Description: </B> void setUnique (boolean unique); Specify that there is a single
- * result of the query.
- */
-public class SetUnique extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6-18 (SetUnique) failed: ";
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- getTransientCompanyModelInstance(Employee.class, "emp1"),
- getTransientCompanyModelInstancesAsList(Employee.class, "emp1", "emp2", "emp3", "emp4", "emp5")
- };
-
- /** */
- @Test
- public void testPositive() {
- int index = 0;
- Query<Person> query = getPM().newQuery(Person.class);
- query.setUnique(true);
- query.setFilter("lastname == 'emp1Last'");
- String singleStringQuery = "SELECT FROM Person WHERE lastname == 'emp1Last'";
- executeJDOQuery(
- 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, pm, query, singleStringQuery, false, null, expectedResult[index], true);
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
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
deleted file mode 100644
index 8c772f3a..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.api;
-
-import javax.jdo.Query;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Department;
-import org.apache.jdo.tck.pc.company.Employee;
-import org.apache.jdo.tck.query.QueryElementHolder;
-import org.apache.jdo.tck.query.QueryTest;
-import org.junit.jupiter.api.Test;
-
-/**
- * <B>Title:</B> Setter replace previous values. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.15. <br>
- * <B>Assertion Description: </B> All of these methods replace the previously set query element, by
- * the parameter. [The methods are not additive].
- */
-public class SetterReplacePreviousValues extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED =
- "Assertion A14.6.15 (SetterReplacePreviousValues) failed: ";
-
- /**
- * The array of valid queries which may be executed as single string queries and as API queries.
- */
- private static final QueryElementHolder<?>[] VALID_QUERIES = {
- // replace parameter declaration
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "deptid == param",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ "String x",
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null),
- // replace filter setting
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "personid == 1L",
- /*VARIABLES*/ null,
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null),
- // replace variable declaration
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ null,
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && e.personid == 1",
- /*VARIABLES*/ "Employee e1; Employee e2",
- /*PARAMETERS*/ null,
- /*IMPORTS*/ null,
- /*GROUP BY*/ null,
- /*ORDER BY*/ null,
- /*FROM*/ null,
- /*TO*/ null)
- };
-
- /** The expected results of valid queries. */
- private final Object[] expectedResult = {
- // replace parameter declaration
- getTransientCompanyModelInstancesAsList(Department.class, "dept1"),
- // replace filter setting
- getTransientCompanyModelInstancesAsList(Employee.class, "emp2"),
- // replace variable declaration
- getTransientCompanyModelInstancesAsList(Department.class, "dept1")
- };
-
- /** */
- @Test
- public void testPositive() {
- // replace parameter declaration
- int index = 0;
- Query<?> query = VALID_QUERIES[index].getAPIQuery(getPM());
- query.declareParameters("long param");
- Object[] parameters = new Object[] {Long.valueOf(1)};
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- parameters,
- expectedResult[index],
- true);
- query = VALID_QUERIES[index].getSingleStringQuery(getPM());
- query.declareParameters("long param");
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- parameters,
- expectedResult[index],
- true);
-
- // replace filter setting
- index++;
- query = VALID_QUERIES[index].getAPIQuery(getPM());
- query.setFilter("personid == 2L");
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- null,
- expectedResult[index],
- true);
- query = VALID_QUERIES[index].getSingleStringQuery(getPM());
- query.setFilter("personid == 2L");
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- null,
- expectedResult[index],
- true);
-
- // replace variable declaration
- index++;
- query = VALID_QUERIES[index].getAPIQuery(getPM());
- query.declareVariables("Employee e");
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- null,
- expectedResult[index],
- true);
- query = VALID_QUERIES[index].getSingleStringQuery(getPM());
- query.declareVariables("Employee e");
- executeJDOQuery(
- ASSERTION_FAILED,
- pm,
- query,
- VALID_QUERIES[index].toString(),
- false,
- null,
- expectedResult[index],
- true);
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResult.java b/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResult.java
deleted file mode 100644
index 27f04438..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResult.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.result;
-
-import java.util.Arrays;
-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;
-import org.apache.jdo.tck.pc.company.QDepartment;
-import org.apache.jdo.tck.pc.company.QEmployee;
-import org.apache.jdo.tck.pc.company.QProject;
-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> Variable in Result. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.9-3. <br>
- * <B>Assertion Description: </B> If a variable or a field of a variable is included in the result,
- * either directly or via navigation through the variable, then the semantics of the contains clause
- * that include the variable change. In this case, all values of the variable that satisfy the
- * filter are included in the result. Result expressions begin with either an instance of the
- * candidate class (with an explicit or implicit "this") or an instance of a variable (using the
- * variable name). The candidate tuples are the cartesian product of the candidate class and all
- * variables used in the result. The result tuples are the tuples of the candidate class and all
- * variables used in the result that satisfy the filter. The result is the collection of result
- * expressions projected from the result tuples.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class VariableInResult extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.9-3 (VariableInResult) failed: ";
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testDistinctNoNavigation() {
- List<Employee> expected =
- getTransientCompanyModelInstancesAsList(
- Employee.class, "emp1", "emp2", "emp3", "emp4", "emp5");
- 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));
- query.result(true, e);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "distinct e",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e)",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testDistinctNavigation() {
- Object elem = new Object[] {Long.valueOf(1), "orange"};
- Object expected = Arrays.asList(elem);
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- QProject p = QProject.variable("p");
- query.filter(cand.projects.contains(p).and(p.name.eq("orange")));
- query.result(true, p.projid, p.name);
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "distinct p.projid, p.name",
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "projects.contains(p) & p.name == 'orange'",
- /*VARIABLES*/ "Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigation() {
- Object expected =
- Arrays.asList(
- new Object[] {Long.valueOf(1), "orange"},
- new Object[] {Long.valueOf(1), "orange"},
- new Object[] {Long.valueOf(1), "orange"});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Employee> query = pm.newJDOQLTypedQuery(Employee.class);
- QEmployee cand = QEmployee.candidate();
- QProject p = QProject.variable("p");
- query.filter(cand.projects.contains(p).and(p.name.eq("orange")));
- query.result(false, p.projid, p.name);
-
- QueryElementHolder<Employee> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "p.projid, p.name",
- /*INTO*/ null,
- /*FROM*/ Employee.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "projects.contains(p) & p.name == 'orange'",
- /*VARIABLES*/ "Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNoNavigation() {
- List<Employee> expected =
- getTransientCompanyModelInstancesAsList(
- Employee.class, "emp1", "emp2", "emp3", "emp4", "emp5");
- 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));
- query.result(false, e);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e)",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testMultipleProjectionWithConstraints() {
- List<Employee> expected =
- getTransientCompanyModelInstancesAsList(Employee.class, "emp4", "emp5");
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- query.filter(cand.deptid.eq(2l).and(cand.employees.contains(e)));
- query.result(false, e);
-
- // SELECT e FROM Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "deptid == 2 & employees.contains(e)",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java b/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java
deleted file mode 100644
index de166738..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.result;
-
-import java.util.Arrays;
-import javax.jdo.JDOQLTypedQuery;
-import javax.jdo.PersistenceManager;
-import org.apache.jdo.tck.pc.company.Company;
-import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Department;
-import org.apache.jdo.tck.pc.company.Employee;
-import org.apache.jdo.tck.pc.company.Project;
-import org.apache.jdo.tck.pc.company.QCompany;
-import org.apache.jdo.tck.pc.company.QDepartment;
-import org.apache.jdo.tck.pc.company.QEmployee;
-import org.apache.jdo.tck.pc.company.QProject;
-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> Variable in Result. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.9-3. <br>
- * <B>Assertion Description: </B> If a variable or a field of a variable is included in the result,
- * either directly or via navigation through the variable, then the semantics of the contains clause
- * that include the variable change. In this case, all values of the variable that satisfy the
- * filter are included in the result. Result expressions begin with either an instance of the
- * candidate class (with an explicit or implicit "this") or an instance of a variable (using the
- * variable name). The candidate tuples are the cartesian product of the candidate class and all
- * variables used in the result. The result tuples are the tuples of the candidate class and all
- * variables used in the result that satisfy the filter. The result is the collection of result
- * expressions projected from the result tuples.
- *
- * <p>This test differs from VariableInResult by extending the navigation of variables. It navigates
- * from the candidate Department class to include fields in the corresponding Company. It navigates
- * from the candidate Company class to Department, Employee, and Project.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class VariableInResultMultipleNavigation extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.9-3 (VariableInResult) failed: ";
-
- /** The expected results of valid queries. */
- private final Object company1 = getTransientCompanyModelInstance(Company.class, "company1");
-
- private final Object emp1 = getTransientCompanyModelInstance(Employee.class, "emp1");
- private final Object emp2 = getTransientCompanyModelInstance(Employee.class, "emp2");
- private final Object emp3 = getTransientCompanyModelInstance(Employee.class, "emp3");
- private final Object emp4 = getTransientCompanyModelInstance(Employee.class, "emp4");
- private final Object emp5 = getTransientCompanyModelInstance(Employee.class, "emp5");
- private final Object proj1 = getTransientCompanyModelInstance(Project.class, "proj1");
- private final Object proj2 = getTransientCompanyModelInstance(Project.class, "proj2");
- private final Object proj3 = getTransientCompanyModelInstance(Project.class, "proj3");
- private final Object dept1 = getTransientCompanyModelInstance(Department.class, "dept1");
- private final Object dept2 = getTransientCompanyModelInstance(Department.class, "dept2");
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() {
- Object expected =
- Arrays.asList(
- new Object[] {company1, dept1, emp1, proj1},
- new Object[] {company1, dept1, emp2, proj1},
- new Object[] {company1, dept1, emp3, proj1},
- new Object[] {company1, dept1, emp2, proj2},
- new Object[] {company1, dept1, emp3, proj2},
- new Object[] {company1, dept2, emp4, proj3},
- new Object[] {company1, dept2, emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Company> query = pm.newJDOQLTypedQuery(Company.class);
- QCompany cand = QCompany.candidate();
- QDepartment d = QDepartment.variable("d");
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(
- cand.name
- .eq("Sun Microsystems, Inc.")
- .and(cand.departments.contains(d))
- .and(d.employees.contains(e))
- .and(e.projects.contains(p)));
- query.result(false, cand, d, e, p);
-
- QueryElementHolder<Company> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "this, d, e, p",
- /*INTO*/ null,
- /*FROM*/ Company.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "name == \"Sun Microsystems, Inc.\" && "
- + "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Department d; Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithCompanyAndEmployeeAndProject() {
- Object expected =
- Arrays.asList(
- new Object[] {company1, emp1, proj1},
- new Object[] {company1, emp2, proj1},
- new Object[] {company1, emp3, proj1},
- new Object[] {company1, emp2, proj2},
- new Object[] {company1, emp3, proj2},
- new Object[] {company1, emp4, proj3},
- new Object[] {company1, emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Company> query = pm.newJDOQLTypedQuery(Company.class);
- QCompany cand = QCompany.candidate();
- QDepartment d = QDepartment.variable("d");
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(
- cand.name
- .eq("Sun Microsystems, Inc.")
- .and(cand.departments.contains(d))
- .and(d.employees.contains(e))
- .and(e.projects.contains(p)));
- query.result(false, cand, e, p);
-
- QueryElementHolder<Company> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "this, e, p",
- /*INTO*/ null,
- /*FROM*/ Company.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "name == \"Sun Microsystems, Inc.\" && "
- + "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Department d; Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithDepartmentAndEmployeeAndProject() {
- Object expected =
- Arrays.asList(
- new Object[] {dept1, emp1, proj1},
- new Object[] {dept1, emp2, proj1},
- new Object[] {dept1, emp3, proj1},
- new Object[] {dept1, emp2, proj2},
- new Object[] {dept1, emp3, proj2},
- new Object[] {dept2, emp4, proj3},
- new Object[] {dept2, emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Company> query = pm.newJDOQLTypedQuery(Company.class);
- QCompany cand = QCompany.candidate();
- QDepartment d = QDepartment.variable("d");
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(
- cand.name
- .eq("Sun Microsystems, Inc.")
- .and(cand.departments.contains(d))
- .and(d.employees.contains(e))
- .and(e.projects.contains(p)));
- query.result(false, d, e, p);
-
- QueryElementHolder<Company> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "d, e, p",
- /*INTO*/ null,
- /*FROM*/ Company.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "name == \"Sun Microsystems, Inc.\" && "
- + "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Department d; Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java b/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java
deleted file mode 100644
index 4e1f2aaf..00000000
--- a/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jdo.tck.query.result;
-
-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;
-import org.apache.jdo.tck.pc.company.Project;
-import org.apache.jdo.tck.pc.company.QDepartment;
-import org.apache.jdo.tck.pc.company.QEmployee;
-import org.apache.jdo.tck.pc.company.QProject;
-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> Variable in Result. <br>
- * <B>Keywords:</B> query <br>
- * <B>Assertion ID:</B> A14.6.9-3. <br>
- * <B>Assertion Description: </B> If a variable or a field of a variable is included in the result,
- * either directly or via navigation through the variable, then the semantics of the contains clause
- * that include the variable change. In this case, all values of the variable that satisfy the
- * filter are included in the result. Result expressions begin with either an instance of the
- * candidate class (with an explicit or implicit "this") or an instance of a variable (using the
- * variable name). The candidate tuples are the cartesian product of the candidate class and all
- * variables used in the result. The result tuples are the tuples of the candidate class and all
- * variables used in the result that satisfy the filter. The result is the collection of result
- * expressions projected from the result tuples.
- *
- * <p>This test differs from VariableInResult by extending the navigation of variables. It navigates
- * from the candidate Department class to include fields in the corresponding Company. It navigates
- * from the candidate Company class to Department, Employee, and Project.
- */
-@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class VariableInResultNavigation extends QueryTest {
-
- /** */
- private static final String ASSERTION_FAILED = "Assertion A14.6.9-3 (VariableInResult) failed: ";
-
- /** The expected results of valid queries. */
- private final Object emp1 = getTransientCompanyModelInstance(Employee.class, "emp1");
-
- private final Object emp2 = getTransientCompanyModelInstance(Employee.class, "emp2");
- private final Object emp3 = getTransientCompanyModelInstance(Employee.class, "emp3");
- private final Object emp4 = getTransientCompanyModelInstance(Employee.class, "emp4");
- private final Object emp5 = getTransientCompanyModelInstance(Employee.class, "emp5");
- private final Object proj1 = getTransientCompanyModelInstance(Project.class, "proj1");
- private final Object proj2 = getTransientCompanyModelInstance(Project.class, "proj2");
- private final Object proj3 = getTransientCompanyModelInstance(Project.class, "proj3");
- private final Object dept1 = getTransientCompanyModelInstance(Department.class, "dept1");
- private final Object dept2 = getTransientCompanyModelInstance(Department.class, "dept2");
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithConstraint() {
- Object expected =
- Arrays.asList(
- new Object[] {emp1, proj1}, new Object[] {emp2, proj1}, new Object[] {emp3, proj1});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(cand.employees.contains(e).and(e.projects.contains(p)).and(p.name.eq("orange")));
- query.result(false, e, p);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e, p",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && e.projects.contains(p) && p.name == 'orange'",
- /*VARIABLES*/ "Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithoutConstraint() {
- Object expected =
- Arrays.asList(
- new Object[] {emp1, proj1},
- new Object[] {emp2, proj1},
- new Object[] {emp3, proj1},
- new Object[] {emp2, proj2},
- new Object[] {emp3, proj2},
- new Object[] {emp4, proj3},
- new Object[] {emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(cand.employees.contains(e).and(e.projects.contains(p)));
- query.result(false, e, p);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e, p",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithThis() {
- Object expected =
- Arrays.asList(
- new Object[] {dept1, emp1, proj1},
- new Object[] {dept1, emp2, proj1},
- new Object[] {dept1, emp3, proj1},
- new Object[] {dept1, emp2, proj2},
- new Object[] {dept1, emp3, proj2},
- new Object[] {dept2, emp4, proj3},
- new Object[] {dept2, emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(cand.employees.contains(e).and(e.projects.contains(p)));
- query.result(false, cand, e, p);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "this, e, p",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithThisConstraint() {
- Object expected =
- Arrays.asList(
- new Object[] {emp1, proj1},
- new Object[] {emp2, proj1},
- new Object[] {emp3, proj1},
- new Object[] {emp2, proj2},
- new Object[] {emp3, proj2});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(cand.deptid.eq(1l).and(cand.employees.contains(e)).and(e.projects.contains(p)));
- query.result(false, e, p);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e, p",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "deptid == 1 && employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- /** */
- @SuppressWarnings("unchecked")
- @Test
- @Execution(ExecutionMode.CONCURRENT)
- public void testNavigationWithCompanyConstraint() {
- Object expected =
- Arrays.asList(
- new Object[] {emp1, proj1},
- new Object[] {emp2, proj1},
- new Object[] {emp3, proj1},
- new Object[] {emp2, proj2},
- new Object[] {emp3, proj2},
- new Object[] {emp4, proj3},
- new Object[] {emp5, proj3});
- PersistenceManager pm = getPMF().getPersistenceManager();
- try {
- JDOQLTypedQuery<Department> query = pm.newJDOQLTypedQuery(Department.class);
- QDepartment cand = QDepartment.candidate();
- QEmployee e = QEmployee.variable("e");
- QProject p = QProject.variable("p");
- query.filter(
- cand.company
- .name
- .eq("Sun Microsystems, Inc.")
- .and(cand.employees.contains(e))
- .and(e.projects.contains(p)));
- query.result(false, e, p);
-
- QueryElementHolder<Department> holder =
- new QueryElementHolder<>(
- /*UNIQUE*/ null,
- /*RESULT*/ "e, p",
- /*INTO*/ null,
- /*FROM*/ Department.class,
- /*EXCLUDE*/ null,
- /*WHERE*/ "company.name == \"Sun Microsystems, Inc.\" && employees.contains(e) && e.projects.contains(p)",
- /*VARIABLES*/ "Employee e; Project p",
- /*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, null, true, expected);
- } finally {
- cleanupPM(pm);
- }
- }
-
- @BeforeAll
- @Override
- protected void setUp() {
- super.setUp();
- }
-
- @AfterAll
- @Override
- protected void tearDown() {
- super.tearDown();
- }
-
- /**
- * @see org.apache.jdo.tck.JDO_Test#localSetUp()
- */
- @Override
- protected void localSetUp() {
- addTearDownClass(CompanyModelReader.getTearDownClasses());
- loadAndPersistCompanyModel(getPM());
- }
-}
diff --git a/tck/src/main/resources/conf/query-orig.conf b/tck/src/main/resources/conf/query-orig.conf
deleted file mode 100644
index f6268612..00000000
--- a/tck/src/main/resources/conf/query-orig.conf
+++ /dev/null
@@ -1,100 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-jdo.tck.description = All query tests with standard mapping, no testdata.
-jdo.tck.mapping.companyfactory =
-jdo.tck.testdata =
-jdo.tck.standarddata =
-jdo.tck.mapping = 0
-jdo.tck.requiredOptions =
-jdo.tck.classes = \
-org.apache.jdo.tck.query.api.AutoCloseable \
-org.apache.jdo.tck.query.api.ChangeQuery \
-org.apache.jdo.tck.query.api.Close \
-org.apache.jdo.tck.query.api.CloseAll \
-org.apache.jdo.tck.query.api.CompileQuery \
-#org.apache.jdo.tck.query.api.Declare \
-org.apache.jdo.tck.query.api.DeclareImports \
-org.apache.jdo.tck.query.api.DeclareParameters \
-org.apache.jdo.tck.query.api.DeclareVariables \
-org.apache.jdo.tck.query.api.ExecuteQuery \
-org.apache.jdo.tck.query.api.ExecuteQueryWithArray \
-org.apache.jdo.tck.query.api.ExecuteQueryWithMap \
-org.apache.jdo.tck.query.api.GetFetchPlan \
-org.apache.jdo.tck.query.api.GetIgnoreCache \
-org.apache.jdo.tck.query.api.GetPersistenceManager \
-org.apache.jdo.tck.query.api.GetPersistenceManagerFromRestoredSerializedQuery \
-org.apache.jdo.tck.query.api.InvalidNamedQuery \
-org.apache.jdo.tck.query.api.MetadataSearchOrder \
-org.apache.jdo.tck.query.api.NamedQueryNotFound \
-org.apache.jdo.tck.query.api.NamedQueryRepeatableAnnotations \
-org.apache.jdo.tck.query.api.NewNamedQuery \
-#org.apache.jdo.tck.query.api.NewQuery \
-org.apache.jdo.tck.query.api.NewQueryFromExistingQueryBoundToPMFromSameVendor \
-org.apache.jdo.tck.query.api.NewQueryFromRestoredSerializedQuery \
-org.apache.jdo.tck.query.api.NewQueryWithCandidateClass \
-org.apache.jdo.tck.query.api.NewQueryWithCandidateClassAndCollection \
-org.apache.jdo.tck.query.api.NewQueryWithCandidateClassAndExtent \
-org.apache.jdo.tck.query.api.NewQueryWithCandidateClassAndFilter \
-org.apache.jdo.tck.query.api.NewQueryWithCandidateClassCollectionFilter \
-org.apache.jdo.tck.query.api.NewQueryWithExtent \
-org.apache.jdo.tck.query.api.NewQueryWithExtentAndFilter \
-org.apache.jdo.tck.query.api.NewQueryWithSpecifiedLanguageAndQuery \
-org.apache.jdo.tck.query.api.NewQuerySingleString \
-org.apache.jdo.tck.query.api.QueryExtentions \
-org.apache.jdo.tck.query.api.SampleReadQueries \
-org.apache.jdo.tck.query.api.SampleModifyQueries \
-org.apache.jdo.tck.query.api.SaveAsNamedQuery \
-org.apache.jdo.tck.query.api.SetCandidateCollection \
-org.apache.jdo.tck.query.api.SetCandidateExtent \
-org.apache.jdo.tck.query.api.SetFilter \
-org.apache.jdo.tck.query.api.SetGrouping \
-org.apache.jdo.tck.query.api.SetIgnoreCache \
-org.apache.jdo.tck.query.api.SetOrdering \
-org.apache.jdo.tck.query.api.SetRange \
-org.apache.jdo.tck.query.api.SetResult \
-org.apache.jdo.tck.query.api.SetResultClass \
-org.apache.jdo.tck.query.api.SetUnique \
-org.apache.jdo.tck.query.api.SetterReplacePreviousValues \
-org.apache.jdo.tck.query.api.SingleStringQuery \
-org.apache.jdo.tck.query.api.UnmodifiableQuery \
-org.apache.jdo.tck.query.delete.DeleteCallback \
-org.apache.jdo.tck.query.delete.DeletePersistentAll \
-org.apache.jdo.tck.query.delete.DeleteQueryElements \
-org.apache.jdo.tck.query.result.AggregateResult \
-org.apache.jdo.tck.query.result.DefaultResult \
-org.apache.jdo.tck.query.result.DefaultUnique \
-org.apache.jdo.tck.query.result.DistinctCandidateInstances \
-org.apache.jdo.tck.query.result.DistinctQuery \
-org.apache.jdo.tck.query.result.Grouping \
-org.apache.jdo.tck.query.result.IfElseResult \
-org.apache.jdo.tck.query.result.ImmutableQueryResult \
-org.apache.jdo.tck.query.result.MethodsInResult \
-org.apache.jdo.tck.query.result.NPEInResultExpr \
-org.apache.jdo.tck.query.result.NullResults \
-org.apache.jdo.tck.query.result.ProjectedSCODoesNotTrackChanges \
-org.apache.jdo.tck.query.result.ResultClassRequirements \
-org.apache.jdo.tck.query.result.ResultClassRequirementsMap \
-org.apache.jdo.tck.query.result.ResultExpressions \
-org.apache.jdo.tck.query.result.ShapeOfResult \
-org.apache.jdo.tck.query.result.Unique \
-org.apache.jdo.tck.query.result.VariableInResult \
-org.apache.jdo.tck.query.result.VariableInResultNavigation \
-org.apache.jdo.tck.query.result.VariableInResultMultipleNavigation \
-org.apache.jdo.tck.query.sql.ShapeOfResult \
-org.apache.jdo.tck.query.sql.NoCandidateClass \
-org.apache.jdo.tck.query.sql.AllowedAPIMethods \
-org.apache.jdo.tck.query.sql.NewQuery \
-org.apache.jdo.tck.query.sql.ExecuteWithMap