db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject [db-jdo] 34/43: JDO-415
Date Fri, 07 May 2021 23:12:16 GMT
This is an automated email from the ASF dual-hosted git repository.

clr pushed a commit to branch origin/2.0.1
in repository https://gitbox.apache.org/repos/asf/db-jdo.git

commit 319899d9870357e72ec4f7025e38f14111d854a8
Author: Craig L Russell <clr@apache.org>
AuthorDate: Thu Oct 5 02:48:26 2006 +0000

    JDO-415
---
 .../api/persistencemanager/DataStoreConnection.java   | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
b/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
index 9c81e4d..cc639bb 100644
--- a/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
+++ b/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/DataStoreConnection.java
@@ -86,12 +86,26 @@ public class DataStoreConnection extends PersistenceManagerTest {
                     "getDataStoreConnection AND SQLSupported.");
             return;
         }
+        getPM().currentTransaction().setOptimistic(false);
+        executeSQLWithDataStoreConnection();
+        if (!isOptimisticSupported()) {
+            printUnsupportedOptionalFeatureNotTested(
+                    this.getClass().getName(),
+                    "getDataStoreConnection AND SQLSupported AND Optimistic.");
+            return;
+        }
+        getPM().currentTransaction().setOptimistic(true);
+        executeSQLWithDataStoreConnection();
+    }
+
+    private void executeSQLWithDataStoreConnection() {
         String schema = getPMFProperty("javax.jdo.mapping.Schema");
         String sql = "SELECT X, Y FROM " + schema + ".PCPoint";
-        JDOConnection jconn = pm.getDataStoreConnection();
-        Connection conn = (Connection)jconn;
+        JDOConnection jconn = null;
         try {
             getPM().currentTransaction().begin();
+            jconn = pm.getDataStoreConnection();
+            Connection conn = (Connection)jconn;
             if (conn.getAutoCommit()) {
                 appendMessage(ASSERTION_FAILED + 
                         "Autocommit must not be true in JDO connection.");
@@ -123,6 +137,7 @@ public class DataStoreConnection extends PersistenceManagerTest {
             appendMessage(ASSERTION_FAILED + " caught exception:" + ex);
         } finally {
             jconn.close();
+            getPM().currentTransaction().commit();
             failOnError();
         }
     }

Mime
View raw message