Search in sources :

Example 1 with EmbeddedAppLauncherImpl

use of org.apache.apex.engine.EmbeddedAppLauncherImpl in project apex-malhar by apache.

the class AvroFileToPojoModuleTest method testAvroToPojoModule.

@Test
public void testAvroToPojoModule() throws Exception {
    try {
        FileContext.getLocalFSFileContext().delete(new Path(new File(testMeta.dir).getAbsolutePath()), true);
        int cnt = 7;
        createAvroInput(cnt);
        writeAvroFile(new File(FILENAME));
        createAvroInput(cnt - 2);
        writeAvroFile(new File(OTHER_FILE));
        avroFileToPojoModule.setAvroFileDirectory(testMeta.dir);
        avroFileToPojoModule.setPojoClass(SimpleOrder.class);
        AvroToPojo avroToPojo = new AvroToPojo();
        avroToPojo.setPojoClass(SimpleOrder.class);
        EmbeddedAppLauncherImpl lma = new EmbeddedAppLauncherImpl();
        Configuration conf = new Configuration(false);
        AvroToPojoApplication avroToPojoApplication = new AvroToPojoApplication();
        avroToPojoApplication.setAvroFileToPojoModule(avroFileToPojoModule);
        lma.prepareDAG(avroToPojoApplication, conf);
        EmbeddedAppLauncherImpl.Controller lc = lma.getController();
        // runs for 10 seconds and quits
        lc.run(10000);
    } catch (ConstraintViolationException e) {
        Assert.fail("constraint violations: " + e.getConstraintViolations());
    }
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) ConstraintViolationException(javax.validation.ConstraintViolationException) EmbeddedAppLauncherImpl(org.apache.apex.engine.EmbeddedAppLauncherImpl) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 EmbeddedAppLauncherImpl (org.apache.apex.engine.EmbeddedAppLauncherImpl)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 Test (org.junit.Test)1