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());
}
}
Aggregations