synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ind...@apache.org
Subject svn commit: r605094 - in /webservices/synapse/trunk/java/modules/extensions/src: main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java
Date Tue, 18 Dec 2007 05:34:17 GMT
Author: indika
Date: Mon Dec 17 21:34:15 2007
New Revision: 605094

URL: http://svn.apache.org/viewvc?rev=605094&view=rev
Log:
add missig binding for xs:integer 
update the test case

Modified:
    webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java
    webservices/synapse/trunk/java/modules/extensions/src/test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java

Modified: webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java?rev=605094&r1=605093&r2=605094&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java
(original)
+++ webservices/synapse/trunk/java/modules/extensions/src/main/java/org/apache/synapse/mediators/xquery/XQueryMediator.java
Mon Dec 17 21:34:15 2007
@@ -367,6 +367,20 @@
                         xqDynamicContext.bindBoolean(name, booleanValue, null);
                         break;
                     }
+                    case(XQItemType.XQBASETYPE_INTEGER): {
+                        int intValue = -1;
+                        if (value instanceof String) {
+                            intValue = Integer.parseInt((String) value);
+                        } else if (value instanceof Integer) {
+                            intValue = ((Integer) value).intValue();
+                        } else {
+                            handleException("Incompatible type for the Integer");
+                        }
+                        if (intValue != -1) {
+                            xqDynamicContext.bindInt(name, intValue, null);
+                        }
+                        break;
+                    }
                     case(XQItemType.XQBASETYPE_INT): {
                         int intValue = -1;
                         if (value instanceof String) {

Modified: webservices/synapse/trunk/java/modules/extensions/src/test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/extensions/src/test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java?rev=605094&r1=605093&r2=605094&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/extensions/src/test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java
(original)
+++ webservices/synapse/trunk/java/modules/extensions/src/test/java/org/apache/synapse/mediators/xquery/XQueryMediatorTest.java
Mon Dec 17 21:34:15 2007
@@ -100,6 +100,7 @@
                              "declare variable $shortVar as xs:short external;" +
                              "declare variable $floatVar as xs:float external;" +
                              "declare variable $stringVar as xs:string external;" +
+                             "declare variable $integerVar as xs:integer external;" +
                              "document { " +
                              "<a xmlns='http://a/uri' z:in='out' xmlns:z='http://z/uri'>"
+
                              "<b>{$intVar+2}<e>{$boolVar}</e>" +
@@ -110,6 +111,7 @@
                              "{$longVar}," +
                              "{$floatVar}," +
                              "{$stringVar}," +
+                             "{$integerVar+xs:integer('5')}," +
                              "</all></b></a> }");
         List list = new ArrayList();
         MediatorVariable intVariable = new MediatorBaseVariable(new QName("intVar"));
@@ -144,6 +146,10 @@
         stringValue.setType(XQItemType.XQBASETYPE_STRING);
         stringValue.setValue("synapse");
         list.add(stringValue);
+        MediatorVariable integerValue = new MediatorBaseVariable(new QName("integerVar"));
+        integerValue.setType(XQItemType.XQBASETYPE_INTEGER);
+        integerValue.setValue(new Integer(5));
+        list.add(integerValue);
         mediator.addAllVariables(list);
         assertTrue(mediator.mediate(mc));
         assertEquals("10", mc.getEnvelope().getBody().getFirstElement().



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


Mime
View raw message