use of io.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class TestStoreContainingInMemoryTable method generateResetComplexEventChunk.
private ComplexEventChunk<ComplexEvent> generateResetComplexEventChunk(int outputDataSize, StateEventFactory stateEventFactory) {
StreamEvent streamEvent = new StreamEvent(outputDataSize, 0, outputDataSize);
streamEvent.setType(ComplexEvent.Type.RESET);
StateEvent stateEvent = stateEventFactory.newInstance();
stateEvent.addEvent(0, streamEvent);
stateEvent.setType(ComplexEvent.Type.RESET);
ComplexEventChunk<ComplexEvent> complexEventChunk = new ComplexEventChunk<>();
complexEventChunk.add(stateEvent);
return complexEventChunk;
}
use of io.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class TestStoreForCacheMiss method find.
@Override
protected RecordIterator<Object[]> find(Map<String, Object> findConditionParameterMap, CompiledCondition compiledCondition) throws ConnectionUnavailableException {
if (findMatchingEvent == null) {
findMatchingEvent = new StateEvent(1, 0);
}
try {
StreamEvent outEvent = inMemoryTable.find(compiledCondition, findMatchingEvent);
List<Object[]> objects = new LinkedList<>();
if (outEvent != null) {
while (outEvent.hasNext()) {
objects.add(outEvent.getOutputData());
outEvent = outEvent.getNext();
}
objects.add(outEvent.getOutputData());
}
return new TestStoreWithCacheIterator(objects.iterator());
} finally {
findMatchingEvent = null;
}
}
use of io.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class TestStoreContainingInMemoryTable method convForDelete.
private ComplexEventChunk<StateEvent> convForDelete(List<Map<String, Object>> deleteConditionParameterMaps) {
List<Object[]> objectList = new LinkedList<>();
for (Map<String, Object> parameterMap : deleteConditionParameterMaps) {
List<Object> outputData = new ArrayList<>();
List<Attribute> attributeList = inMemoryTable.getTableDefinition().getAttributeList();
for (int i = 0; i < attributeList.size(); i++) {
if (parameterMap.get(attributeList.get(i).getName()) != null) {
outputData.add(parameterMap.get(attributeList.get(i).getName()));
} else {
outputData.add(null);
}
}
objectList.add(outputData.toArray());
}
ComplexEventChunk<StateEvent> complexEventChunk = new ComplexEventChunk<>();
for (Object[] record : objectList) {
StreamEvent event = new StreamEvent(0, 0, record.length);
StateEvent stateEvent = new StateEvent(2, record.length);
event.setOutputData(record);
stateEvent.addEvent(0, event);
complexEventChunk.add(stateEvent);
}
return complexEventChunk;
}
use of io.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class TestStoreForCachePreLoading method find.
@Override
protected RecordIterator<Object[]> find(Map<String, Object> findConditionParameterMap, CompiledCondition compiledCondition) throws ConnectionUnavailableException {
if (findMatchingEvent == null) {
findMatchingEvent = new StateEvent(1, 0);
}
try {
StreamEvent outEvent = inMemoryTable.find(compiledCondition, findMatchingEvent);
List<Object[]> objects = new LinkedList<>();
if (outEvent != null) {
while (outEvent.hasNext()) {
objects.add(outEvent.getOutputData());
outEvent = outEvent.getNext();
}
objects.add(outEvent.getOutputData());
}
return new TestStoreWithCacheIterator(objects.iterator());
} finally {
findMatchingEvent = null;
}
}
use of io.siddhi.core.event.state.StateEvent in project siddhi by wso2.
the class TestStoreForCachePreLoading method generateResetComplexEventChunk.
private ComplexEventChunk<ComplexEvent> generateResetComplexEventChunk(int outputDataSize, StateEventFactory stateEventFactory) {
StreamEvent streamEvent = new StreamEvent(outputDataSize, 0, outputDataSize);
streamEvent.setType(ComplexEvent.Type.RESET);
StateEvent stateEvent = stateEventFactory.newInstance();
stateEvent.addEvent(0, streamEvent);
stateEvent.setType(ComplexEvent.Type.RESET);
ComplexEventChunk<ComplexEvent> complexEventChunk = new ComplexEventChunk<>();
complexEventChunk.add(stateEvent);
return complexEventChunk;
}
Aggregations