package com.zakgof.db.velvet.test;

import java.io.File;
import java.util.function.Supplier;

import org.junit.AfterClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

import com.zakgof.db.velvet.IVelvetEnvironment;
import com.zakgof.db.velvet.VelvetFactory;

@RunWith(Suite.class)

 @SuiteClasses({
   StoreIndexesTest.class,
   SecondarySortedLinkTest.class,
   SortedStoreTest.class,
   PutGetTest.class,
   SimpleLinkTest.class,
   PrimarySortedLinkTest.class,
   PrimarySortedLinkTest2.class,
   PerformanceTest.class,
   ConcurrentWriteTest.class,
   KeylessTest.class
})

public abstract class VelvetTestSuite {

    protected static Supplier<IVelvetEnvironment> velvetProvider;
    private static IVelvetEnvironment env;
    private static String PATH = "D:/Pr/lab/xodustest/"; // TODO

    protected static void setup(String providerName) {
        velvetProvider = () -> createVelvet(providerName);
    }

    private static IVelvetEnvironment createVelvet(String providerName) {
        tearDownClass();
        new File(PATH).mkdirs();
        env = VelvetFactory.open("velvetdb://" + providerName + "/" + PATH);
        // env.setSerializer(() -> new KryoSerializer());
        // env.setSerializer(() -> new ElsaVelvetSerializer());
        return env;
    }

    @AfterClass
    public static void tearDownClass() {
        if (env != null) {
            env.close();
            for (File file : new File(PATH).listFiles())
                file.delete();
        }
    }
}

@@ -50,16 +50,72 @@
 o.File;%0A
+import java.io.IOException;%0Aimport java.nio.file.Files;%0A
 import j
@@ -331,16 +331,61 @@
 onment;%0A
+import com.zakgof.db.velvet.VelvetException;%0A
 import c
@@ -923,42 +923,9 @@
 PATH
- = %22D:/Pr/lab/xodustest/%22; // TODO
+;
 %0A%0A  
@@ -969,32 +969,199 @@
 providerName) %7B%0A
+        try %7B%0A            PATH = Files.createTempDirectory(%22velvet%22).toString();%0A        %7D catch (IOException e) %7B%0A            throw new VelvetException(e);%0A        %7D%0A
         velvetPr
@@ -1416,16 +1416,49 @@
 %22 + PATH
+.replace(File.separatorChar, '/')
 );%0A     

Remove absolute paths from tests