Source:
<code>public static void waitTillRetentionSucceeded(ColoHelper coloHelper, Bundle b, List <org.apache.oozie.client.CoordinatorAction.Status> expectedStatus, int instanceNumber, int MinutesToWaitForCoordAction, int MinutesToWaitForStatus) throws Exception{ String entityName = Util.getInputFeedNameFromBundle(b); boolean flag = false; int sleep1 = MinutesToWaitForStatus * 60 / 20; int sleep2 = MinutesToWaitForCoordAction * 60 / 20; String bundleID = getLatestBundleID(coloHelper, entityName, ENTITY_TYPE.FEED); String coordID = getRetentionCoordID(bundleID, coloHelper.getFeedHelper()); CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient().getCoordJobInfo(coordID); for(int waitForCoord=0; waitForCoord<sleep2 ; ++waitForCoord){ if(coordInfo.getActions().size() > 0) break; logger.info("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } if(coordInfo.getActions().size()==0){ logger.info("Oozie actions not created for the entire wait duration."); <START> System.exit(0); <END> } for (int sleepCount = 0; sleepCount < sleep1; sleepCount++) { List<org.apache.oozie.client.CoordinatorAction.Status> statusList = new ArrayList<org.apache.oozie.client.CoordinatorAction.Status>(); for (int count = 0; count < coordInfo.getActions().size(); count++){ statusList.add(coordInfo.getActions().get(count).getStatus()); } for(int i=0; i<expectedStatus.size(); ++i){ if (statusList.get(instanceNumber).equals(expectedStatus.get(i))){ flag=true; break; } } if(flag){ break; } try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }</code><technical_language>System.exit stop jvm testing. Assert.fail();</technical_language>

Target:
public static void waitTillRetentionSucceeded(ColoHelper coloHelper, Bundle b, List <org.apache.oozie.client.CoordinatorAction.Status> expectedStatus, int instanceNumber, int MinutesToWaitForCoordAction, int MinutesToWaitForStatus) throws Exception{ String entityName = Util.getInputFeedNameFromBundle(b); boolean flag = false; int sleep1 = MinutesToWaitForStatus * 60 / 20; int sleep2 = MinutesToWaitForCoordAction * 60 / 20; String bundleID = getLatestBundleID(coloHelper, entityName, ENTITY_TYPE.FEED); String coordID = getRetentionCoordID(bundleID, coloHelper.getFeedHelper()); CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient().getCoordJobInfo(coordID); for(int waitForCoord=0; waitForCoord<sleep2 ; ++waitForCoord){ if(coordInfo.getActions().size() > 0) break; logger.info("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } if(coordInfo.getActions().size()==0){ logger.info("Oozie actions not created for the entire wait duration."); Assert.fail(); } for (int sleepCount = 0; sleepCount < sleep1; sleepCount++) { List<org.apache.oozie.client.CoordinatorAction.Status> statusList = new ArrayList<org.apache.oozie.client.CoordinatorAction.Status>(); for (int count = 0; count < coordInfo.getActions().size(); count++){ statusList.add(coordInfo.getActions().get(count).getStatus()); } for(int i=0; i<expectedStatus.size(); ++i){ if (statusList.get(instanceNumber).equals(expectedStatus.get(i))){ flag=true; break; } } if(flag){ return; } try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }