You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/04/17 21:03:44 UTC

svn commit: r529712 - in /ofbiz/trunk/framework/common: servicedef/services_test.xml src/org/ofbiz/common/CommonServices.java

Author: jaz
Date: Tue Apr 17 12:03:43 2007
New Revision: 529712

URL: http://svn.apache.org/viewvc?view=rev&rev=529712
Log:
added test service to test map/list conversions

Modified:
    ofbiz/trunk/framework/common/servicedef/services_test.xml
    ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java

Modified: ofbiz/trunk/framework/common/servicedef/services_test.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_test.xml?view=diff&rev=529712&r1=529711&r2=529712
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services_test.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services_test.xml Tue Apr 17 12:03:43 2007
@@ -119,6 +119,13 @@
     	<description>Test the Route engine</description>
     </service>
 
+    <service name="simpleMapListTest" engine="java" auth="false" export="true"
+            location="org.ofbiz.common.CommonServices" invoke="simpleMapListTest">
+        <description>To test XML-RPC handling of Maps and Lists</description>
+        <attribute name="listOfStrings" type="List" mode="IN"/>
+        <attribute name="mapOfStrings" type="Map" mode="IN"/>
+    </service>
+    
     <service name="testJavsScript" engine="javascript" auth="false"
 			location="org/ofbiz/common/JavaScriptTest.js" invoke="">
     	<description>Test JavaScript Service</description>

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java?view=diff&rev=529712&r1=529711&r2=529712
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Tue Apr 17 12:03:43 2007
@@ -20,12 +20,7 @@
 
 import java.io.*;
 import java.sql.Timestamp;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
 
 import javax.mail.internet.MimeMessage;
 import javax.transaction.xa.XAException;
@@ -407,6 +402,20 @@
             if (ServiceUtil.isError(contentResp)) {
                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(contentResp));
             }
+        }
+
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static Map simpleMapListTest(DispatchContext dctx, Map context) {
+        List listOfStrings = (List) context.get("listOfStrings");
+        Map mapOfStrings = (Map) context.get("mapOfStrings");
+
+        Iterator i = listOfStrings.iterator();
+        while (i.hasNext()) {
+            String str = (String) i.next();
+            String v = (String) mapOfStrings.get(str);
+            Debug.log("SimpleMapListTest: " + str + " -> " + v, module);
         }
 
         return ServiceUtil.returnSuccess();