You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/03/29 21:57:46 UTC

svn commit: r759771 - /incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java

Author: jbellis
Date: Sun Mar 29 19:57:46 2009
New Revision: 759771

URL: http://svn.apache.org/viewvc?rev=759771&view=rev
Log:
glean test dirs to cleanup from configuration

Modified:
    incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java

Modified: incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java?rev=759771&r1=759770&r2=759771&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java (original)
+++ incubator/cassandra/trunk/test/org/apache/cassandra/ServerTest.java Sun Mar 29 19:57:46 2009
@@ -2,6 +2,7 @@
 
 import org.testng.annotations.Test;
 import org.testng.annotations.BeforeMethod;
+import org.apache.cassandra.config.DatabaseDescriptor;
 
 import java.io.File;
 
@@ -9,14 +10,21 @@
 public class ServerTest {
     // TODO clean up static structures too (e.g. memtables)
     @BeforeMethod
-    public void cleanup() {
-        // for convenience, this assumes that you haven't changed the test config away from storing everything
-        // under /var/cassandra.
-        for (String dirname : new String[] {"bootstrap", "commitlog", "data", "staging", "system"}) {
-            File dir = new File("/var/cassandra", dirname);
-            for (File f : dir.listFiles()) {
-                f.delete();
+    public void cleanup()
+    {
+        String[] directoryNames = {
+                DatabaseDescriptor.getBootstrapFileLocation(),
+                DatabaseDescriptor.getLogFileLocation(),
+                DatabaseDescriptor.getDataFileLocation(),
+                DatabaseDescriptor.getMetadataDirectory(),
+        };
+
+        for (String dirName : directoryNames)
+        {
+            File dir = new File(dirName);
+            if (!dir.exists())
+            {
+                throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
             }
         }
     }
-}