use of com.hortonworks.streamline.streams.layout.component.StreamlineProcessor in project streamline by hortonworks.
the class StormTopologyTimeSeriesMetricsImplTest method getProcessorLayoutForTest.
private Component getProcessorLayoutForTest() {
StreamlineProcessor processor = new StreamlineProcessor() {
@Override
public void accept(TopologyDagVisitor visitor) {
}
};
processor.setId("12");
processor.setName("rule");
return processor;
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineProcessor in project streamline by hortonworks.
the class TestRunProcessorBoltFluxComponent method addUnderlyingBoltComponent.
private String addUnderlyingBoltComponent() {
StreamlineProcessor underlyingProcessor = testRunProcessor.getUnderlyingProcessor();
String transformationClass = underlyingProcessor.getTransformationClass();
Map<String, Object> underlyingComponent;
try {
AbstractFluxComponent transformation = ReflectionHelper.newInstance(transformationClass);
Map<String, Object> props = new LinkedHashMap<>();
props.putAll(underlyingProcessor.getConfig().getProperties());
props.put(StormTopologyLayoutConstants.STREAMLINE_COMPONENT_CONF_KEY, testRunProcessor.getUnderlyingProcessor());
// should get rid of below things which is only supported to spout and bolt in flux
props.remove("parallelism");
transformation.withConfig(props);
underlyingComponent = transformation.getComponent();
for (Map<String, Object> dependentComponents : transformation.getReferencedComponents()) {
addToComponents(dependentComponents);
}
addToComponents(underlyingComponent);
return (String) underlyingComponent.get(StormTopologyLayoutConstants.YAML_KEY_ID);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
log.error("Error creating underlying transformation instance", e);
throw new RuntimeException(e);
}
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineProcessor 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.StreamlineProcessor 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);
}
use of com.hortonworks.streamline.streams.layout.component.StreamlineProcessor in project streamline by hortonworks.
the class TestRunRulesProcessorBoltFluxComponent method addUnderlyingBoltComponent.
private String addUnderlyingBoltComponent() {
StreamlineProcessor underlyingProcessor = testRunRulesProcessor.getUnderlyingProcessor();
String transformationClass = underlyingProcessor.getTransformationClass();
Map<String, Object> underlyingComponent;
try {
AbstractFluxComponent transformation = ReflectionHelper.newInstance(transformationClass);
Map<String, Object> props = new LinkedHashMap<>();
props.putAll(underlyingProcessor.getConfig().getProperties());
props.put(StormTopologyLayoutConstants.STREAMLINE_COMPONENT_CONF_KEY, testRunRulesProcessor.getUnderlyingProcessor());
// should get rid of below things which is only supported to spout and bolt in flux
props.remove("parallelism");
transformation.withConfig(props);
underlyingComponent = transformation.getComponent();
for (Map<String, Object> dependentComponents : transformation.getReferencedComponents()) {
addToComponents(dependentComponents);
}
addToComponents(underlyingComponent);
return (String) underlyingComponent.get(StormTopologyLayoutConstants.YAML_KEY_ID);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
log.error("Error creating underlying transformation instance", e);
throw new RuntimeException(e);
}
}
Aggregations