Search in sources :

Example 1 with CombiningFirehoseFactory

use of io.druid.segment.realtime.firehose.CombiningFirehoseFactory in project druid by druid-io.

the class CombiningFirehoseFactoryTest method testCombiningfirehose.

@Test
public void testCombiningfirehose() throws IOException {
    List<InputRow> list1 = Arrays.asList(makeRow(1, 1), makeRow(2, 2));
    List<InputRow> list2 = Arrays.asList(makeRow(3, 3), makeRow(4, 4), makeRow(5, 5));
    FirehoseFactory combiningFactory = new CombiningFirehoseFactory(Arrays.<FirehoseFactory>asList(new ListFirehoseFactory(list1), new ListFirehoseFactory(list2)));
    final Firehose firehose = combiningFactory.connect(null);
    for (int i = 1; i < 6; i++) {
        Assert.assertTrue(firehose.hasMore());
        final InputRow inputRow = firehose.nextRow();
        Assert.assertEquals(i, inputRow.getTimestampFromEpoch());
        Assert.assertEquals(i, inputRow.getFloatMetric("test"), 0);
    }
    Assert.assertFalse(firehose.hasMore());
}
Also used : CombiningFirehoseFactory(io.druid.segment.realtime.firehose.CombiningFirehoseFactory) FirehoseFactory(io.druid.data.input.FirehoseFactory) Firehose(io.druid.data.input.Firehose) InputRow(io.druid.data.input.InputRow) CombiningFirehoseFactory(io.druid.segment.realtime.firehose.CombiningFirehoseFactory) Test(org.junit.Test)

Aggregations

Firehose (io.druid.data.input.Firehose)1 FirehoseFactory (io.druid.data.input.FirehoseFactory)1 InputRow (io.druid.data.input.InputRow)1 CombiningFirehoseFactory (io.druid.segment.realtime.firehose.CombiningFirehoseFactory)1 Test (org.junit.Test)1