本文整理汇总了Java中com.datatorrent.api.LocalMode.prepareDAG方法的典型用法代码示例。如果您正苦于以下问题:Java LocalMode.prepareDAG方法的具体用法?Java LocalMode.prepareDAG怎么用?Java LocalMode.prepareDAG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.datatorrent.api.LocalMode
的用法示例。
在下文中一共展示了LocalMode.prepareDAG方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@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-test.xml"));
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
lc.run(5000);
// get messages from Kafka topic and compare with input
chkOutput();
lc.shutdown();
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
示例2: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testApplication() throws IOException, 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));
avroFileInput.setDirectory(testMeta.dir);
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
AvroReaderApplication avroReaderApplication = new AvroReaderApplication();
avroReaderApplication.setAvroFileInputOperator(avroFileInput);
lma.prepareDAG(avroReaderApplication, conf);
LocalMode.Controller lc = lma.getController();
lc.run(10000);// runs for 10 seconds and quits
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
示例3: testS3FixedWidthRecords
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testS3FixedWidthRecords() throws Exception
{
S3FixedWidthApplication app = new S3FixedWidthApplication();
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.set("dt.operator.S3RecordReaderModule.prop.files", files);
conf.set("dt.operator.S3RecordReaderModule.prop.recordLength", "8");
conf.set("dt.operator.S3RecordReaderModule.prop.blocksThreshold", "1");
conf.set("dt.operator.S3RecordReaderModule.prop.scanIntervalMillis", "10000");
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(true);
lc.runAsync();
LOG.debug("Waiting for app to finish");
Thread.sleep(1000 * 1);
lc.shutdown();
}
示例4: testFixedWidthRecords
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testFixedWidthRecords() throws Exception
{
FixedWidthApplication app = new FixedWidthApplication();
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.set("dt.operator.HDFSRecordReaderModule.prop.files", inputDir);
conf.set("dt.operator.HDFSRecordReaderModule.prop.recordLength", "8");
conf.set("dt.operator.HDFSRecordReaderModule.prop.blocksThreshold", "1");
conf.set("dt.operator.HDFSRecordReaderModule.prop.scanIntervalMillis", "10000");
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(true);
lc.runAsync();
LOG.debug("Waiting for app to finish");
Thread.sleep(1000 * 1);
lc.shutdown();
}
示例5: testCouchBaseAppInput
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testCouchBaseAppInput() throws FileNotFoundException, IOException
{
Configuration conf = new Configuration();
InputStream is = new FileInputStream("src/site/conf/dt-site-couchbase.xml");
conf.addResource(is);
conf.get("dt.application.CouchBaseAppInput.operator.couchbaseInput.store.uriString");
conf.get("dt.application.CouchBaseAppInput.operator.couchbaseInput.store.blocktime");
conf.get("dt.application.CouchBaseAppInput.operator.couchbaseInput.store.timeout");
conf.get("dt.application.CouchBaseAppInput.operator.couchbaseInput.store.bucket");
conf.get("dt.application.CouchBaseAppInput.operator.couchbaseInput.store.password");
LocalMode lm = LocalMode.newInstance();
try {
lm.prepareDAG(new CouchBaseAppInput(), conf);
LocalMode.Controller lc = lm.getController();
lc.run(20000);
} catch (Exception ex) {
logger.info(ex.getCause());
}
is.close();
}
示例6: testFilterClassifierApp
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testFilterClassifierApp() throws FileNotFoundException, IOException
{
Logger logger = LoggerFactory.getLogger(FilteredEventClassifierAppTest.class);
LocalMode lm = LocalMode.newInstance();
Configuration conf = new Configuration();
InputStream is = new FileInputStream("src/site/conf/dt-site-testbench.xml");
conf.addResource(is);
conf.get("dt.application.FilteredEventClassifierApp.operator.hmapOper.keys");
conf.get("dt.application.FilteredEventClassifierApp.operator.hmapOper.numKeys");
try {
lm.prepareDAG(new FilteredEventClassifierApp(), conf);
LocalMode.Controller lc = lm.getController();
lc.run(20000);
} catch (Exception ex) {
logger.info(ex.getMessage());
}
is.close();
}
示例7: CombinePerKeyExamplesTest
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void CombinePerKeyExamplesTest() throws Exception
{
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.set("dt.application.CombinePerKeyExamples.operator.console.silent", "true");
CombinePerKeyExamples app = new CombinePerKeyExamples();
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
return CombinePerKeyExamples.Collector.isDone();
}
});
lc.run(100000);
Assert.assertTrue(CombinePerKeyExamples.Collector.getResult().get(CombinePerKeyExamples.Collector.getResult().size() - 2).getCorpus().contains("1, 2, 3, 4, 5, 6, 7, 8"));
}
示例8: testFixedWidthRecords
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testFixedWidthRecords() throws Exception
{
FixedWidthApplication app = new FixedWidthApplication();
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
conf.set("dt.operator.S3RecordReaderModuleMock.prop.files", inputDir);
conf.set("dt.operator.S3RecordReaderModuleMock.prop.recordLength", "8");
conf.set("dt.operator.S3RecordReaderModuleMock.prop.blockSize", "3");
conf.set("dt.operator.S3RecordReaderModuleMock.prop.blocksThreshold", "1");
conf.set("dt.operator.S3RecordReaderModuleMock.prop.scanIntervalMillis", "10000");
lma.prepareDAG(app, conf);
LocalMode.Controller lc = lma.getController();
lc.setHeartbeatMonitoringEnabled(true);
lc.runAsync();
LOG.debug("Waiting for app to finish");
Thread.sleep(1000 * 1);
lc.shutdown();
}
示例9: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
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;
}
});
lc.run(10000);// runs for 10 seconds and quits
Assert.assertEquals("rows in db", TupleCount, getNumOfRowsinTable(TABLE_POJO_NAME));
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
示例10: testBenchmark
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testBenchmark() throws FileNotFoundException
{
Configuration conf = new Configuration();
InputStream is = new FileInputStream("src/site/conf/dt-site-kafka.xml");
conf.addResource(is);
LocalMode lma = LocalMode.newInstance();
try {
lma.prepareDAG(new KafkaInputBenchmark(), conf);
LocalMode.Controller lc = lma.getController();
lc.run(30000);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
示例11: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@Test
public void testApplication() throws Exception
{
LocalMode lma = LocalMode.newInstance();
Configuration conf = new Configuration(false);
lma.prepareDAG(new PojoInnerJoinTestApplication(), conf);
LocalMode.Controller lc = lma.getController();
((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
return SalesCount == 1 && ProductCount == 1 && records == 2;
}
});
lc.run(20000);
Assert.assertEquals(2,records);
}
示例12: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@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-test.xml"));
conf.set("dt.operator.fileOutput.prop.filePath", outputDir);
File outputfile = FileUtils.getFile(outputDir, "output.txt_7.0");
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
lc.runAsync();
// wait for tuples to show up
while (!outputfile.exists()) {
System.out.println("Waiting for tuples ....");
Thread.sleep(1000);
}
Assert.assertTrue(
FileUtils.contentEquals(FileUtils.getFile("src/test/resources/test_event_data_transformed.txt"), outputfile));
lc.shutdown();
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}
示例13: asyncRun
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
private LocalMode.Controller asyncRun(Configuration conf) throws Exception
{
LocalMode lma = LocalMode.newInstance();
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
lc.runAsync();
return lc;
}
示例14: asyncRun
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
private LocalMode.Controller asyncRun(Configuration conf) throws Exception
{
LocalMode lma = LocalMode.newInstance();
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
lc.runAsync();
return lc;
}
示例15: testApplication
import com.datatorrent.api.LocalMode; //导入方法依赖的package包/类
@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-test.xml"));
conf.set("dt.operator.fileOutput.prop.filePath", outputDir);
File outputfile = FileUtils.getFile(outputDir, "output.txt_5.0");
lma.prepareDAG(new Application(), conf);
LocalMode.Controller lc = lma.getController();
lc.runAsync();
// wait for tuples to show up
while (!outputfile.exists()) {
System.out.println("Waiting for tuples ....");
Thread.sleep(1000);
}
lc.shutdown();
Assert.assertTrue(
FileUtils.contentEquals(FileUtils.getFile("src/test/resources/test_event_data.txt"), outputfile));
} catch (ConstraintViolationException e) {
Assert.fail("constraint violations: " + e.getConstraintViolations());
}
}