package de.tblsoft.solr.pipeline.pipeline;

import de.tblsoft.solr.pipeline.test.AbstractPipelineTest;
import org.junit.Test;

/**
 * Created by tblsoft on 28.04.16.
 */
public class CsvReaderTest extends AbstractPipelineTest {

    @Test
    public void testCsvReader() {
        runPipeline("examples/unittest/csv-reader-pipeline.yaml");
        assertFiled("column1", "foo");
        assertFiled("column2", "bar");

        assertNumberOfDocuments(2);
        assertNumberOfFields(2);

        assertInitWasDelegated();
        assertEndWasDelegated();
    }

    @Test
    public void testCsvReaderWithGzip() {
        runPipeline("examples/unittest/csv-reader-gzip-pipeline.yaml");
        assertFiled("column1", "foo");
        assertFiled("column2", "bar");

        assertNumberOfDocuments(2);
        assertNumberOfFields(2);

        assertInitWasDelegated();
        assertEndWasDelegated();
    }

    @Test
    public void testCsvReaderWithoutHeader() {
        runPipeline("examples/unittest/csv-reader-without-header-pipeline.yaml");
        assertFiled("column1", "foo");
        assertFiled("column2", "bar");

        assertNumberOfDocuments(2);
        assertNumberOfFields(2);
    }

    @Test(expected = RuntimeException.class)
    public void testFileNotExists() {
        runPipeline("examples/unittest/csv-file-not-exists-pipeline.yaml");
    }
}

@@ -548,32 +548,377 @@
 gated();%0A    %7D%0A%0A
+    @Test%0A    public void testCsvReaderWithBz2() %7B%0A        runPipeline(%22examples/unittest/csv-reader-bz2-pipeline.yaml%22);%0A        assertFiled(%22column1%22, %22foo%22);%0A        assertFiled(%22column2%22, %22bar%22);%0A%0A        assertNumberOfDocuments(2);%0A        assertNumberOfFields(2);%0A%0A        assertInitWasDelegated();%0A        assertEndWasDelegated();%0A    %7D%0A%0A
     @Test%0A    pu

add bz2 support for input files