Package com.alphacsp.cit.validators

Examples of com.alphacsp.cit.validators.ValidationException


        scriptLanucher.addCommand(getExecutableName());
        Process process = scriptLanucher.exec();
        String output = ProcessUtils.readOutput(process).trim();
        int exitCode = process.exitValue();
        if (exitCode != 0 || output.length() == 0) {
            throw new ValidationException("Executable " + getExecutableName() + " was not found!");
        }
        return output;
    }
View Full Code Here


    public VariableValue setUserProvidedVariable(String name, String value) {
        VariableDefinition definition = template.getDefinitions().get(name);

        if (definition == null) {
            throw new ValidationException("The variable " + name + " is not required! remove it!");
        }

        // I don't need to calculate this definition, even if they are "calculation" or "executable" type,
        // as the user provided them.
View Full Code Here

    private void validateNoMissingVariables(Properties properties) throws ValidationException {
        Map<String, VariableDefinition> definitions = template.getDefinitions();
        Set<String> keys = definitions.keySet();
        for (String key : keys) {
            if (!definitions.get(key).isOptional() && !properties.containsKey(key)) {
                throw new ValidationException("The " + key + " variable is required!");
            }
        }
    }
View Full Code Here

    }

    public VariableValue newVariableValue(String stringValue) {
        VariableValue result;
        if (StringUtils.isEmpty(stringValue)) {
            throw new ValidationException("The value of the variable " + getVariableName() + " can not be empty!");
        }

        if (this.isPath()) {
            if (EnvironmentUtils.isCygwin()) {
                result = new CygwinFileValue(stringValue);
View Full Code Here

    private void validateVariable(String name, String value) {
        VariableDefinition definition = template.getDefinitions().get(name);

        if (definition == null) {
            throw new ValidationException("The variable " + name + " is not required! remove it!");
        }

        VariableValue variableValue = definition.newVariableValue(value);
        definition.validate(this, variableValue);
    }
View Full Code Here

    }

    public void addVariableDefinition(VariableDefinition definition, String value) {
        String variableName = definition.getVariableName();
        if (template.getDefinitions().containsKey(variableName)) {
            throw new ValidationException("The variable definition " + variableName + " already exists");
        }
        template.getDefinitions().put(variableName, definition);
        VariableValue variableValue = definition.newVariableValue(value);
        definition.validate(this, variableValue);
        this.variables.put(variableName, variableValue);
View Full Code Here

TOP

Related Classes of com.alphacsp.cit.validators.ValidationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.