You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2006/12/18 11:03:50 UTC

svn commit: r488187 - /db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java

Author: tfischer
Date: Mon Dec 18 02:03:49 2006
New Revision: 488187

URL: http://svn.apache.org/viewvc?view=rev&rev=488187
Log:
improved the shutdown test case in the test project to see whether reinitialisation is possible.

Modified:
    db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java

Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java?view=diff&rev=488187&r1=488186&r2=488187
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java (original)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java Mon Dec 18 02:03:49 2006
@@ -1777,12 +1777,36 @@
     }
 
     /**
-     * Tests whether shutdown complains about anything
-     * @throws TorqueException if shutdown does not exit cleanly
+     * Tests whether shutdown works correctly and whether reinitialisation
+     * is possible after shutdown.
+     * @throws TorqueException if shutdown does not exit cleanly.
      */
-    public void testShutdown() throws TorqueException
+    public void testShutdown() throws Exception
     {
         Torque.shutdown();
+
+        try
+        {
+            Torque.getDatabase(Torque.getDefaultDB());
+            fail("database access should not be possible "
+                    + "when Torque is shutdown()");
+        }
+        catch (TorqueException e)
+        {
+        }
+
+        Torque.init(System.getProperty(CONFIG_FILE_SYSTEM_PROPERTY));
+
+        cleanBookstore();
+        Author author = new Author();
+        author.setName("shutdownName");
+        author.save();
+        List authors = AuthorPeer.doSelect(new Criteria());
+        assertEquals("List should contain one author", 1, authors.size());
+        author = (Author) authors.get(0);
+        assertEquals("Author's name should be shutdownName", 
+                "shutdownName",
+                author.getName());
     }
 
     /**



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