Search in sources :

Example 1 with StreamlineSink

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()));
    }
}
Also used : StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink) TopologyDag(com.hortonworks.streamline.streams.layout.component.TopologyDag) Test(org.junit.Test)

Example 2 with StreamlineSink

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;
}
Also used : StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) TopologyDagVisitor(com.hortonworks.streamline.streams.layout.component.TopologyDagVisitor) StreamlineComponent(com.hortonworks.streamline.streams.layout.component.StreamlineComponent) StreamlineSource(com.hortonworks.streamline.streams.layout.component.StreamlineSource) StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink)

Example 3 with StreamlineSink

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;
}
Also used : StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink)

Example 4 with StreamlineSink

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);
    });
}
Also used : StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) InputComponent(com.hortonworks.streamline.streams.layout.component.InputComponent) OutputComponent(com.hortonworks.streamline.streams.layout.component.OutputComponent) StreamlineSource(com.hortonworks.streamline.streams.layout.component.StreamlineSource) StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink) Edge(com.hortonworks.streamline.streams.layout.component.Edge)

Example 5 with StreamlineSink

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);
}
Also used : StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) StreamlineSource(com.hortonworks.streamline.streams.layout.component.StreamlineSource) StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink) Edge(com.hortonworks.streamline.streams.layout.component.Edge) TopologyDag(com.hortonworks.streamline.streams.layout.component.TopologyDag)

Aggregations

StreamlineSink (com.hortonworks.streamline.streams.layout.component.StreamlineSink)12 StreamlineProcessor (com.hortonworks.streamline.streams.layout.component.StreamlineProcessor)8 StreamlineSource (com.hortonworks.streamline.streams.layout.component.StreamlineSource)8 Edge (com.hortonworks.streamline.streams.layout.component.Edge)6 TopologyDag (com.hortonworks.streamline.streams.layout.component.TopologyDag)6 TestRunProcessor (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunProcessor)5 TestRunRulesProcessor (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunRulesProcessor)5 TestRunSink (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunSink)5 TestRunSource (com.hortonworks.streamline.streams.layout.component.impl.testing.TestRunSource)5 HashMap (java.util.HashMap)5 List (java.util.List)5 Map (java.util.Map)5 Optional (java.util.Optional)5 Test (org.junit.Test)5 TopologyTestHelper (com.hortonworks.streamline.streams.actions.utils.TopologyTestHelper)4 Stream (com.hortonworks.streamline.streams.layout.component.Stream)4 Collections (java.util.Collections)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 TopologyActions (com.hortonworks.streamline.streams.actions.TopologyActions)3