BUG 1735 Registering a data change listener should be asynchronous
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / AbstractActorTest.java
index 45ef32f7ad798ad15a0840c1c7860bf61f34913d..4c550a768cce258e3a151139f753751281b439d6 100644 (file)
@@ -10,25 +10,46 @@ package org.opendaylight.controller.cluster.datastore;
 
 import akka.actor.ActorSystem;
 import akka.testkit.JavaTestKit;
+import org.apache.commons.io.FileUtils;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
+import java.io.File;
+import java.io.IOException;
+
 public abstract class AbstractActorTest {
-  private static ActorSystem system;
-
-  @BeforeClass
-  public static void setUpClass(){
-    system = ActorSystem.create("test");
-  }
-
-  @AfterClass
-  public static void tearDownClass(){
-    JavaTestKit.shutdownActorSystem(system);
-    system = null;
-  }
-
-  protected ActorSystem getSystem(){
-    return system;
-  }
+    private static ActorSystem system;
+
+    @BeforeClass
+    public static void setUpClass() throws IOException {
+
+        System.setProperty("shard.persistent", "false");
+        system = ActorSystem.create("test");
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws IOException {
+        JavaTestKit.shutdownActorSystem(system);
+        system = null;
+    }
+
+    protected static void deletePersistenceFiles() throws IOException {
+        File journal = new File("journal");
+
+        if(journal.exists()) {
+            FileUtils.deleteDirectory(journal);
+        }
+
+        File snapshots = new File("snapshots");
+
+        if(snapshots.exists()){
+            FileUtils.deleteDirectory(snapshots);
+        }
+
+    }
+
+    protected ActorSystem getSystem() {
+        return system;
+    }
 
 }