use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class AutoMetricTest method testDefaultMetricsAggregator.
@Test
public void testDefaultMetricsAggregator() throws Exception {
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(new Configuration());
TestGeneratorInputOperator inputOperator = dag.addOperator("input", TestGeneratorInputOperator.class);
CountDownLatch latch = new CountDownLatch(1);
OperatorAndAggregator o1 = dag.addOperator("o1", new OperatorAndAggregator(latch));
dag.setAttribute(Context.OperatorContext.STORAGE_AGENT, new StramTestSupport.MemoryStorageAgent());
dag.addStream("TestTuples", inputOperator.outport, o1.inport1);
lpc.prepareDAG(dag, null, "AutoMetricTest");
LogicalPlan.OperatorMeta o1meta = dag.getOperatorMeta("o1");
Assert.assertNotNull("default aggregator injected", o1meta.getMetricAggregatorMeta().getAggregator());
lpc.prepareDAG(dag, null, "AutoMetricTest");
StramLocalCluster lc = new StramLocalCluster(dag);
lc.runAsync();
latch.await();
Assert.assertEquals("progress", 1, o1.result.get("progress"));
lc.shutdown();
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class ModuleAppTest method validateTestApplication.
@Test
public void validateTestApplication() {
Configuration conf = new Configuration(false);
LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(conf);
LogicalPlan dag = new LogicalPlan();
lpc.prepareDAG(dag, new Application(), "TestApp");
Assert.assertEquals(2, dag.getAllModules().size(), 2);
Assert.assertEquals(5, dag.getAllOperators().size());
Assert.assertEquals(4, dag.getAllStreams().size());
dag.validate();
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method testLoadFromPropertiesFile.
@Test
public void testLoadFromPropertiesFile() throws IOException {
Properties props = new Properties();
String resourcePath = "/testModuleTopology.properties";
InputStream is = this.getClass().getResourceAsStream(resourcePath);
if (is == null) {
throw new RuntimeException("Could not load " + resourcePath);
}
props.load(is);
LogicalPlanConfiguration pb = new LogicalPlanConfiguration(new Configuration(false)).addFromProperties(props, null);
LogicalPlan dag = new LogicalPlan();
pb.populateDAG(dag);
pb.prepareDAG(dag, null, "testApplication");
dag.validate();
validateTopLevelOperators(dag);
validateTopLevelStreams(dag);
validatePublicMethods(dag);
}
use of com.datatorrent.stram.plan.logical.LogicalPlanConfiguration in project apex-core by apache.
the class TestModuleExpansion method testLoadFromJson.
@Test
public void testLoadFromJson() throws Exception {
String resourcePath = "/testModuleTopology.json";
InputStream is = this.getClass().getResourceAsStream(resourcePath);
if (is == null) {
throw new RuntimeException("Could not load " + resourcePath);
}
StringWriter writer = new StringWriter();
IOUtils.copy(is, writer);
JSONObject json = new JSONObject(writer.toString());
Configuration conf = new Configuration(false);
conf.set(StreamingApplication.APEX_PREFIX + "operator.operator3.prop.myStringProperty", "o3StringFromConf");
LogicalPlanConfiguration planConf = new LogicalPlanConfiguration(conf);
LogicalPlan dag = planConf.createFromJson(json, "testLoadFromJson");
planConf.prepareDAG(dag, null, "testApplication");
dag.validate();
validateTopLevelOperators(dag);
validateTopLevelStreams(dag);
validatePublicMethods(dag);
}
Aggregations