ParametersValidator { @NotNull static Map<String, String> validateRuntime(@NotNull Map<String, String> runnerParams, @NotNull Map<String, String> configParams, @NotNull File checkoutDir) { final Map<String, String> invalids = new HashMap<String, String>(validate(runnerParams, true)); if (!invalids.containsKey(REVISION_PATHS_PARAM) && isUploadStepEnabled(runnerParams)) { final String revisionPath = getReadyRevision(runnerParams.get(REVISION_PATHS_PARAM)); if (revisionPath != null && !FileUtil.resolvePath(checkoutDir, revisionPath).exists()) { invalids.put(REVISION_PATHS_PARAM, REVISION_PATHS_LABEL + " " + revisionPath + " doesn't exist"); } } if (isDeploymentWaitEnabled(runnerParams)) { final String waitIntervalSec = configParams.get(WAIT_POLL_INTERVAL_SEC_CONFIG_PARAM); if (StringUtil.isNotEmpty(waitIntervalSec)) { validatePositiveInteger(invalids, waitIntervalSec, WAIT_POLL_INTERVAL_SEC_CONFIG_PARAM, WAIT_POLL_INTERVAL_SEC_CONFIG_PARAM, true); } } return Collections.unmodifiableMap(invalids); }    }
@Test public void revision_not_fount() throws Exception { then(validateRuntime( params(DEPLOYMENT_STEPS_PARAM, UPLOAD_STEP, REVISION_PATHS_PARAM, "ready_revision.zip"), params())). as("Must detect no revision"). containsEntry(REVISION_PATHS_PARAM, "Application revision ready_revision.zip doesn't exist"); }
@Test public void unexpected_wait_poll_interval() throws Exception { then(validateRuntime( params(DEPLOYMENT_STEPS_PARAM, DEPLOY_STEP, WAIT_FLAG_PARAM, "true"), params(WAIT_POLL_INTERVAL_SEC_CONFIG_PARAM, "50sec"))). as("Must detect unexpected wait poll interval"). containsEntry(WAIT_POLL_INTERVAL_SEC_CONFIG_PARAM, "codedeploy.wait.poll.interval.sec must be a positive integer value"); }