Search in sources :

Example 26 with StreamingApplication

use of com.datatorrent.api.StreamingApplication in project apex-malhar by apache.

the class WindowedOperatorBenchmarkAppTest method test.

@Test
public void test() throws Exception {
    Configuration conf = new Configuration(false);
    LocalMode lma = LocalMode.newInstance();
    DAG dag = lma.getDAG();
    super.populateDAG(dag, conf);
    StreamingApplication app = new StreamingApplication() {

        @Override
        public void populateDAG(DAG dag, Configuration conf) {
        }
    };
    lma.prepareDAG(app, conf);
    // Create local cluster
    final LocalMode.Controller lc = lma.getController();
    lc.run(3000000);
    lc.shutdown();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) DAG(com.datatorrent.api.DAG) StreamingApplication(com.datatorrent.api.StreamingApplication) Test(org.junit.Test)

Example 27 with StreamingApplication

use of com.datatorrent.api.StreamingApplication in project apex-malhar by apache.

the class TestNiFiOutputApplication method main.

public static void main(String[] args) throws Exception {
    StreamingApplication app = new TestNiFiOutputApplication();
    LocalMode.runApp(app, new Configuration(false), 10000);
    Thread.sleep(2000);
    System.exit(0);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) StreamingApplication(com.datatorrent.api.StreamingApplication)

Example 28 with StreamingApplication

use of com.datatorrent.api.StreamingApplication in project apex-malhar by apache.

the class SliceBloomFilterTest method testBloomFilterForApplication.

/**
 * Just test SliceBloomFilter can be used by operator. such as it is serializable etc
 * @throws Exception
 */
@Test
public void testBloomFilterForApplication() throws Exception {
    Configuration conf = new Configuration(false);
    LocalMode lma = LocalMode.newInstance();
    DAG dag = lma.getDAG();
    TestInputOperator generator = new TestInputOperator();
    dag.addOperator("Generator", generator);
    FilterOperator filterOperator = new FilterOperator();
    dag.addOperator("filterOperator", filterOperator);
    dag.addStream("Data", generator.data, filterOperator.input).setLocality(Locality.CONTAINER_LOCAL);
    StreamingApplication app = new StreamingApplication() {

        @Override
        public void populateDAG(DAG dag, Configuration conf) {
        }
    };
    lma.prepareDAG(app, conf);
    // Create local cluster
    final LocalMode.Controller lc = lma.getController();
    lc.run(3000);
    lc.shutdown();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) DAG(com.datatorrent.api.DAG) StreamingApplication(com.datatorrent.api.StreamingApplication) Test(org.junit.Test)

Example 29 with StreamingApplication

use of com.datatorrent.api.StreamingApplication in project apex-malhar by apache.

the class SmtpOutputOperatorTest method testProperties.

@Test
public void testProperties() throws Exception {
    Configuration conf = new Configuration(false);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.subject", subject);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.content", content);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.from", from);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.smtpHost", "127.0.0.1");
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.smtpUserName", from);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.smtpPassword", "<password>");
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.recipients.TO", to + "," + cc);
    conf.set(StreamingApplication.DT_PREFIX + "operator.o1.prop.recipients.CC", cc);
    final AtomicReference<SmtpOutputOperator> o1 = new AtomicReference<SmtpOutputOperator>();
    StreamingApplication app = new StreamingApplication() {

        @Override
        public void populateDAG(DAG dag, Configuration conf) {
            o1.set(dag.addOperator("o1", new SmtpOutputOperator()));
        }
    };
    LocalMode lma = LocalMode.newInstance();
    lma.prepareDAG(app, conf);
    Assert.assertEquals("checking TO list", to + "," + cc, o1.get().getRecipients().get("TO"));
    Assert.assertEquals("checking CC list", cc, o1.get().getRecipients().get("CC"));
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) AtomicReference(java.util.concurrent.atomic.AtomicReference) StreamingApplication(com.datatorrent.api.StreamingApplication) DAG(com.datatorrent.api.DAG) Test(org.junit.Test) ServerSetupTest(com.icegreen.greenmail.util.ServerSetupTest)

Aggregations

StreamingApplication (com.datatorrent.api.StreamingApplication)29 Configuration (org.apache.hadoop.conf.Configuration)28 Test (org.junit.Test)23 DAG (com.datatorrent.api.DAG)21 LocalMode (com.datatorrent.api.LocalMode)11 Properties (java.util.Properties)10 Integer2String (com.datatorrent.api.StringCodec.Integer2String)8 AttributeMap (com.datatorrent.api.Attribute.AttributeMap)3 GenericTestOperator (com.datatorrent.stram.engine.GenericTestOperator)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Attribute (com.datatorrent.api.Attribute)2 OperatorMeta (com.datatorrent.stram.plan.logical.LogicalPlan.OperatorMeta)2 OutputPortMeta (com.datatorrent.stram.plan.logical.LogicalPlan.OutputPortMeta)2 StreamMeta (com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta)2 LogicalPlanConfiguration (com.datatorrent.stram.plan.logical.LogicalPlanConfiguration)2 File (java.io.File)2 Map (java.util.Map)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 AppHandle (org.apache.apex.api.Launcher.AppHandle)2 StreamingAppFactory (org.apache.apex.engine.util.StreamingAppFactory)2