db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1378437 - /db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java
Date Wed, 29 Aug 2012 03:38:23 GMT
Author: tfischer
Date: Wed Aug 29 03:38:23 2012
New Revision: 1378437

URL: http://svn.apache.org/viewvc?rev=1378437&view=rev
Log:
- remove unused instance variable
- use Transaction.begin() and Transaction.commit() instead of Torque.getConnection() and connection.close()

Modified:
    db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java

Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java?rev=1378437&r1=1378436&r2=1378437&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java
(original)
+++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/adapter/AdapterTest.java
Wed Aug 29 03:38:23 2012
@@ -20,12 +20,11 @@ package org.apache.torque.adapter;
  */
 
 import java.sql.Connection;
-import java.util.List;
 
 import org.apache.torque.BaseDatabaseTestCase;
 import org.apache.torque.Torque;
-import org.apache.torque.test.Author;
 import org.apache.torque.test.AuthorPeer;
+import org.apache.torque.util.Transaction;
 
 /**
  * Tests methods in the adapters
@@ -34,14 +33,12 @@ import org.apache.torque.test.AuthorPeer
  */
 public class AdapterTest extends BaseDatabaseTestCase
 {
-    private List<Author> authorList;
-
     @Override
     public void setUp() throws Exception
     {
         super.setUp();
         cleanBookstore();
-        authorList = insertBookstoreData();
+        insertBookstoreData();
     }
 
     /**
@@ -56,9 +53,9 @@ public class AdapterTest extends BaseDat
         Connection connection = null;
         try
         {
-            connection = Torque.getConnection();
+            connection = Transaction.begin();
             // lock table
-            Torque.getDB(Torque.getDefaultDB()).lockTable(
+            Torque.getAdapter(Torque.getDefaultDB()).lockTable(
                     connection,
                     AuthorPeer.TABLE_NAME);
         }
@@ -66,10 +63,10 @@ public class AdapterTest extends BaseDat
         {
             if (connection != null)
             {
-                Torque.getDB(Torque.getDefaultDB()).unlockTable(
+                Torque.getAdapter(Torque.getDefaultDB()).unlockTable(
                         connection,
                         AuthorPeer.TABLE_NAME);
-                connection.close();
+                Transaction.safeRollback(connection);
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message