Package com.consol.citrus.validation.script

Examples of com.consol.citrus.validation.script.ScriptValidationContext


        replay(jdbcTemplate);
       
        List<String> stmts = Collections.singletonList(sql);
        executeSQLQueryAction.setStatements(stmts);
       
        ScriptValidationContext scriptValidationContext = new ScriptValidationContext(ScriptTypes.GROOVY);
        scriptValidationContext.setValidationScript("assert rows.size() == 1\n" +
                "assert rows[0] == [ORDERTYPE:'big', STATUS:'in_progress']");
        executeSQLQueryAction.setScriptValidationContext(scriptValidationContext);
       
        try {
            executeSQLQueryAction.execute(context);
View Full Code Here


        controlResultSet.put("ORDERTYPE", Collections.singletonList("small"));
        controlResultSet.put("STATUS", Collections.singletonList("in_progress"));
       
        executeSQLQueryAction.setControlResultSet(controlResultSet);
       
        ScriptValidationContext scriptValidationContext = new ScriptValidationContext(ScriptTypes.GROOVY);
        scriptValidationContext.setValidationScript("assert rows.size() == 1\n" +
                "assert rows[0].ORDERTYPE == 'small'\n" +
                "assert rows[0] == [ORDERTYPE:'small', STATUS:'in_progress']");
        executeSQLQueryAction.setScriptValidationContext(scriptValidationContext);
       
        executeSQLQueryAction.execute(context);
View Full Code Here

     * Construct the message validation context.
     * @param messageElement
     * @return
     */
    private ScriptValidationContext getScriptValidationContext(Element messageElement, String messageType) {
        ScriptValidationContext context = new ScriptValidationContext(messageType);

        boolean done = false;
        List<?> validateElements = DomUtils.getChildElementsByTagName(messageElement, "validate");
        if (validateElements.size() > 0) {
            for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) {
                Element validateElement = (Element) iter.next();

                Element scriptElement = DomUtils.getChildElementByTagName(validateElement, "script");

                // check for nested validate script child node
                if (scriptElement != null) {
                    if (!done) {
                        done = true;
                    } else {
                        throw new BeanCreationException("Found multiple validation script definitions - " +
                                "only supporting a single validation script for message validation");
                    }

                    String type = scriptElement.getAttribute("type");
                    context.setScriptType(type);

                    String filePath = scriptElement.getAttribute("file");
                    if (StringUtils.hasText(filePath)) {
                        context.setValidationScriptResourcePath(filePath);
                    } else {
                        context.setValidationScript(DomUtils.getTextValue(scriptElement));
                    }
                }
            }
        }

View Full Code Here

TOP

Related Classes of com.consol.citrus.validation.script.ScriptValidationContext

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.