@Override public DeploymentConfiguration prepareForDeployment( CloudFoundryServer server, CloudFoundryApplicationModule module, IProgressMonitor monitor) throws CoreException { // NOTE: // This // section // here // is // a // substitute // for // the // Application DeploymentInfoWorkingCopy copy = module.resolveDeploymentInfoWorkingCopy(monitor); copy.setDeploymentName(appName); copy.setMemory(memory); if (variables != null) { copy.setEnvVariables(variables); } if (services != null) { copy.setServices(services); } if (url != null) { copy.setUris(Collections.singletonList(url)); } else { // Derive the URL from the app name specified in the test call back. // NOTE that although the working copy SHOULD have a default URL // generated from a default application name // (generally, the project name), since the appname and project name // can be different, // and such difference would be specified manually by the user in // the deployment wizard, // be sure to generate a URL from the actual app name specified in // this Test call back, to be sure // the URL is built off the app name rather than the project name, // as the test case may have specified // a different app name than the default app name from the project // name. ApplicationUrlLookupService urlLookup = ApplicationUrlLookupService.update(server, monitor); CloudApplicationURL url = urlLookup.getDefaultApplicationURL(copy.getDeploymentName()); if (url != null) { copy.setUris(Arrays.asList(url.getUrl())); } } copy.save(); ApplicationAction mode = deployStopped ? ApplicationAction.STOP : ApplicationAction.START; return new DeploymentConfiguration(mode); }