Search in sources :

Example 1 with EcoExecutionContext

use of com.twitter.heron.eco.definition.EcoExecutionContext in project incubator-heron by apache.

the class Eco method submit.

public void submit(FileInputStream fileInputStream, FileInputStream propertiesFile, boolean envFilter) throws Exception {
    EcoTopologyDefinition topologyDefinition = ecoParser.parseFromInputStream(fileInputStream, propertiesFile, envFilter);
    String topologyName = topologyDefinition.getName();
    Config topologyConfig = ecoBuilder.buildConfig(topologyDefinition);
    EcoExecutionContext executionContext = new EcoExecutionContext(topologyDefinition, topologyConfig);
    printTopologyInfo(executionContext);
    ObjectBuilder objectBuilder = new ObjectBuilder();
    objectBuilder.setBuilderUtility(new BuilderUtility());
    TopologyBuilder builder = ecoBuilder.buildTopologyBuilder(executionContext, objectBuilder);
    ecoSubmitter.submitTopology(topologyName, topologyConfig, builder.createTopology());
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) Config(com.twitter.heron.api.Config) EcoExecutionContext(com.twitter.heron.eco.definition.EcoExecutionContext) EcoTopologyDefinition(com.twitter.heron.eco.definition.EcoTopologyDefinition) ObjectBuilder(com.twitter.heron.eco.builder.ObjectBuilder) BuilderUtility(com.twitter.heron.eco.builder.BuilderUtility)

Example 2 with EcoExecutionContext

use of com.twitter.heron.eco.definition.EcoExecutionContext in project incubator-heron by apache.

the class EcoBuilderTest method testBuildTopologyBuilder_BuildsAsExpected.

@Test
public void testBuildTopologyBuilder_BuildsAsExpected() throws IllegalAccessException, ClassNotFoundException, InstantiationException, NoSuchFieldException, InvocationTargetException {
    Config config = new Config();
    EcoExecutionContext context = new EcoExecutionContext(ecoTopologyDefinition, config);
    ObjectBuilder objectBuilder = new ObjectBuilder();
    subject.buildTopologyBuilder(context, objectBuilder);
    verify(mockSpoutBuilder).buildSpouts(same(context), any(TopologyBuilder.class), same(objectBuilder));
    verify(mockBoltBuilder).buildBolts(same(context), same(objectBuilder));
    verify(mockStreamBuilder).buildStreams(same(context), any(TopologyBuilder.class), same(objectBuilder));
    verify(mockComponentBuilder).buildComponents(same(context), same(objectBuilder));
}
Also used : TopologyBuilder(org.apache.storm.topology.TopologyBuilder) Config(com.twitter.heron.api.Config) EcoExecutionContext(com.twitter.heron.eco.definition.EcoExecutionContext) Test(org.junit.Test)

Aggregations

Config (com.twitter.heron.api.Config)2 EcoExecutionContext (com.twitter.heron.eco.definition.EcoExecutionContext)2 TopologyBuilder (org.apache.storm.topology.TopologyBuilder)2 BuilderUtility (com.twitter.heron.eco.builder.BuilderUtility)1 ObjectBuilder (com.twitter.heron.eco.builder.ObjectBuilder)1 EcoTopologyDefinition (com.twitter.heron.eco.definition.EcoTopologyDefinition)1 Test (org.junit.Test)1