synapse-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject svn commit: r636285 [2/2] - in /synapse/trunk/java/modules: core/src/main/java/org/apache/synapse/config/xml/ core/src/main/java/org/apache/synapse/core/axis2/ core/src/main/java/org/apache/synapse/mediators/ core/src/main/java/org/apache/synapse/media...
Date Wed, 12 Mar 2008 11:50:39 GMT
Modified: synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java?rev=636285&r1=636284&r2=636285&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
(original)
+++ synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
Wed Mar 12 04:50:25 2008
@@ -43,22 +43,20 @@
         propMediator.mediate(synCtx);
         propMediatorTwo.mediate(synCtx);
         assertTrue(
-            "value".equals(Axis2MessageContext.getStringValue(
-                new SynapseXPath("synapse:get-property('name')"), synCtx)));
+            "value".equals((new SynapseXPath(
+                "synapse:get-property('name')")).getStringValue(synCtx)));
         assertTrue(
-            "valueTwo".equals(Axis2MessageContext.getStringValue(
-                new SynapseXPath("synapse:get-property('nameTwo')"), synCtx)));
+            "valueTwo".equals((new SynapseXPath(
+                "synapse:get-property('nameTwo')")).getStringValue(synCtx)));
 
         PropertyMediator propMediatorThree = new PropertyMediator();
         propMediatorThree.setName("name");
         propMediatorThree.setValue("value");
         propMediatorThree.setAction(PropertyMediator.ACTION_REMOVE);
         propMediatorThree.mediate(synCtx) ;
-        assertNull(Axis2MessageContext.getStringValue(
-                new SynapseXPath("synapse:get-property('name')"), synCtx));
-        assertTrue(
-                   "valueTwo".equals(Axis2MessageContext.getStringValue(
-                       new SynapseXPath("synapse:get-property('nameTwo')"), synCtx)));
+        assertNull((new SynapseXPath("synapse:get-property('name')")).getStringValue(synCtx));
+        assertTrue("valueTwo".equals((new SynapseXPath(
+            "synapse:get-property('nameTwo')")).getStringValue(synCtx)));
                 
     }
 

Modified: synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorFactory.java?rev=636285&r1=636284&r2=636285&view=diff
==============================================================================
--- synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorFactory.java
(original)
+++ synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorFactory.java
Wed Mar 12 04:50:25 2008
@@ -24,10 +24,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.Mediator;
-import org.apache.synapse.config.xml.AbstractMediatorFactory;
-import org.apache.synapse.config.xml.MediatorPropertyFactory;
-import org.apache.synapse.config.xml.OMElementUtils;
-import org.apache.synapse.config.xml.XMLConfigConstants;
+import org.apache.synapse.config.xml.*;
 import org.apache.synapse.util.SynapseXPath;
 import org.jaxen.JaxenException;
 
@@ -77,9 +74,8 @@
             String targetValue = attrTarget.getAttributeValue();
             if (targetValue != null) {
                 try {
-                    SynapseXPath xp = new SynapseXPath(targetValue.trim());
-                    OMElementUtils.addNameSpaces(xp, elem, log);
-                    xQueryMediator.setTarget(xp);
+                    xQueryMediator.setTarget(SynapseXPathFactory.getSynapseXPath(elem,
+                        new QName(XMLConfigConstants.NULL_NAMESPACE, "target")));
                 } catch (JaxenException e) {
                     handleException("Invalid XPath specified for the target attribute : "
+
                         targetValue);
@@ -119,9 +115,8 @@
                         }
                         if (expr != null && !"".equals(expr)) {
                             try {
-                                SynapseXPath xp = new SynapseXPath(expr.trim());
-                                OMElementUtils.addNameSpaces(xp, variableOM, log);
-                                ((MediatorCustomVariable) variable).setExpression(xp);
+                                ((MediatorCustomVariable) variable).setExpression(
+                                    SynapseXPathFactory.getSynapseXPath(variableOM, ATT_EXPR_Q));
 
                             } catch (JaxenException e) {
                                 handleException("Invalid XPath specified for" +

Modified: synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorSerializer.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorSerializer.java?rev=636285&r1=636284&r2=636285&view=diff
==============================================================================
--- synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorSerializer.java
(original)
+++ synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediatorSerializer.java
Wed Mar 12 04:50:25 2008
@@ -25,6 +25,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.Mediator;
 import org.apache.synapse.config.xml.AbstractMediatorSerializer;
+import org.apache.synapse.config.xml.SynapseXPathSerializer;
 import org.apache.synapse.config.xml.XMLConfigConstants;
 import org.apache.synapse.util.SynapseXPath;
 
@@ -66,11 +67,9 @@
         saveTracingState(xquery, queryMediator);
 
         SynapseXPath targetXPath = queryMediator.getTarget();
-        if (targetXPath != null &&
-            !XQueryMediator.DEFAULT_XPATH.toString().equals(targetXPath.toString())) {
-            xquery.addAttribute(fac.createOMAttribute(
-                "target", nullNS, targetXPath.toString()));
-            serializeNamespaces(xquery, targetXPath);
+        if (targetXPath != null && !XQueryMediator.DEFAULT_XPATH.equals(targetXPath.toString()))
{
+
+            SynapseXPathSerializer.serializeXPath(targetXPath, xquery, "target");
         }
 
         List pros = queryMediator.getDataSourceProperties();
@@ -143,11 +142,11 @@
                                 "key", nullNS, regkey));
                         }
                         SynapseXPath expression = variable.getExpression();
-                        if (expression != null && !XQueryMediator.DEFAULT_XPATH.toString().
-                            equals(expression.toString())) {
-                            customElement.addAttribute(fac.createOMAttribute(
-                                "expression", nullNS, expression.toString()));
-                            serializeNamespaces(customElement, expression);
+                        if (expression != null &&
+                            !XQueryMediator.DEFAULT_XPATH.equals(expression.toString()))
{
+
+                            SynapseXPathSerializer.serializeXPath(
+                                expression, customElement, "expression");
                         }
                         String type = null;
                         int varibelType = variable.getType();



Mime
View raw message