Author: ritchiem
Date: Wed Oct 28 15:32:52 2009
New Revision: 830598

URL: http://svn.apache.org/viewvc?rev=830598&view=rev
Log:
QPID-2040: update test to ensure all test files created are cleared up

Modified:
    
qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabaseTest.java

Modified: 
qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabaseTest.java
URL: 
http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabaseTest.java?rev=830598&r1=830597&r2=830598&view=diff
==============================================================================
--- 
qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabaseTest.java
 (original)
+++ 
qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/security/auth/database/PlainPasswordFilePrincipalDatabaseTest.java
 Wed Oct 28 15:32:52 2009
@@ -34,6 +34,7 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.security.Principal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
@@ -47,12 +48,29 @@
     
     private Principal _principal = new UsernamePrincipal(TEST_USERNAME);
     private PlainPasswordFilePrincipalDatabase _database;
+    private List<File> _testPwdFiles = new ArrayList<File>();
 
     public void setUp() throws Exception
     {
         _database = new PlainPasswordFilePrincipalDatabase();
+        _testPwdFiles.clear();
     }
 
+    public void tearDown() throws Exception
+    {
+        //clean up any additional files and their backups
+        for(File f : _testPwdFiles)
+        {
+            File oldPwdFile = new File(f.getAbsolutePath() + ".old");
+            if(oldPwdFile.exists())
+            {
+                oldPwdFile.delete();
+            }
+            
+            f.delete();
+        }
+    }
+    
     // ******* Test Methods ********** //
 
     public void testCreatePrincipal()
@@ -368,6 +386,8 @@
 
             writer.flush();
             writer.close();
+            
+            _testPwdFiles.add(testFile);
 
             return testFile;
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscr...@qpid.apache.org

Reply via email to