writer.write("hello");
writer.close();
Path outputDir = new Path(getFsTestCaseDir(), "output");
XConfiguration jobConf = new XConfiguration();
jobConf.set("user.name", getTestUser());
jobConf.set("group.name", getTestGroup());
jobConf.setInt("mapred.map.tasks", 1);
jobConf.setInt("mapred.map.max.attempts", 1);
jobConf.setInt("mapred.reduce.max.attempts", 1);
jobConf.set("mapred.job.tracker", getJobTrackerUri());
jobConf.set("fs.default.name", getNameNodeUri());
jobConf.set("mapreduce.framework.name", "yarn");
// option to specify whether stats should be stored or not
jobConf.set("oozie.action.external.stats.write", Boolean.toString(writeStats));
SharelibUtils.addToDistributedCache("pig", fs, getFsTestCaseDir(), jobConf);
PigMain.setPigScript(jobConf, script.toString(), new String[] { "IN=" + inputDir.toUri().getPath(),
"OUT=" + outputDir.toUri().getPath() }, new String[] { "-v" });
File actionXml = new File(getTestCaseDir(), "action.xml");
OutputStream os = new FileOutputStream(actionXml);
jobConf.writeXml(os);
os.close();
File statsDataFile = new File(getTestCaseDir(), "statsdata.properties");
File hadoopIdsFile = new File(getTestCaseDir(), "hadoopIds.properties");
setSystemProperty("oozie.launcher.job.id", "" + System.currentTimeMillis());
setSystemProperty("oozie.action.conf.xml", actionXml.getAbsolutePath());
setSystemProperty("oozie.action.stats.properties", statsDataFile.getAbsolutePath());
setSystemProperty("oozie.action.externalChildIDs.properties", hadoopIdsFile.getAbsolutePath());
URL url = Thread.currentThread().getContextClassLoader().getResource("PigMain.txt");
File classPathDir = new File(url.getPath()).getParentFile();
assertTrue(classPathDir.exists());
Properties props = jobConf.toProperties();
assertEquals(props.getProperty("oozie.pig.args.size"), "1");
File pigProps = new File(classPathDir, "pig.properties");
new LauncherSecurityManager();
String user = System.getProperty("user.name");