List of usage examples for org.apache.hadoop.conf Configuration addResource
public void addResource(Configuration conf)
From source file:org.apache.apex.benchmark.testbench.EventClassifierAppTest.java
License:Apache License
@Test public void testEventClassifierApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(EventClassifierAppTest.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.EventClassifierApp.operator.hmapOper.keys"); conf.get("dt.application.EventClassifierApp.operator.hmapOper.numKeys"); try {//from www.ja v a 2 s . c o m lm.prepareDAG(new EventClassifierApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.EventClassifierNumberToHashDoubleAppTest.java
License:Apache License
@Test public void testEventClassifierNumberToHashDoubleApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(EventClassifierNumberToHashDoubleAppTest.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.EventClassifierNumberToHashDoubleApp.operator.eventClassify.key_keys"); conf.get("dt.application.EventClassifierNumberToHashDoubleApp.operator.eventClassify.s_start"); conf.get("dt.application.EventClassifierNumberToHashDoubleApp.operator.eventClassify.s_end"); try {//from w ww.ja v a2s . c o m lm.prepareDAG(new EventClassifierNumberToHashDoubleApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.EventGeneratorAppTest.java
License:Apache License
@Test public void testEventGeneratorApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(EventGeneratorAppTest.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.EventGeneratorApp.operator.eventGenerator.keysHelper"); conf.get("dt.application.EventGeneratorApp.operator.eventGenerator.weightsHelper"); conf.get("dt.application.EventGeneratorApp.operator.eventGenerator.valuesHelper"); try {/*from w w w.ja va2 s . c o m*/ lm.prepareDAG(new EventGeneratorApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.EventIncrementerAppTest.java
License:Apache License
@Test public void testEventIncrementerApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(EventIncrementerAppTest.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.EventIncrementerApp.operator.hmapOper.seed"); conf.get("dt.application.EventIncrementerApp.operator.hmapOper.keys"); conf.get("dt.application.EventIncrementerApp.operator.hmapOper.numKeys"); try {//from w w w.ja v a 2s. c om lm.prepareDAG(new EventIncrementerApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.FilterClassifierAppTest.java
License:Apache License
@Test public void testFilterClassifierApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(FilterClassifierAppTest.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.FilterClassifier.operator.hmapOper.keys"); conf.get("dt.application.FilterClassifier.operator.hmapOper.numKeys"); try {/*ww w . j av a 2s . c o m*/ lm.prepareDAG(new FilterClassifierApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.FilteredEventClassifierAppTest.java
License:Apache License
@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 {//from ww w . j ava 2s .c om lm.prepareDAG(new FilteredEventClassifierApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.benchmark.testbench.ThroughputCounterAppTest.java
License:Apache License
@Test public void testThroughputCounterApp() throws FileNotFoundException, IOException { Logger logger = LoggerFactory.getLogger(ThroughputCounterAppTest.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.ThroughputCounterApp.operator.hmapOper.keys"); conf.get("dt.application.ThroughputCounterApp.operator.hmapOper.numKeys"); try {/*from ww w. ja va 2 s .c om*/ lm.prepareDAG(new ThroughputCounterApp(), conf); LocalMode.Controller lc = lm.getController(); lc.run(20000); } catch (Exception ex) { logger.info(ex.getMessage()); } is.close(); }
From source file:org.apache.apex.engine.plugin.AbstractApexPluginDispatcher.java
License:Apache License
private Configuration readLaunchConfiguration() throws IOException { Path appPath = new Path(appContext.getApplicationPath()); Path configFilePath = new Path(appPath, LogicalPlan.LAUNCH_CONFIG_FILE_NAME); try {//from w ww . j ava 2 s. c o m LOG.debug("Reading launch configuration file "); URI uri = appPath.toUri(); Configuration config = new YarnConfiguration(); fileContext = uri.getScheme() == null ? FileContext.getFileContext(config) : FileContext.getFileContext(uri, config); FSDataInputStream is = fileContext.open(configFilePath); config.addResource(is); LOG.debug("Read launch configuration"); return config; } catch (FileNotFoundException ex) { LOG.warn("Configuration file not found {}", configFilePath); return new Configuration(); } }
From source file:org.apache.apex.examples.csvformatter.ApplicationTest.java
License:Apache License
@Test public void testApplication() throws Exception { try {//from w ww. ja v a 2s . c o m LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); // wait for output files to roll Thread.sleep(5000); String[] extensions = { "dat.0", "tmp" }; Collection<File> list = FileUtils.listFiles(new File(FILE_NAME), extensions, false); for (File file : list) { for (String line : FileUtils.readLines(file)) { Assert.assertEquals("Delimiter in record", true, (line.equals("1234|0|SimpleCsvFormatterExample|10000.0|||APEX|false|false||"))); } } } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
From source file:org.apache.apex.examples.dynamic.ApplicationTest.java
License:Apache License
@Test public void testApplication() throws IOException, Exception { try {/*from w w w . j a v a 2 s .c o m*/ LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); lma.prepareDAG(new App(), conf); LocalMode.Controller lc = lma.getController(); lc.run(10000); // runs for 10 seconds and quits } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }