use of com.hortonworks.streamline.streams.layout.component.StreamlineSink in project streamline by hortonworks.
the class TestTopologyDagCreatingVisitorTest method visitSink_noMatchingTestRunSink.
@Test
public void visitSink_noMatchingTestRunSink() throws Exception {
TopologyDag originTopologyDag = new TopologyDag();
StreamlineSink originSink = TopologyTestHelper.createStreamlineSink("1");
originTopologyDag.add(originSink);
TestTopologyDagCreatingVisitor visitor = new TestTopologyDagCreatingVisitor(originTopologyDag, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
try {
visitor.visit(originSink);
fail("IllegalStateException should be thrown.");
} catch (IllegalStateException e) {
assertTrue(e.getMessage().contains(originSink.getName()));
}
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineSink in project streamline by hortonworks.
the class CatalogToLayoutConverter method getComponentLayout.
public static com.hortonworks.streamline.streams.layout.component.Component getComponentLayout(TopologyComponent component) {
StreamlineComponent componentLayout;
if (component instanceof TopologySource) {
componentLayout = new StreamlineSource() {
@Override
public void accept(TopologyDagVisitor visitor) {
throw new UnsupportedOperationException("Not intended to be called here.");
}
};
} else if (component instanceof TopologyProcessor) {
componentLayout = new StreamlineProcessor() {
@Override
public void accept(TopologyDagVisitor visitor) {
throw new UnsupportedOperationException("Not intended to be called here.");
}
};
} else if (component instanceof TopologySink) {
componentLayout = new StreamlineSink() {
@Override
public void accept(TopologyDagVisitor visitor) {
throw new UnsupportedOperationException("Not intended to be called here.");
}
};
} else {
componentLayout = new StreamlineComponent() {
@Override
public void accept(TopologyDagVisitor visitor) {
throw new UnsupportedOperationException("Not intended to be called here.");
}
};
}
componentLayout.setId(component.getId().toString());
componentLayout.setName(component.getName());
componentLayout.setConfig(component.getConfig());
return componentLayout;
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineSink in project streamline by hortonworks.
the class RulesProcessorMock method getSink.
private Sink getSink(long sinkId) {
StreamlineSink sink = new StreamlineSink();
sink.setId(String.valueOf(ruleProcessorId));
sink.setName(SINK + "_" + sinkId);
return sink;
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineSink in project streamline by hortonworks.
the class TestTopologyDagCreatingVisitor method copyEdges.
private void copyEdges(InputComponent inputComponent) {
List<Edge> edgesTo = originTopologyDag.getEdgesTo(inputComponent);
edgesTo.forEach(e -> {
OutputComponent from = e.getFrom();
InputComponent to = e.getTo();
Edge newEdge = new Edge(e.getId(), e.getFrom(), e.getTo(), e.getStreamGroupings());
StreamlineSource replacedSource = sourceToReplacedTestSourceMap.get(from.getName());
StreamlineProcessor replacedProcessorSource = processorToReplacedTestProcessorMap.get(from.getName());
StreamlineSink replacedSink = sinkToReplacedTestSinkMap.get(to.getName());
StreamlineProcessor replacedProcessorSink = processorToReplacedTestProcessorMap.get(to.getName());
if (replacedSource != null) {
newEdge.setFrom(replacedSource);
} else if (replacedProcessorSource != null) {
newEdge.setFrom(replacedProcessorSource);
}
if (replacedSink != null) {
newEdge.setTo(replacedSink);
} else if (replacedProcessorSink != null) {
newEdge.setTo(replacedProcessorSink);
}
testTopologyDag.addEdge(newEdge);
});
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineSink in project streamline by hortonworks.
the class TopologyTestRunnerTest method injectTestTopology.
private void injectTestTopology(Topology topology) {
StreamlineSource originSource = TopologyTestHelper.createStreamlineSource("1");
StreamlineProcessor originProcessor = TopologyTestHelper.createStreamlineProcessor("2");
StreamlineSink originSink = TopologyTestHelper.createStreamlineSink("3");
TopologyDag topologyDag = new TopologyDag();
topologyDag.add(originSource);
topologyDag.add(originProcessor);
topologyDag.add(originSink);
topologyDag.addEdge(new Edge("e1", originSource, originProcessor, "default", Stream.Grouping.SHUFFLE));
topologyDag.addEdge(new Edge("e2", originProcessor, originSink, "default", Stream.Grouping.SHUFFLE));
topology.setTopologyDag(topologyDag);
}
Aggregations