Remove testDb file after JUnit run

- Using TemporaryFolder rule should ensure that they'll be removed
  regardless of test results.

Change-Id: I75539ae38aa0a8c3f8c00437f28c007422cd72c6
diff --git a/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentMapTest.java b/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentMapTest.java
index f5cfef8..aa5edb3 100644
--- a/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentMapTest.java
+++ b/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentMapTest.java
@@ -19,12 +19,13 @@
 import com.google.common.collect.Maps;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.mapdb.DB;
 import org.mapdb.DBMaker;
 import org.onosproject.store.service.Serializer;
 
-import java.nio.file.Paths;
 import java.util.Map;
 import java.util.Set;
 
@@ -41,6 +42,8 @@
     private Map<Integer, Integer> map = null;
     private DB fakeDB = null;
 
+    @Rule
+    public TemporaryFolder tmpFolder = new TemporaryFolder();
 
     /**
      * Set up the database, create a map and a direct executor to handle it.
@@ -51,7 +54,7 @@
     public void setUp() throws Exception {
         //Creates a db, a map within it and a basic integer serializer (async writing is off)
         fakeDB = DBMaker
-                .newFileDB(Paths.get("../testDb").toFile())
+                .newFileDB(tmpFolder.newFile("testDb"))
                 .asyncWriteEnable()
                 .closeOnJvmShutdown()
                 .make();
@@ -99,10 +102,6 @@
         fakeDB.delete("map:map");
         fakeDB.commit();
         fakeDB.close();
-        //This is key to prevent artifacts persisting between tests.
-        Paths.get("../testDB").toFile().delete();
-
-
     }
 
     @Test
diff --git a/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentSetTest.java b/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentSetTest.java
index 0e2ac2c..1ebd877 100644
--- a/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentSetTest.java
+++ b/core/store/persistence/src/test/java/org/onosproject/persistence/impl/PersistentSetTest.java
@@ -19,12 +19,13 @@
 import com.google.common.collect.Sets;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
 import org.mapdb.DB;
 import org.mapdb.DBMaker;
 import org.onosproject.store.service.Serializer;
 
-import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -44,11 +45,14 @@
     private Set<Integer> set = null;
     private DB fakeDB = null;
 
+    @Rule
+    public TemporaryFolder tmpFolder = new TemporaryFolder();
+
     @Before
     public void setUp() throws Exception {
         //Creates a db, a set within it and a basic integer serializer (async writing is off)
         fakeDB = DBMaker
-                .newFileDB(Paths.get("../testDb").toFile())
+                .newFileDB(tmpFolder.newFile("testDb"))
                 .asyncWriteEnable()
                 .closeOnJvmShutdown()
                 .make();
@@ -92,8 +96,6 @@
         fakeDB.delete("map:map");
         fakeDB.commit();
         fakeDB.close();
-        //This is key to prevent artifacts persisting between tests.
-        Paths.get("../testDB").toFile().delete();
     }
 
     @Test