public Void call() throws Exception { String oozieUrl = getContextURL(); OozieClient wc = new OozieClient(oozieUrl); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.USER_NAME, "x"); wc.start(MockDagEngineService.JOB_ID + "1" + MockDagEngineService.JOB_ID_END); assertEquals(RestConstants.JOB_ACTION_START, MockDagEngineService.did); return null; } });
protected String submitWorkflow(final String workflowUri, final OozieClient wfClient) throws OozieClientException { final Properties conf = wfClient.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, workflowUri); conf.setProperty(OozieClient.USER_NAME, getTestUser()); conf.setProperty("appName", "var-app-name"); final String jobId = wfClient.submit(conf); wfClient.start(jobId); return jobId; }
wfClient.start(jobId1); waitFor(120 * 1000, new Predicate() { public boolean evaluate() throws Exception {
wfClient.start(jobId1); waitFor(15 * 1000, new Predicate() { public boolean evaluate() throws Exception {
wfClient.start(jobId1);
newConf.setProperty("base", path.toUri().getPath()); final String jobId = wfClient.submit(conf); wfClient.start(jobId); waitFor(15 * 1000, new Predicate() { public boolean evaluate() throws Exception {
wfClient.start(jobId1); waitFor(15 * 1000, new Predicate() { public boolean evaluate() throws Exception {
private void launchJavaActionAndValidateSharelibValues(String globalConfig, String localConfig, String oozieSharelibForJavaPropertyValue, String oozieSharelibPropertyValue) throws Exception { final String workflowUri = helper.createTestWorkflowXml(globalConfig, helper.getJavaActionXml(localConfig)); final OozieClient wfClient = LocalOozie.getClient(); final Properties conf = wfClient.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, workflowUri); conf.setProperty(OozieClient.USER_NAME, getTestUser()); conf.setProperty("appName", "var-app-name"); conf.setProperty(OozieClient.USE_SYSTEM_LIBPATH, "true"); final String jobId = wfClient.submit(conf); wfClient.start(jobId); WorkflowJob workflow = wfClient.getJobInfo(jobId); waitFor(20 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { WorkflowAction javaAction = helper.getJavaAction(wfClient.getJobInfo(jobId)); return javaAction != null && !javaAction.getStatus().equals("PREP"); } }); final XConfiguration actionConf = getJavaActionConfiguration(workflow); assertThat("Configuration priorities are incorrect! Global/local configs are not overwriting each other.", actionConf.get(LauncherAM.OOZIE_LAUNCHER_SHARELIB_PROPERTY), is(oozieSharelibPropertyValue)); assertThat("Configuration priorities are incorrect! Global/local configs are not overwriting each other.", actionConf.get("oozie.action.sharelib.for.java"), is(oozieSharelibForJavaPropertyValue)); }
assertEquals(WorkflowJob.Status.PREP, wf.getStatus()); wc.start(jobId);
wfClient.start(jobId1); waitFor(15 * 1000, new Predicate() { public boolean evaluate() throws Exception {
assertEquals(true, dateTest); wc.start(jobId); wf = wc.getJobInfo(jobId);
public void testGlobalConfigurationWithActionDefaults() throws Exception { try { String workflowUri = helper.createTestWorkflowXml(getWorkflowGlobalXml(), helper.getJavaActionXml("")); LocalOozie.start(); final OozieClient wfClient = LocalOozie.getClient(); Properties conf = wfClient.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, workflowUri); conf.setProperty(OozieClient.USER_NAME, getTestUser()); conf.setProperty("appName", "var-app-name"); final String jobId = wfClient.submit(conf); wfClient.start(jobId); WorkflowJob workflow = wfClient.getJobInfo(jobId); waitFor(20 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { WorkflowAction javaAction = helper.getJavaAction(wfClient.getJobInfo(jobId)); return javaAction != null && !javaAction.getStatus().equals("PREP"); } }); final WorkflowAction workflowAction = helper.getJavaAction(workflow); Element eConf = XmlUtils.parseXml(workflowAction.getConf()); Element element = eConf.getChild("configuration", eConf.getNamespace()); Configuration actionConf = new XConfiguration(new StringReader(XmlUtils.prettyPrint(element).toString())); assertEquals("Config value set in <global> section is not propagated correctly", "foo2", actionConf.get("action.foo")); } finally { LocalOozie.stop(); } }
conf.setProperty("foo", "other"); final String jobId = wfClient.submit(conf); wfClient.start(jobId);
conf.setProperty("appName", "var-app-name"); final String jobId = wfClient.submit(conf); wfClient.start(jobId);
oc.start(jobId); checkSuspendActions(wf, oc, jobId, WorkflowJob.Status.SUSPENDED, new String[]{"action1"},
wfClient.start(jobId1); waitFor(200 * 1000, new Predicate() { @Override
assertEquals(WorkflowJob.Status.PREP, wf.getStatus()); oc.start(jobId); checkSuspendActions(wf, oc, jobId, WorkflowJob.Status.SUSPENDED, new String[]{"action1"},
conf.setProperty(OozieClient.USER_NAME, getTestUser()); final String jobId0 = wfClient.submit(conf); wfClient.start(jobId0);
conf.setProperty("appName", "var-app-name"); final String jobId = wfClient.submit(conf); wfClient.start(jobId);
public void testResourceManagerInGlobalConfigurationCanBeOverridenWithJobTrackerInAction() throws Exception { try { final String global = "<global>" + "<resource-manager>RM</resource-manager>"+ "</global>"; final String workflowUri = helper.createTestWorkflowXml(global, helper.getJavaActionXml("")); LocalOozie.start(); final OozieClient wfClient = LocalOozie.getClient(); final Properties conf = wfClient.createConfiguration(); conf.setProperty(OozieClient.APP_PATH, workflowUri); conf.setProperty(OozieClient.USER_NAME, getTestUser()); conf.setProperty("appName", "var-app-name"); final String jobId = wfClient.submit(conf); wfClient.start(jobId); WorkflowJob workflow = wfClient.getJobInfo(jobId); waitFor(20 * 1000, new Predicate() { @Override public boolean evaluate() throws Exception { WorkflowAction javaAction = helper.getJavaAction(wfClient.getJobInfo(jobId)); return javaAction != null && !javaAction.getStatus().equals("PREP"); } }); final WorkflowAction workflowAction = helper.getJavaAction(workflow); final String actualConfig = workflowAction.getConf(); final String actualJobTrackerURI = XmlUtils.parseXml(actualConfig).getChildTextNormalize("job-tracker", null); assertEquals(getJobTrackerUri(), actualJobTrackerURI); } finally { LocalOozie.stop(); } }