use of com.ibm.streams.flow.handlers.StreamHandler in project streamsx.topology by IBMStreams.
the class TupleCollection method setupEmbeddedTestHandlers.
public void setupEmbeddedTestHandlers(JavaTestableGraph tg) throws Exception {
for (TStream<?> stream : handlers.keySet()) {
Set<StreamHandler<Tuple>> streamHandlers = handlers.get(stream);
for (StreamHandler<Tuple> streamHandler : streamHandlers) {
BOutput output = stream.output();
if (output instanceof BOutputPort) {
BOutputPort outputPort = (BOutputPort) output;
tg.registerStreamHandler(outputPort.port(), streamHandler);
}
// tg.registerStreamHandler(stream.getPort(), streamHandler);
}
}
}
use of com.ibm.streams.flow.handlers.StreamHandler in project streamsx.topology by IBMStreams.
the class EmbeddedTesterRuntime method setupEmbeddedTestHandlers.
private void setupEmbeddedTestHandlers(EmbeddedGraph eg) throws Exception {
// Embedded does not support a StreamHandler against
// a connected stream. In that case add a no-op intermediate stream.
Set<TStream<?>> adds = new HashSet<>();
// Find all that are connected.
for (TStream<?> stream : handlers.keySet()) {
if (stream.output().isConnected())
adds.add(stream);
}
// Insert a filter for the handler.
for (TStream<?> stream : adds) {
TStream<?> filter = stream.filter(t -> true);
Set<StreamHandler<Tuple>> handler = handlers.get(stream);
handlers.remove(stream);
handlers.put(filter, handler);
}
final JavaTestableGraph tg = eg.getExecutionGraph();
for (TStream<?> stream : handlers.keySet()) {
Set<StreamHandler<Tuple>> streamHandlers = handlers.get(stream);
final BOutput output = stream.output();
final OutputPortDeclaration portDecl = eg.getOutputPort(output.name());
for (StreamHandler<Tuple> streamHandler : streamHandlers) {
tg.registerStreamHandler(portDecl, streamHandler);
}
}
}
Aggregations