Search in sources :

Example 16 with Pipeline

use of loghub.Pipeline in project LogHub by fbacchella.

the class TestEtl method test8.

@Test
public void test8() throws ProcessorException, InterruptedException, ConfigException, IOException {
    Properties conf = Tools.loadConf("etl.conf");
    for (Pipeline pipe : conf.pipelines) {
        Assert.assertTrue("configuration failed", pipe.configure(conf));
    }
    Event sent = Tools.getEvent();
    sent.setTimestamp(new Date(1));
    Tools.runProcessing(sent, conf.namedPipeLine.get("timestamp"), conf);
    Assert.assertEquals(new Date(0), sent.getTimestamp());
    Assert.assertEquals(new Date(1), sent.get("reception_time"));
}
Also used : Event(loghub.Event) Properties(loghub.configuration.Properties) Date(java.util.Date) Pipeline(loghub.Pipeline) Test(org.junit.Test)

Example 17 with Pipeline

use of loghub.Pipeline in project LogHub by fbacchella.

the class TestEtl method test6.

@Test
public void test6() throws ProcessorException, InterruptedException, ConfigException, IOException {
    Properties conf = Tools.loadConf("etl.conf");
    for (Pipeline pipe : conf.pipelines) {
        Assert.assertTrue("configuration failed", pipe.configure(conf));
    }
    Event sent = Tools.getEvent();
    sent.put("count", "1");
    Tools.runProcessing(sent, conf.namedPipeLine.get("second"), conf);
    Assert.assertEquals("conversion not expected", 1, sent.get("count"));
}
Also used : Event(loghub.Event) Properties(loghub.configuration.Properties) Pipeline(loghub.Pipeline) Test(org.junit.Test)

Example 18 with Pipeline

use of loghub.Pipeline in project LogHub by fbacchella.

the class TestMapper method test4.

@Test
public void test4() throws ProcessorException, InterruptedException, ConfigException, IOException {
    Properties conf = Tools.loadConf("map.conf");
    for (Pipeline pipe : conf.pipelines) {
        Assert.assertTrue("configuration failed", pipe.configure(conf));
    }
    Event sent = Tools.getEvent();
    sent.put("a", 2L);
    Tools.runProcessing(sent, conf.namedPipeLine.get("mapper2"), conf);
    Assert.assertEquals("conversion not expected", "c", sent.get("a"));
}
Also used : Event(loghub.Event) Properties(loghub.configuration.Properties) Pipeline(loghub.Pipeline) Test(org.junit.Test)

Example 19 with Pipeline

use of loghub.Pipeline in project LogHub by fbacchella.

the class TestMapper method test1.

@Test
public void test1() throws ProcessorException, InterruptedException, ConfigException, IOException {
    Properties conf = Tools.loadConf("map.conf");
    for (Pipeline pipe : conf.pipelines) {
        Assert.assertTrue("configuration failed", pipe.configure(conf));
    }
    Event sent = Tools.getEvent();
    sent.put("a", 1);
    Tools.runProcessing(sent, conf.namedPipeLine.get("mapper1"), conf);
    Assert.assertEquals("conversion not expected", "b", sent.get("d"));
}
Also used : Event(loghub.Event) Properties(loghub.configuration.Properties) Pipeline(loghub.Pipeline) Test(org.junit.Test)

Example 20 with Pipeline

use of loghub.Pipeline in project LogHub by fbacchella.

the class TestMapper method test2.

@Test
public void test2() throws ProcessorException, InterruptedException, ConfigException, IOException {
    Properties conf = Tools.loadConf("map.conf");
    for (Pipeline pipe : conf.pipelines) {
        Assert.assertTrue("configuration failed", pipe.configure(conf));
    }
    Event sent = Tools.getEvent();
    sent.put("a", 1);
    Tools.runProcessing(sent, conf.namedPipeLine.get("mapper2"), conf);
    Assert.assertEquals("conversion not expected", "b", sent.get("a"));
}
Also used : Event(loghub.Event) Properties(loghub.configuration.Properties) Pipeline(loghub.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (loghub.Pipeline)23 Event (loghub.Event)21 Properties (loghub.configuration.Properties)20 Test (org.junit.Test)17 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)8 HashMap (java.util.HashMap)6 IOException (java.io.IOException)4 Map (java.util.Map)4 File (java.io.File)2 InputStream (java.io.InputStream)2 Reader (java.io.Reader)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 MalformedURLException (java.net.MalformedURLException)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 URL (java.net.URL)2 URLClassLoader (java.net.URLClassLoader)2 Files (java.nio.file.Files)2 Path (java.nio.file.Path)2 Paths (java.nio.file.Paths)2