package edu.kit.ipd.sdq.vitruvius.tests.infrastructure;

import java.util.Set;

import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;

import edu.kit.ipd.sdq.vitruvius.framework.util.datatypes.VURI;
import edu.kit.ipd.sdq.vitruvius.framework.vsum.helper.FileSystemHelper;
import edu.kit.ipd.sdq.vitruvius.tests.components.PersistentTestUtil;
import edu.kit.ipd.sdq.vitruvius.tests.components.VSUMTest;

public class FileSystemHelperTest extends VSUMTest {

    private static final Logger logger = Logger.getLogger(FileSystemHelperTest.class.getSimpleName());

    @Before
    public void setUp() throws Exception {
    }

    @Test
    public void testSaveAndLoadVURIs() {
        final int nrOfVURIs = 1000;
        Set<VURI> vuris = PersistentTestUtil.createDummyVURIs(getCurrentProjectFolderName(), nrOfVURIs);

        long start = System.currentTimeMillis();
        // save to disk
        FileSystemHelper.saveVSUMvURIsToFile(vuris);
        long durationForSave = System.currentTimeMillis() - start;
        long startLoad = System.currentTimeMillis();
        // load from Disk
        Set<VURI> loadedVURIs = FileSystemHelper.loadVSUMvURIsFromFile();

        long durationForLoad = System.currentTimeMillis() - startLoad;
        long durationForLoadAndSave = System.currentTimeMillis() - start;
        String vuriCount = "" + nrOfVURIs + " VURIs: ";
        logger.info("Duration for save " + vuriCount + durationForSave);
        logger.info("Duration for load " + vuriCount + durationForLoad);
        logger.info("Duration for save and load " + vuriCount + durationForLoadAndSave);
        // compare
        PersistentTestUtil.assertEqualsSets(vuris, loadedVURIs);
    }

}

@@ -201,27 +201,37 @@
 ork.
-util.datatypes.VURI
+tests.vsum.PersistentTestUtil
 ;%0Aim
@@ -275,36 +275,27 @@
 ork.
-vsum.helper.FileSystemHelper
+tests.vsum.VSUMTest
 ;%0Aim
@@ -329,103 +329,110 @@
 ius.
-tests.components.PersistentTestUtil;%0Aimport edu.kit.ipd.sdq.vitruvius.tests.components.VSUMTest
+framework.util.datatypes.VURI;%0Aimport edu.kit.ipd.sdq.vitruvius.framework.vsum.helper.FileSystemHelper
 ;%0A%0Ap

Update reference to VSUM tests project.