use of javax.validation.ConstraintViolationException in project apex-malhar by apache.
the class ApplicationTest method testApplication.
@Test
@Ignore
public void testApplication() throws IOException, Exception {
try {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties-JdbcToJdbcApp.xml"));
lma.prepareDAG(new JdbcToJdbcApp(), conf);
LocalMode.Controller lc = lma.getController();
// runs for 10 seconds and quits
lc.run(50000);
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
use of javax.validation.ConstraintViolationException in project apex-malhar by apache.
the class JdbcPollerApplicationTest method testApplication.
@Test
public void testApplication() throws Exception {
try {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.store.databaseUrl", URL);
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.store.databaseDriver", DB_DRIVER);
conf.setInt("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.partitionCount", 2);
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.key", "ACCOUNT_NO");
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.columnsExpression", "ACCOUNT_NO,NAME,AMOUNT");
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.prop.tableName", TABLE_NAME);
conf.set("dt.application.PollJdbcToHDFSApp.operator.JdbcPoller.port.outputPort.attr.TUPLE_CLASS", "org.apache.apex.examples.JdbcIngest.PojoEvent");
conf.set("dt.application.PollJdbcToHDFSApp.operator.Writer.filePath", OUTPUT_DIR_NAME);
lma.prepareDAG(new JdbcPollerApplication(), conf);
LocalMode.Controller lc = lma.getController();
lc.runAsync();
// wait for output files to roll
Thread.sleep(45000);
String[] extensions = { "dat.0", "tmp" };
Collection<File> list = FileUtils.listFiles(new File(OUTPUT_DIR_NAME), extensions, false);
int recordsCount = 0;
for (File file : list) {
recordsCount += FileUtils.readLines(file).size();
}
Assert.assertEquals("Records in file", 10, recordsCount);
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
use of javax.validation.ConstraintViolationException in project apex-malhar by apache.
the class ApplicationTest method testApplication.
@Test
public void testApplication() throws IOException, Exception {
try {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml"));
conf.set("dt.application.FilterExample.operator.selectedOutput.prop.filePath", outputDir);
conf.set("dt.application.FilterExample.operator.rejectedOutput.prop.filePath", outputDir);
final File selectedfile = FileUtils.getFile(outputDir, "selected.txt_8.0");
final File rejectedfile = FileUtils.getFile(outputDir, "rejected.txt_6.0");
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
if (selectedfile.exists() && rejectedfile.exists()) {
return true;
}
return false;
}
});
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
use of javax.validation.ConstraintViolationException in project apex-malhar by apache.
the class JdbcPojoOperatorApplicationTest method testApplication.
@Test
public void testApplication() throws Exception {
try {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.addResource(this.getClass().getResourceAsStream("/JdbcProperties.xml"));
lma.prepareDAG(new JdbcPojoOperatorApplication(), conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(false);
((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return getNumOfRowsinTable(TABLE_POJO_NAME) == 10;
}
});
// runs for 10 seconds and quits
lc.run(10000);
Assert.assertEquals("rows in db", 10, getNumOfRowsinTable(TABLE_POJO_NAME));
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
use of javax.validation.ConstraintViolationException in project apex-malhar by apache.
the class JdbcInputOperatorApplicationTest method testApplication.
public void testApplication(StreamingApplication streamingApplication) throws Exception {
try {
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.addResource(this.getClass().getResourceAsStream("/JdbcProperties.xml"));
lma.prepareDAG(streamingApplication, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(false);
((StramLocalCluster) lc).setExitCondition(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return TupleCount == 10;
}
});
// runs for 10 seconds and quits
lc.run(10000);
Assert.assertEquals("rows in db", TupleCount, getNumOfRowsinTable(TABLE_POJO_NAME));
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
Aggregations