struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmitch...@apache.org
Subject svn commit: r392968 - /struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java
Date Mon, 10 Apr 2006 15:37:04 GMT
Author: jmitchell
Date: Mon Apr 10 08:37:02 2006
New Revision: 392968

URL: http://svn.apache.org/viewcvs?rev=392968&view=rev
Log:
Clean up the test-database.xml file, with the option to keep it for debugging purposes

Modified:
    struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java

Modified: struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java?rev=392968&r1=392967&r2=392968&view=diff
==============================================================================
--- struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java
(original)
+++ struts/action/trunk/mailreader-dao/src/test/org/apache/struts/apps/mailreader/dao/impl/memory/MemoryUserDatabaseTest.java
Mon Apr 10 08:37:02 2006
@@ -18,6 +18,8 @@
 
 package org.apache.struts.apps.mailreader.dao.impl.memory;
 
+import java.io.File;
+
 import org.apache.struts.apps.mailreader.dao.BaseTestUserDatabase;
 import org.apache.struts.apps.mailreader.dao.Subscription;
 import org.apache.struts.apps.mailreader.dao.User;
@@ -28,8 +30,15 @@
 public class MemoryUserDatabaseTest extends BaseTestUserDatabase {
 
     protected String defaultPathName = "test-database.xml";
+    private boolean deleteDatabaseFile = true;
     
-    protected UserDatabase getNewUserDatabase(){
+    public boolean isDeleteDatabaseFile() {
+		return deleteDatabaseFile;
+	}
+	public void setDeleteDatabaseFile(boolean deleteDatabaseFile) {
+		this.deleteDatabaseFile = deleteDatabaseFile;
+	}
+	protected UserDatabase getNewUserDatabase(){
         // using default impl
         MemoryUserDatabase memoryUserDatabase = new MemoryUserDatabase();
         memoryUserDatabase.setPathname(defaultPathName);
@@ -49,5 +58,12 @@
         super.setUp();
         // force write to disk
 	     userDatabase.close();
+    }
+    protected void tearDown() throws Exception {
+    	super.tearDown();
+    	if (isDeleteDatabaseFile()){
+    		File file = new File(defaultPathName);
+    		file.delete();
+    	}
     }
 }



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


Mime
View raw message