Examples of SynapseXPath


Examples of org.apache.synapse.util.xpath.SynapseXPath

        String result = axiomXpath.stringValueOf(synCtx);
        assertEquals("second", result);
    }

    public void testMessageContextGetStringValueEnvelope() throws Exception {
        SynapseXPath axiomXpath = new SynapseXPath("/s11:Envelope/s11:Body/ns1:a/ns1:c");
        axiomXpath.addNamespace("s11", nsSoapEnv);
        axiomXpath.addNamespace("ns1", nsNamespace1);

        MessageContext synCtx = TestUtils.getTestContext(sampleBody);

        String result = axiomXpath.stringValueOf(synCtx);
        assertEquals("second", result);
    }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

        OMAttribute attTarget = elem.getAttribute(ATT_TARGET);
        OMAttribute attProperty = elem.getAttribute(ATT_PROPERTY);
       
        if (attTarget != null) {
            try {
                mediator.setTarget(new SynapseXPath(attTarget));
            } catch (JaxenException e) {
                handleException("Invalid XPath specified for the target attribute : " +
                    attTarget.getAttributeValue());
            }
        }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

        OMAttribute attSource = elem.getAttribute(ATT_SOURCE);
        OMAttribute attProperty = elem.getAttribute(ATT_PROPERTY);
       
        if (attSource != null) {
            try {
                mediator.setSource(new SynapseXPath(attSource));
            } catch (JaxenException e) {
                handleException("Invalid XPath specified for the source attribute : " +
                    attSource.getAttributeValue());
            }
        }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

    public MediatorCustomVariable(QName name) {
        super(name);
        // create the default XPath
        try {
            this.expression = new SynapseXPath(SourceXPathSupport.DEFAULT_XPATH);
            this.expression.addNamespace("s11", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
            this.expression.addNamespace("s12", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        } catch (JaxenException e) {
            handleException("Error creating source XPath expression", e);
        }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

            Event<MessageContext> event = new Event<MessageContext>();
            event.setMessage(msgCtx);

            TopicBasedEventFilter filter = new TopicBasedEventFilter();
            filter.setResultValue(status);
            filter.setSourceXpath(new SynapseXPath("//weatherCondition"));
            assertTrue(filter.match(event));

            filter.setResultValue("rain");
            assertFalse(filter.match(event));           
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

                    TestUtils.createLightweightSynapseMessageContext("<weatherCondition>" +
                            status + "</weatherCondition>");

            XPathBasedEventFilter filter = new XPathBasedEventFilter();
            filter.setResultValue(status);
            filter.setSourceXpath(new SynapseXPath("//weatherCondition"));
            assertTrue(filter.isSatisfied(msgCtx));

            filter.setResultValue("rain");
            assertFalse(filter.isSatisfied(msgCtx));
        } catch (Exception e) {
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

                        if (key != null) {
                            ((MediatorCustomVariable) variable).setRegKey(key.trim());
                        }
                        if (expr != null && !"".equals(expr)) {
                            try {
                                SynapseXPath xpath = new SynapseXPath(expr);
                                OMElementUtils.addNameSpaces(xpath, variableOM, log);
                                ((MediatorCustomVariable) variable).setExpression(xpath);

                            } catch (JaxenException e) {
                                handleException("Invalid XPath specified for" +
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

public class SynapseXPathTest extends TestCase {

    String message = "This is XPath test";   

    public void testStringXPath() throws Exception {
        SynapseXPath xpath = SynapseXPath.parseXPathString("$body//{http://somens}test");
        MessageContext ctx =  TestUtils.getTestContext("<m0:test xmlns:m0=\"http://somens\">" + message + "</m0:test>");
        assertEquals(message, xpath.stringValueOf(ctx));
    }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

        MessageContext ctx =  TestUtils.getTestContext("<m0:test xmlns:m0=\"http://somens\">" + message + "</m0:test>");
        assertEquals(message, xpath.stringValueOf(ctx));
    }

    public void testStringXPath2() throws Exception {
        SynapseXPath xpath = SynapseXPath.parseXPathString("$body//{http://somens}test/{http://someother}another");
        MessageContext ctx =  TestUtils.getTestContext("<m0:test xmlns:m0=\"http://somens\"><m1:another xmlns:m1=\"http://someother\">" + message + "</m1:another></m0:test>");
        assertEquals(message, xpath.stringValueOf(ctx));
    }
View Full Code Here

Examples of org.apache.synapse.util.xpath.SynapseXPath

        MessageContext ctx =  TestUtils.getTestContext("<m0:test xmlns:m0=\"http://somens\"><m1:another xmlns:m1=\"http://someother\">" + message + "</m1:another></m0:test>");
        assertEquals(message, xpath.stringValueOf(ctx));
    }

    public void testAbsoluteXPath() throws Exception {
        SynapseXPath xpath = new SynapseXPath("//test");
        MessageContext ctx =  TestUtils.getTestContext("<test>" + message + "</test>");
        assertEquals(message, xpath.stringValueOf(ctx));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.