private void checkNotEmpty(Map<String, String> properties, String key, String message, Collection<InvalidProperty> result) { if (isEmptyOrSpaces(properties.get(key))) { result.add(new InvalidProperty(key, message)); } }
private void checkNotEmpty(Map<String, String> properties, String key, String message, Collection<InvalidProperty> result) { if (isEmptyOrSpaces(properties.get(key))) { result.add(new InvalidProperty(key, message)); } }
private void validatePublishedAndBuildDependencies(Collection<InvalidProperty> invalidProperties, String publishedAndBuildDependencies) { Multimap<String, String> pairs = PublishedItemsHelper.getPublishedItemsPatternPairs( publishedAndBuildDependencies); for (Map.Entry<String, String> patternEntry : pairs.entries()) { String sourcePattern = patternEntry.getKey().trim(); if (!sourcePattern.contains(":")) { invalidProperties.add(new InvalidProperty(RunnerParameterKeys.BUILD_DEPENDENCIES, getInvalidPatternMessage(sourcePattern, "must be formatted like: [repo-key]:[pattern/to/search/for]."))); } else if (!sourcePattern.contains("@") && sourcePattern.contains("**") && !sourcePattern.contains(";")) { invalidProperties.add(new InvalidProperty(RunnerParameterKeys.BUILD_DEPENDENCIES, getInvalidPatternMessage(sourcePattern, "cannot contain the '**' wildcard."))); } } }
invalidProperties.add(new InvalidProperty(TriggerParameterKeys.URL_ID, "Please select a server.")); } else { long id = Long.parseLong(urlId); if (!deployableServers.isUrlIdConfigured(id)) { invalidProperties.add(new InvalidProperty(TriggerParameterKeys.URL_ID, "Selected server ID is not configured.")); invalidProperties.add(new InvalidProperty(TriggerParameterKeys.TARGET_REPO, "Please select a target repository. If the repository list is empty, make sure the " + "specified Artifactory server URL is valid.")); invalidProperties.add(new InvalidProperty(TriggerParameterKeys.TARGET_ITEMS, "Please enter item paths to watch for changes.")); if (StringUtils.isBlank(pollingInterval)) { invalidProperties .add(new InvalidProperty(TriggerParameterKeys.POLLING_INTERVAL, "Please enter a valid polling interval. 0 is system default.")); } else if (!StringUtils.isNumeric(pollingInterval)) { invalidProperties .add(new InvalidProperty(TriggerParameterKeys.POLLING_INTERVAL, "Please enter a positive numeric polling interval. 0 is system default."));
@Nullable @Override public PropertiesProcessor getParametersProcessor() { return params -> { final ArrayList<InvalidProperty> invalids = new ArrayList<>(); for (Map.Entry<String, String> e : S3Util.validateParameters(params, true).entrySet()) { invalids.add(new InvalidProperty(e.getKey(), e.getValue())); } final String bucketName = S3Util.getBucketName(params); if (bucketName != null) { try { final String location = S3Util.withS3Client( ParamUtil.putSslValues(myServerPaths, params), client -> client.getBucketLocation(bucketName) ); if (location == null) { invalids.add(new InvalidProperty(S3Constants.S3_BUCKET_NAME, "Bucket does not exist")); } } catch (Throwable e) { invalids.add(new InvalidProperty(S3Constants.S3_BUCKET_NAME, e.getMessage())); } } return invalids; }; }
invalidProperties.add(new InvalidProperty(RunnerParameterKeys.URL_ID, "Selected URL isn't configured.")); boolean useSpecs = BooleanUtils.toBoolean(properties.get(RunnerParameterKeys.USE_SPECS)); if (StringUtils.isBlank(targetRepo) && !useSpecs) { invalidProperties.add(new InvalidProperty(RunnerParameterKeys.TARGET_REPO, "Please select a target repository. If the repository list is empty, make sure the specified " + "Artifactory server URL is valid.")); (!recipientToken.contains("@")) || recipientToken.startsWith("@") || recipientToken.endsWith("@")) { invalidProperties.add(new InvalidProperty(RunnerParameterKeys.LICENSE_VIOLATION_RECIPIENTS, "'" + recipientToken + "' is not a valid e-mail address.")); break;
public Collection<InvalidProperty> process(final Map<String, String> properties) { List<InvalidProperty> errors = new ArrayList<InvalidProperty>(); AnsibleRunConfig config = new AnsibleRunConfig(properties); if (AnsibleCommand.EXECUTABLE.equals(config.getCommandType())) { if (StringUtil.isEmptyOrSpaces(config.getExecutable())) { errors.add(new InvalidProperty(AnsibleRunnerConstants.EXECUTABLE_KEY, "Cannot be empty")); } if (StringUtil.isEmptyOrSpaces(config.getPlaybook())) { errors.add(new InvalidProperty(AnsibleRunnerConstants.PLAYBOOK_FILE_KEY, "Cannot be empty")); } } else if (AnsibleCommand.CUSTOM_SCRIPT.equals(config.getCommandType())) { if (StringUtil.isEmptyOrSpaces(config.getSourceCode())) { errors.add(new InvalidProperty(AnsibleRunnerConstants.SOURCE_CODE_KEY, "Cannot be empty")); } } return errors; } };