/** * Validates the test folder. * * @param testFolder the test folder * @return the form validation */ public FormValidation validateTestFolder(final String testFolder) { FormValidation returnValue = FormValidation.ok(); if (StringUtils.isBlank(testFolder)) { returnValue = FormValidation.validateRequired(testFolder); } else if (testFolder.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } return returnValue; }
/** * Validates the global constant value. * * @param value the global constant value * @return FormValidation */ public FormValidation validateGlobalConstantValue(final String value) { FormValidation returnValue = FormValidation.ok(); if (StringUtils.isBlank(value)) { returnValue = FormValidation.validateRequired(value); } else if (value.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } return returnValue; }
/** * Validates the project file. * * @param testFile the test file * @return the form validation */ public FormValidation validateProjectFile(final String testFile) { FormValidation returnValue = FormValidation.ok(); if (StringUtils.isBlank(testFile)) { returnValue = FormValidation.validateRequired(testFile); } else if (testFile.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } else if (!testFile.endsWith(".prj")) { returnValue = FormValidation.error(Messages.TestBuilder_PrjFileExtension()); } return returnValue; }
/** * Validates the global constant name. * * @param name the global constant name * @return FormValidation */ public FormValidation validateGlobalConstantName(final String name) { FormValidation returnValue = FormValidation.ok(); if (StringUtils.isBlank(name)) { returnValue = FormValidation.validateRequired(name); } else if (name.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } else if (!isValidVariableName(name)) { returnValue = FormValidation.error(Messages.GlobalConstant_InvalidName()); } return returnValue; }
/** * Validates the TCF file. * * @param tcfFile the TCF file * @return the form validation */ public FormValidation validateTcfFile(final String tcfFile) { FormValidation returnValue = FormValidation.ok(); if (StringUtils.isBlank(tcfFile)) { returnValue = FormValidation.warning(Messages.TestBuilder_NoTcfFile()); } else if (tcfFile.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } else if (!tcfFile.endsWith(".tcf")) { returnValue = FormValidation.error(Messages.TestBuilder_TcfFileExtension()); } return returnValue; }
/** * Validates the filter expression. * * @param filterExpression the filter expression * @return the form validation */ public FormValidation validateFilterExpression(final String filterExpression) { FormValidation returnValue = FormValidation.ok(); if (!StringUtils.isBlank(filterExpression)) { if (filterExpression.contains(PARAMETER)) { returnValue = FormValidation.warning(Messages.Builder_NoValidatedValue()); } else { final String trimmedExpression = StringUtils.trimToEmpty(filterExpression) .replaceAll("^\\(\\s*", "(") .replaceAll("\\s*\\)", ")"); final FilterExpressionValidator validator = new FilterExpressionValidator(trimmedExpression); validator.validate(); if (!validator.isValid()) { returnValue = FormValidation.warning(Messages.TestProjectBuilder_InvalidFilterExpression()); } } } return returnValue; }