public void testProcessDeleteAndSchedule() throws Exception {
//Submit process with invalid property so that coord submit fails and bundle goes to failed state
TestContext context = newContext();
Map<String, String> overlay = context.getUniqueOverlay();
String tmpFileName = TestContext.overlayParametersOverTemplate(TestContext.PROCESS_TEMPLATE, overlay);
Process process = (Process) EntityType.PROCESS.getUnmarshaller().unmarshal(new File(tmpFileName));
Property prop = new Property();
prop.setName("newProp");
prop.setValue("${formatTim()}");
process.getProperties().getProperties().add(prop);
File tmpFile = TestContext.getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
context.scheduleProcess(tmpFile.getAbsolutePath(), overlay);
OozieTestUtils.waitForBundleStart(context, Status.FAILED, Status.KILLED);
FalconClient client = new FalconClient(TestContext.BASE_URL);
EntityList deps = client.getDependency(EntityType.PROCESS.name(), process.getName());
for (EntityElement dep : deps.getElements()) {
if (dep.name.equals(process.getInputs().getInputs().get(0).getName())) {
Assert.assertEquals("Input", dep.tag);
} else if (dep.name.equals(process.getOutputs().getOutputs().get(0).getName())) {
Assert.assertEquals("Output", dep.tag);
}
}
//Delete and re-submit the process with correct workflow
ClientResponse clientResponse = context.service
.path("api/entities/delete/process/" + context.processName)
.header("Cookie", context.getAuthenticationToken())
.accept(MediaType.TEXT_XML)
.delete(ClientResponse.class);
context.assertSuccessful(clientResponse);
process.getWorkflow().setPath("/falcon/test/workflow");
tmpFile = TestContext.getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
clientResponse = context.service.path("api/entities/submitAndSchedule/process")
.header("Cookie", context.getAuthenticationToken())
.accept(MediaType.TEXT_XML)