package org.jbake.app;

import org.jbake.app.configuration.ConfigUtil;
import org.jbake.app.configuration.DefaultJBakeConfiguration;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.net.URL;

public abstract class ContentStoreIntegrationTest {

    protected static ContentStore db;
    protected static DefaultJBakeConfiguration config;

    @Rule
    public TemporaryFolder folder = new TemporaryFolder();
    protected static File sourceFolder;

    @BeforeClass
    public static void setUpClass() throws Exception {

        URL sourceUrl = ContentStoreIntegrationTest.class.getClass().getResource("/fixture");

        sourceFolder = new File(sourceUrl.getFile());
        if (!sourceFolder.exists()) {
            throw new Exception("Cannot find sample data structure!");
        }

        config = (DefaultJBakeConfiguration) new ConfigUtil().loadConfig(sourceFolder);
        config.setSourceFolder(sourceFolder);

        Assert.assertEquals(".html", config.getOutputExtension());
        config.setDatabaseStore("memory");
        config.setDatabasePath("documents" + System.currentTimeMillis());

        db = DBUtil.createDataStore(config);
    }

    @AfterClass
    public static void cleanUpClass() {
        db.close();
        db.shutdown();
    }

    @Before
    public void setUp() {
        db.startup();
    }

    @After
    public void tearDown() {
        db.drop();
    }
}

@@ -17,16 +17,44 @@
 e.app;%0A%0A
+import org.jbake.TestUtils;%0A
 import o
@@ -752,52 +752,23 @@
 l = 
-ContentStoreIntegrationTest.class.getC
+TestUtils.c
 lass
-()
 .get

fix test fixture acces in ContentStoreIntegrationTest