Search in sources :

Example 56 with StramLocalCluster

use of com.datatorrent.stram.StramLocalCluster in project apex-malhar by apache.

the class StreamingWordExtractTest method StreamingWordExtractTest.

@Test
public void StreamingWordExtractTest() throws Exception {
    LocalMode lma = LocalMode.newInstance();
    Configuration conf = new Configuration(false);
    setConfig(conf);
    StreamingWordExtract app = new StreamingWordExtract();
    lma.prepareDAG(app, conf);
    LocalMode.Controller lc = lma.getController();
    ((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return getNumOfEventsInStore() == 36;
        }
    });
    lc.run(10000);
    Assert.assertEquals(app.getWordCount(), getNumOfEventsInStore());
    Assert.assertEquals(app.getEntriesMapped(), getNumOfEventsInStore());
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) StramLocalCluster(com.datatorrent.stram.StramLocalCluster) SQLException(java.sql.SQLException) Test(org.junit.Test)

Example 57 with StramLocalCluster

use of com.datatorrent.stram.StramLocalCluster in project apex-malhar by apache.

the class MaxPerKeyExamplesTest method MaxPerKeyExampleTest.

@Test
public void MaxPerKeyExampleTest() throws Exception {
    LocalMode lma = LocalMode.newInstance();
    Configuration conf = new Configuration(false);
    setConfig(conf);
    MaxPerKeyExamples app = new MaxPerKeyExamples();
    lma.prepareDAG(app, conf);
    LocalMode.Controller lc = lma.getController();
    ((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {

        @Override
        public Boolean call() throws Exception {
            return getNumEntries() == 2;
        }
    });
    lc.run(5000);
    double[] result = new double[2];
    result[0] = getMaxMeanTemp().get(6);
    result[1] = getMaxMeanTemp().get(7);
    Assert.assertArrayEquals(MEANTEMPS, result, 0.0);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) LocalMode(com.datatorrent.api.LocalMode) StramLocalCluster(com.datatorrent.stram.StramLocalCluster) SQLException(java.sql.SQLException) Test(org.junit.Test)

Aggregations

StramLocalCluster (com.datatorrent.stram.StramLocalCluster)57 Test (org.junit.Test)46 LocalMode (com.datatorrent.api.LocalMode)21 LogicalPlan (com.datatorrent.stram.plan.logical.LogicalPlan)20 Configuration (org.apache.hadoop.conf.Configuration)19 File (java.io.File)15 AsyncFSStorageAgent (com.datatorrent.common.util.AsyncFSStorageAgent)12 IOException (java.io.IOException)8 DAG (com.datatorrent.api.DAG)6 StreamMeta (com.datatorrent.stram.plan.logical.LogicalPlan.StreamMeta)6 MemoryStorageAgent (com.datatorrent.stram.support.StramTestSupport.MemoryStorageAgent)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 ConstraintViolationException (javax.validation.ConstraintViolationException)5 StreamMeta (com.datatorrent.api.DAG.StreamMeta)4 PartitioningTest (com.datatorrent.stram.PartitioningTest)4 StreamingContainerManagerTest (com.datatorrent.stram.StreamingContainerManagerTest)4 TestGeneratorInputOperator (com.datatorrent.stram.engine.TestGeneratorInputOperator)4 LogicalPlanConfiguration (com.datatorrent.stram.plan.logical.LogicalPlanConfiguration)4 StramTestSupport (com.datatorrent.stram.support.StramTestSupport)4 SQLException (java.sql.SQLException)4