Source:
protected boolean isJaggeryAppDeployed(String appName) throws LazyLoadingTestException { int deploymentDelay = 90 * 1000; log.info("waiting " + deploymentDelay + " millis for Service deployment " + appName); WebAppAdminClient webAppAdminClient; try { webAppAdminClient = new WebAppAdminClient(backendURL, sessionCookie); } catch (AxisFault axisFault) { String customErrorMessage = "AxisFault Exception when creating WebAppAdminClient object. backend URL:" + backendURL + " Session Cookie: " + sessionCookie + "\n" + axisFault.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, axisFault); } List<String> webAppList; List<String> faultyWebAppList; boolean isWebAppDeployed = false; Calendar startTime = Calendar.getInstance(); long time; boolean doLoop = true; while (((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) < deploymentDelay) && doLoop) { try { webAppList = webAppAdminClient.getWebApplist(appName); faultyWebAppList = webAppAdminClient.getFaultyWebAppList(appName); } catch (RemoteException remoteException) { String customErrorMessage = "remoteException Exception when calling methods in WebAppAdminClient\n" + remoteException.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, remoteException); } for (String faultWebAppName : faultyWebAppList) { if (faultWebAppName.equalsIgnoreCase(appName)) { isWebAppDeployed = false; log.info(appName + "- Jaggery Application is faulty"); doLoop = false; } } for (String name : webAppList) { if (name.equalsIgnoreCase(appName)) { isWebAppDeployed = true; log.info(appName + " Jaggery Application deployed in " + time + " millis"); doLoop = false; } } try { Thread.sleep(500); } catch (InterruptedException interruptedException) { String customErrorMessage = "InterruptedException occurs when sleeping 1000 milliseconds and while" + " waiting for Jaggery Application to get deployed " + interruptedException.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, interruptedException); } } return isWebAppDeployed; }

Target:
protected boolean isJaggeryAppDeployed(String appName) throws LazyLoadingTestException { List<String> webAppList; List<String> faultyWebAppList; long startTime; long time; boolean isWebAppDeployed = false; boolean doLoop = true; log.info("waiting for " + appName + " deployment. Max wait time :" + DEPLOYMENT_DELAY_IN_MILLISECONDS + " milliseconds"); startTime = System.currentTimeMillis(); while (((time = (System.currentTimeMillis() - startTime)) < DEPLOYMENT_DELAY_IN_MILLISECONDS) && doLoop) { try { webAppList = webAppAdminClient.getWebApplist(appName); faultyWebAppList = webAppAdminClient.getFaultyWebAppList(appName); } catch (RemoteException remoteException) { String customErrorMessage = "remoteException Exception when calling methods in WebAppAdminClient"; log.error(customErrorMessage, remoteException); throw new LazyLoadingTestException(customErrorMessage, remoteException); } for (String faultWebAppName : faultyWebAppList) { if (faultWebAppName.equalsIgnoreCase(appName)) { isWebAppDeployed = false; log.info(appName + "- Jaggery Application is faulty"); doLoop = false; break; } } for (String webAppName : webAppList) { if (webAppName.equalsIgnoreCase(appName)) { isWebAppDeployed = true; log.info(appName + " Jaggery Application deployed in " + time + " millis"); doLoop = false; break; } } try { Thread.sleep(500); } catch (InterruptedException interruptedException) { String customErrorMessage = "InterruptedException occurs when sleeping 500 milliseconds and while" + " waiting for Jaggery Application to get deployed "; log.warn(customErrorMessage, interruptedException); } } return isWebAppDeployed; }