package org.opencb.hpg.bigdata.app.cli.local;

import org.junit.Test;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by joaquin on 1/19/17.
 */
public class VariantRvTestsCLITest {
    String datasetName = "test";

    String vcfFilename = "../hpg-bigdata-app/src/test/resources/example.vcf";
    String phenoFilename = "../hpg-bigdata-app/src/test/resources/pheno";
    String outDir = "/tmp/";

    Path vcfPath;
    Path phenoPath;
    Path avroPath;
    Path metaPath;

    private void init() throws Exception {
        vcfPath = Paths.get(vcfFilename);
        phenoPath = Paths.get(phenoFilename);
        avroPath = Paths.get(outDir + "/" + vcfPath.getFileName() + ".avro");
        metaPath = Paths.get(outDir + "/" + vcfPath.getFileName() + ".avro.meta.json");

        avroPath.toFile().delete();
        metaPath.toFile().delete();

        // convert vcf to avro
        StringBuilder commandLine = new StringBuilder();
        commandLine.append(" variant convert");
        commandLine.append(" --log-level ERROR");
        commandLine.append(" -i ").append(vcfPath);
        commandLine.append(" -o ").append(avroPath);
        commandLine.append(" --dataset ").append(datasetName);
        VariantQueryCLITest.execute(commandLine.toString());

        // load pedigree file
        commandLine.setLength(0);
        commandLine.append(" variant metadata");
        commandLine.append(" --log-level ERROR");
        commandLine.append(" -i ").append(avroPath);
        commandLine.append(" --load-pedigree ").append(phenoPath);
        commandLine.append(" --dataset ").append(datasetName);
        VariantQueryCLITest.execute(commandLine.toString());
    }

    @Test
    public void skat() {
        try {
            init();

            StringBuilder commandLine = new StringBuilder();
            commandLine.append(" variant rvtests");
            commandLine.append(" --log-level ERROR");
            commandLine.append(" --dataset ").append(datasetName);
            commandLine.append(" -i ").append(avroPath);
            commandLine.append(" -Dsingle=wald");
            commandLine.append(" -Dout=/tmp/out.wald");
            VariantQueryCLITest.execute(commandLine.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

@@ -199,24 +199,31 @@
 ITest %7B%0A    
+public 
 String datas
@@ -240,24 +240,31 @@
 test%22;%0A%0A    
+public 
 String vcfFi
@@ -325,24 +325,31 @@
 e.vcf%22;%0A    
+public 
 String pheno
@@ -406,24 +406,31 @@
 pheno%22;%0A    
+public 
 String outDi
@@ -443,24 +443,31 @@
 tmp/%22;%0A%0A    
+public 
 Path vcfPath
@@ -468,24 +468,31 @@
 cfPath;%0A    
+public 
 Path phenoPa
@@ -495,24 +495,31 @@
 noPath;%0A    
+public 
 Path avroPat
@@ -525,16 +525,23 @@
 th;%0A    
+public 
 Path met
@@ -557,14 +557,13 @@
    p
-rivate
+ublic
  voi

Update JUnit test