db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r488187 - /db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java
Date Mon, 18 Dec 2006 10:03:50 GMT
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


Mime
View raw message