synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dushan Sachinda Abeyruwan (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SYNAPSE-890) Pattern attribute of the property mediator does not seem to work
Date Thu, 12 Jul 2012 09:01:36 GMT

     [ https://issues.apache.org/jira/browse/SYNAPSE-890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dushan Sachinda Abeyruwan updated SYNAPSE-890:
----------------------------------------------

    Attachment: PropertyMediator.java.patch
    
> Pattern attribute of the property mediator does not seem to work
> ----------------------------------------------------------------
>
>                 Key: SYNAPSE-890
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-890
>             Project: Synapse
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>         Environment: Ubuntu 12.04
>            Reporter: Dushan Sachinda Abeyruwan
>            Priority: Critical
>             Fix For: FUTURE
>
>         Attachments: PropertyMediator.java.patch
>
>
> Steps to reproduce: 
> ================ 
> 1. Create a sequence like the following 
> <sequence xmlns="http://ws.apache.org/ns/synapse" name="main"> 
>    <in> 
>       <switch xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
xmlns:m0="http://services.samples" source="//m0:getQuote/m0:request/m0:symbol"> 
>          <case regex="IBM"> 
>             <property name="symbol" value="Great stock - IBM" /> 
>          </case> 
>          <case regex="MSFT"> 
>             <property name="symbol" value="Are you sure? - MSFT" /> 
>          </case> 
>          <default> 
>             <property name="symbol" expression="fn11:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)"
scope="default" /> 
>          </default> 
>       </switch> 
>       <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
xmlns:m0="http://services.samples" name="MyProp" expression="//m0:getQuote/m0:request/m0:symbol"
pattern="[a-zA-Z_0-9]" scope="default" /> 
>       <log level="custom"> 
>          <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
name="symbol" expression="get-property('symbol')" /> 
>          <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
name="epr" expression="get-property('To')" /> 
>          <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
name="customProperty" expression="get-property('MyProp')" /> 
>       </log> 
>       <send /> 
>    </in> 
>    <out> 
>       <send /> 
>    </out> 
> </sequence> 
> 2. Note the following property mediator in the above sequence. I used pattern attribute
in there to evaluate the result of xpath expression against a regex 
> <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"
xmlns:m0="http://services.samples" name="MyProp" expression="//m0:getQuote/m0:request/m0:symbol"
pattern="[a-zA-Z_0-9]" scope="default" /> 
> According to the above regex, I should only set the property value if the Xpath expression
result is alpha-numeric 
> 3. Send a request with the following payload (note the non-alpha numeric character) 
>   <m0:getQuote xmlns:m0="http://services.samples"> 
>             <m0:request> 
>                <m0:symbol>%</m0:symbol> 
>             </m0:request> 
>          </m0:getQuote> 
> 4. Check the log mediator output (value of the customProperty) 
> INFO - LogMediator symbol = Normal Stock - %, epr = http://localhost:9000/services/SimpleStockQuoteService,
customProperty = % 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message