Examples of SynapseXPath


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

        // create a new filter mediator
        FilterMediator filter = new FilterMediator();

        // set source xpath condition to //symbol
        SynapseXPath source = new SynapseXPath("//wsx:symbol");
        source.addNamespace("wsx", "http://www.webserviceX.NET/");
        filter.setSource(source);

        // set regex to MSFT
        Pattern regex = Pattern.compile("MSFT");
        filter.setRegex(regex);
View Full Code Here

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

        // create a new filter mediator
        FilterMediator filter = new FilterMediator();

        // set source xpath condition to //symbol
        SynapseXPath source = new SynapseXPath("//wsx:symbol");
        source.addNamespace("wsx", "http://www.webserviceX.NET/");
        filter.setSource(source);

        // set regex to MSFT
        Pattern regex = Pattern.compile("MSFT");
        filter.setRegex(regex);
View Full Code Here

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

        // create a new switch mediator
        switchMediator = new SwitchMediator();

        // set xpath condition to select symbol
        SynapseXPath xpath = new SynapseXPath("//wsx:symbol");
        xpath.addNamespace("wsx", "http://www.webserviceX.NET/");
        switchMediator.setSource(xpath);
        SwitchCase caseOne = new SwitchCase();
        caseOne.setRegex(Pattern.compile("IBM"));
        AnonymousListMediator mediatorOne = new AnonymousListMediator();
        mediatorOne.addAll(Arrays.asList(new Mediator[] {ibmMediator}));
View Full Code Here

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

    /** Lock object to provide the synchronized access to the activeAggregates on checking */
    private final Object lock = new Object();

    public AggregateMediator() {
        try {
            aggregationExpression = new SynapseXPath("s11:Body/child::*[position()=1] | " +
                "s12:Body/child::*[position()=1]");
            aggregationExpression.addNamespace("s11", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
            aggregationExpression.addNamespace("s12", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        } catch (JaxenException e) {
            if (log.isDebugEnabled()) {
View Full Code Here

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

        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            SynapseXPath xp = new SynapseXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
View Full Code Here

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

        OMElement pool;

        try {
            // get the 'pool' element and determine if we need to create a DataSource or
            // lookup using JNDI
            SynapseXPath xpath = new SynapseXPath("self::node()/syn:connection/syn:pool");
            xpath.addNamespace("syn", XMLConfigConstants.SYNAPSE_NAMESPACE);
            pool = (OMElement) xpath.selectSingleNode(elem);
            if (pool.getFirstChildWithName(DSNAME_Q) != null) {
                readLookupConfig(mediator, pool);
            } else if (pool.getFirstChildWithName(DRIVER_Q) != null) {
                readCustomDataSourceConfig(pool, mediator);
            } else {
View Full Code Here

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

                String xpath = getAttribute(paramElt, ATT_EXPRN);
                String value = getAttribute(paramElt, ATT_VALUE);

                if (xpath != null || value != null) {

                    SynapseXPath xp = null;
                    if (xpath != null) {
                        try {
                            xp = SynapseXPathFactory.getSynapseXPath(paramElt, ATT_EXPRN);

                        } catch (JaxenException e) {
View Full Code Here

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

        MessageContext synCtx = TestUtils.getTestContext("<empty/>");
        propMediator.mediate(synCtx);
        propMediatorTwo.mediate(synCtx);
        assertTrue(
            "value".equals((new SynapseXPath(
                "synapse:get-property('name')")).stringValueOf(synCtx)));
        assertTrue(
            "valueTwo".equals((new SynapseXPath(
                "synapse:get-property('nameTwo')")).stringValueOf(synCtx)));

        PropertyMediator propMediatorThree = new PropertyMediator();
        propMediatorThree.setName("name");
        propMediatorThree.setValue("value");
        propMediatorThree.setAction(PropertyMediator.ACTION_REMOVE);
        propMediatorThree.mediate(synCtx) ;
        assertNull((new SynapseXPath("synapse:get-property('name')")).stringValueOf(synCtx));
        assertTrue("valueTwo".equals((new SynapseXPath(
            "synapse:get-property('nameTwo')")).stringValueOf(synCtx)));
               
    }
View Full Code Here

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

        propMediatorOne.mediate(synCtx);
        Object prop = synCtx.getProperty("nameOne");
        assertEquals(valueOne, prop);

        // Test XML property retreival
        String exprValue = new SynapseXPath("synapse:get-property('nameOne')").stringValueOf(synCtx);
        assertEquals(xml, exprValue);

        // Test property removal
        propMediatorOne.setAction(PropertyMediator.ACTION_REMOVE);
        propMediatorOne.mediate(synCtx);
        assertNull(synCtx.getProperty("nameOne"));

        // Setting XML properties using expressions
        synCtx.setProperty("nameOne", xml);
        PropertyMediator propertyMediatorTwo = new PropertyMediator();
        propertyMediatorTwo.setName("nameTwo");
        propertyMediatorTwo.setExpression(new SynapseXPath("synapse:get-property('nameOne')"),
                XMLConfigConstants.DATA_TYPES.OM.name());
        propertyMediatorTwo.mediate(synCtx);
        Object exprProp = synCtx.getProperty("nameTwo");
        assertTrue(exprProp != null && exprProp instanceof OMElement);
    }
View Full Code Here

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

        MessageContext synCtx = TestUtils.getTestContext("<empty/>");
        propMediator.mediate(synCtx);

        // read property through a mediator property
        MediatorProperty medProp = new MediatorProperty();
        medProp.setExpression(new SynapseXPath("synapse:get-property('name')"));

        assertTrue(
            "value".equals(medProp.getEvaluatedExpression(synCtx)));
    }
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.