Package com.consol.citrus.variable

Examples of com.consol.citrus.variable.XpathPayloadVariableExtractor


    /**
     * Creates new variable extractor and adds it to test action.
     */
    private void initializeXpathVariableExtractor() {
        if (xpathExtractor == null) {
            xpathExtractor = new XpathPayloadVariableExtractor();

            action.getVariableExtractors().add(xpathExtractor);
        }
    }
View Full Code Here


       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("//root/element/sub-elementA", "${valueA}");
        extractMessageElements.put("//root/element/sub-elementB", "${valueB}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("//root/element/sub-elementA/@attribute", "${valueA}");
        extractMessageElements.put("//root/element/sub-elementB/@attribute", "${valueB}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("//root/element/sub-element-wrong", "${valueA}");
        extractMessageElements.put("//element/sub-element-wrong", "${valueB}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

                + "</root>");
       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("//root/element/sub-elementA/@attribute-wrong", "${attributeA}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("//root/element/sub-elementA", "${variableA}");
        extractMessageElements.put("//root/element/sub-elementB", "${variableB}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

     * @param variable
     * @return
     */
    public T extractFromPayload(String xpath, String variable) {
        if (xpathExtractor == null) {
            xpathExtractor = new XpathPayloadVariableExtractor();
           
            action.getVariableExtractors().add(xpathExtractor);
        }
       
        xpathExtractor.getxPathExpressions().put(xpath, variable);
View Full Code Here

        extractMessageElements.put("string:namespace-uri(/*)", "namespaceUri");
        extractMessageElements.put("boolean:contains(/ns1:root/:search-element, 'search')", "contains");
        extractMessageElements.put("boolean:/ns1:root/:element", "exists");
        extractMessageElements.put("boolean:/ns1:root/:element-does-not-exist", "existsNot");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);
       
        PayloadTemplateMessageBuilder controlMessageBuilder = new PayloadTemplateMessageBuilder();
        XmlMessageValidationContext validationContext = new XmlMessageValidationContext();
View Full Code Here

                }
               
                extractMessageValues.put(pathExpression, messageValue.getAttribute("variable"));
            }
           
            XpathPayloadVariableExtractor payloadVariableExtractor = new XpathPayloadVariableExtractor();
            payloadVariableExtractor.setxPathExpressions(extractMessageValues);
           
            Map<String, String> namespaces = new HashMap<String, String>();
            Element messageElement = DomUtils.getChildElementByTagName(element, "message");
            if (messageElement != null) {
                List<?> namespaceElements = DomUtils.getChildElementsByTagName(messageElement, "namespace");
                if (namespaceElements.size() > 0) {
                    for (Iterator<?> iter = namespaceElements.iterator(); iter.hasNext();) {
                        Element namespaceElement = (Element) iter.next();
                        namespaces.put(namespaceElement.getAttribute("prefix"), namespaceElement.getAttribute("value"));
                    }
                    payloadVariableExtractor.setNamespaces(namespaces);
                }
            }
           
            variableExtractors.add(payloadVariableExtractor);
        }
View Full Code Here

       
        HashMap<String, String> extractMessageElements = new HashMap<String, String>();
        extractMessageElements.put("root.element.sub-elementA", "${valueA}");
        extractMessageElements.put("root.element.sub-elementB", "${valueB}");
       
        XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
        variableExtractor.setxPathExpressions(extractMessageElements);
       
        receiveMessageBean.addVariableExtractors(variableExtractor);

        List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
        validationContexts.add(validationContext);
View Full Code Here

TOP

Related Classes of com.consol.citrus.variable.XpathPayloadVariableExtractor

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.