private void _testDataNotSet(String avoidParam, String expActionErrorCode) throws Exception {
Reader reader = IOUtils.getResourceAsReader("wf-ext-schema-valid.xml", -1);
Writer writer = new FileWriter(getTestCaseDir() + "/workflow.xml");
IOUtils.copyCharStream(reader, writer);
final DagEngine engine = new DagEngine("u", "a");
Configuration conf = new XConfiguration();
conf.set(OozieClient.APP_PATH, getTestCaseDir() + File.separator + "workflow.xml");
conf.set(OozieClient.USER_NAME, getTestUser());
conf.set(OozieClient.GROUP_NAME, getTestGroup());
injectKerberosInfo(conf);
conf.set(OozieClient.LOG_TOKEN, "t");
conf.set("external-status", "ok");
conf.set("signal-value", "based_on_action_status");
conf.set(avoidParam, "true");
final String jobId = engine.submitJob(conf, true);
final WorkflowStore store = Services.get().get(WorkflowStoreService.class).create();
store.beginTrx();
Thread.sleep(2000);
waitFor(5000, new Predicate() {
public boolean evaluate() throws Exception {
WorkflowJobBean bean = store.getWorkflow(jobId, false);
return (bean.getWorkflowInstance().getStatus() == WorkflowInstance.Status.FAILED);
}
});
store.commitTrx();
store.closeTrx();
final WorkflowStore store2 = Services.get().get(WorkflowStoreService.class).create();
store2.beginTrx();
assertEquals(WorkflowInstance.Status.FAILED, store2.getWorkflow(jobId, false).getWorkflowInstance().getStatus());
assertEquals(WorkflowJob.Status.FAILED, engine.getJob(jobId).getStatus());
List<WorkflowActionBean> actions = store2.getActionsForWorkflow(jobId, false);
WorkflowActionBean action = actions.get(0);
assertEquals(expActionErrorCode, action.getErrorCode());
store2.commitTrx();