Search in sources :

Example 6 with ConversionStreamEventChunk

use of org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk in project ballerina by ballerina-lang.

the class ComplexEventChunkTestCase method eventChunkTest.

@Test
public void eventChunkTest() {
    StreamEvent streamEvent1 = new StreamEvent(0, 0, 3);
    streamEvent1.setOutputData(new Object[] { "IBM", 700L, 1L });
    StreamEvent streamEvent2 = new StreamEvent(0, 0, 3);
    streamEvent2.setOutputData(new Object[] { "WSO2", 700L, 2L });
    StreamEvent streamEvent3 = new StreamEvent(0, 0, 3);
    streamEvent3.setOutputData(new Object[] { "WSO2", 700L, 3L });
    streamEvent1.setNext(streamEvent2);
    streamEvent2.setNext(streamEvent3);
    StreamEventPool streamEventPool = new StreamEventPool(0, 0, 3, 5);
    ConversionStreamEventChunk streamEventChunk = new ConversionStreamEventChunk(streamEventConverter, streamEventPool);
    streamEventChunk.convertAndAssign(streamEvent1);
    while (streamEventChunk.hasNext()) {
        count++;
        StreamEvent event = streamEventChunk.next();
        AssertJUnit.assertEquals(count * 1L, event.getOutputData()[2]);
    }
    AssertJUnit.assertEquals(3, count);
}
Also used : ConversionStreamEventChunk(org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.ballerinalang.siddhi.core.event.stream.StreamEventPool) Test(org.testng.annotations.Test)

Example 7 with ConversionStreamEventChunk

use of org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk in project ballerina by ballerina-lang.

the class ComplexEventChunkTestCase method eventChunkRemoveTest5.

@Test(expectedExceptions = IllegalStateException.class)
public void eventChunkRemoveTest5() {
    StreamEvent streamEvent1 = new StreamEvent(0, 0, 3);
    streamEvent1.setOutputData(new Object[] { "IBM", 700L, 100L });
    StreamEvent streamEvent2 = new StreamEvent(0, 0, 3);
    streamEvent2.setOutputData(new Object[] { "WSO2", 700L, 100L });
    streamEvent1.setNext(streamEvent2);
    StreamEventPool streamEventPool = new StreamEventPool(0, 0, 3, 5);
    ConversionStreamEventChunk streamEventChunk = new ConversionStreamEventChunk(streamEventConverter, streamEventPool);
    streamEventChunk.convertAndAssign(streamEvent1);
    streamEventChunk.remove();
    streamEventChunk.remove();
}
Also used : ConversionStreamEventChunk(org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.ballerinalang.siddhi.core.event.stream.StreamEventPool) Test(org.testng.annotations.Test)

Aggregations

ConversionStreamEventChunk (org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk)7 StreamEvent (org.ballerinalang.siddhi.core.event.stream.StreamEvent)6 StreamEventPool (org.ballerinalang.siddhi.core.event.stream.StreamEventPool)6 Test (org.testng.annotations.Test)6 StreamEventConverter (org.ballerinalang.siddhi.core.event.stream.converter.StreamEventConverter)1