package org.opencb.hpg.bigdata.core.config;

import org.junit.Test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.file.Paths;
import java.util.Arrays;

public class OskarConfigurationTest {

    @Test
    public void testDefault() throws Exception {
        OskarConfiguration storageConfiguration = new OskarConfiguration();

//
        CellBaseConfiguration cellBaseConfiguration = new CellBaseConfiguration(Arrays.asList("localhost"), "v3", new DatabaseCredentials
                (Arrays.asList("localhost"), "user", "password"));

        storageConfiguration.setCellbase(cellBaseConfiguration);
        File file = Paths.get("/tmp/configuration.yml").toFile();
        try (FileOutputStream os = new FileOutputStream(file)) {
            storageConfiguration.serialize(os);
        }
        try (FileInputStream is = new FileInputStream(file)) {
            OskarConfiguration.load(is, "yml");
        }
    }

    @Test
    public void testLoad() throws Exception {
        OskarConfiguration storageConfiguration = OskarConfiguration.load(getClass().getResource("/configuration.yml")
                .openStream());
        System.out.println("oskarConfiguration = " + storageConfiguration);
    }
}
@@ -200,16 +200,64 @@
 .Arrays;
+%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Apublic
@@ -429,11 +429,8 @@
 );%0A%0A
-//%0A
     
@@ -630,17 +630,16 @@
 ord%22));%0A
-%0A
         
@@ -691,24 +691,494 @@
 iguration);%0A
+%0A        AnalysisConfiguration.Analysis plink = new AnalysisConfiguration.Analysis(%22~/soft/plink%22, %221.9%22);%0A        AnalysisConfiguration.Analysis rvtests = new AnalysisConfiguration.Analysis(%22~/soft/rvtests%22, %222017%22);%0A        Map%3CString, AnalysisConfiguration.Analysis%3E analysisMap = new HashMap%3C%3E();%0A        analysisMap.put(%22plink%22, plink);%0A        analysisMap.put(%22rvtests%22, rvtests);%0A        storageConfiguration.setAnalysis(new AnalysisConfiguration(analysisMap));%0A%0A
         File

update configuration test