X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FAbstractActorTest.java;h=4c550a768cce258e3a151139f753751281b439d6;hp=2fe7b69cc9b349548f9b44ea36f5d9a9adf1bc2c;hb=9f61e98b036119694dfef0759a7cafc56aae6e86;hpb=ca6ab9d397168973410b87c21f3a8f82ea871a8e diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java index 2fe7b69cc9..4c550a768c 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractActorTest.java @@ -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 setUp(){ - system = ActorSystem.create("test"); - } - - @AfterClass - public static void tearDown(){ - 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; + } }