TestContext context = newContext();
context.scheduleProcess();
context.waitForBundleStart(Job.Status.RUNNING);
List<BundleJob> bundles = context.getBundles();
Assert.assertEquals(bundles.size(), 1);
OozieClient ozClient = context.getOozieClient();
String coordId = ozClient.getBundleJobInfo(bundles.get(0).getId()).getCoordinators().get(0).getId();
ClientResponse response = context.service.path("api/entities/definition/process/"
+ context.processName).header(
"Remote-User", TestContext.REMOTE_USER)
.accept(MediaType.TEXT_XML).get(ClientResponse.class);
Process process = (Process) EntityType.PROCESS.getUnmarshaller()
.unmarshal(new StringReader(response.getEntity(String.class)));
String feed3 = "f3" + System.currentTimeMillis();
Map<String, String> overlay = new HashMap<String, String>();
overlay.put("inputFeedName", feed3);
overlay.put("cluster", context.clusterName);
response = context.submitToFalcon(TestContext.FEED_TEMPLATE1, overlay, EntityType.FEED);
context.assertSuccessful(response);
Input input = new Input();
input.setFeed(feed3);
input.setName("inputData2");
input.setStart("today(20,0)");
input.setEnd("today(20,20)");
process.getInputs().getInputs().add(input);
Validity processValidity = process.getClusters().getClusters().get(0).getValidity();
processValidity.setEnd(new Date(new Date().getTime() + 2 * 24 * 60 * 60 * 1000));
File tmpFile = context.getTempFile();
EntityType.PROCESS.getMarshaller().marshal(process, tmpFile);
response = context.service.path("api/entities/update/process/"
+ context.processName).header("Remote-User",
TestContext.REMOTE_USER).accept(MediaType.TEXT_XML)
.post(ClientResponse.class, context.getServletInputStream(tmpFile.getAbsolutePath()));
context.assertSuccessful(response);
//Assert that update creates new bundle and old coord is running
bundles = context.getBundles();
Assert.assertEquals(bundles.size(), 2);
Assert.assertEquals(ozClient.getCoordJobInfo(coordId).getStatus(), Status.RUNNING);
}