You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/12/22 07:47:39 UTC

svn commit: r893087 - in /ofbiz/trunk/framework: common/servicedef/services_test.xml common/src/org/ofbiz/common/CommonServices.java service/src/org/ofbiz/service/ModelService.java service/src/org/ofbiz/service/test/ServiceSOAPTests.java

Author: hansbak
Date: Tue Dec 22 06:47:20 2009
New Revision: 893087

URL: http://svn.apache.org/viewvc?rev=893087&view=rev
Log:
make the soap tests independent of the application component, contribution by chatree, suggestion by Scott

Modified:
    ofbiz/trunk/framework/common/servicedef/services_test.xml
    ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceSOAPTests.java

Modified: ofbiz/trunk/framework/common/servicedef/services_test.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_test.xml?rev=893087&r1=893086&r2=893087&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services_test.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services_test.xml Tue Dec 22 06:47:20 2009
@@ -34,8 +34,8 @@
     <service name="testSOAPScv" engine="java" export="true" validate="false" require-new-transaction="true"
             location="org.ofbiz.common.CommonServices" invoke="testSOAPService">
         <description>Test SOAP service</description>
-        <attribute name="productCategory" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
-        <attribute name="products" type="List" mode="OUT" optional="true"/>
+        <attribute name="testing" type="org.ofbiz.entity.GenericValue" mode="IN" optional="false"/>
+        <attribute name="testingNodes" type="List" mode="OUT" optional="true"/>
     </service>
     <service name="blockingTestScv" engine="java" export="true" validate="false" require-new-transaction="true" transaction-timeout="20"
             location="org.ofbiz.common.CommonServices" invoke="blockingTestService">

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?rev=893087&r1=893086&r2=893087&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Tue Dec 22 06:47:20 2009
@@ -96,19 +96,16 @@
         Delegator delegator = dctx.getDelegator();
         Map<String, Object> response = ServiceUtil.returnSuccess();
 
-        GenericValue productCategory = (GenericValue) context.get("productCategory");
-        List<GenericValue> products = FastList.newInstance();
+        GenericValue testing = (GenericValue) context.get("testing");
+        List<GenericValue> testingNodes = FastList.newInstance();
         for (int i = 0; i < 3; i ++) {
-            GenericValue product = delegator.makeValue("Product");
-            product.put("productId", "PROD_TEST" + i);
-            product.put("productTypeId", "FINISHED_GOOD");
-            product.put("primaryProductCategoryId", "202");
-            product.put("internalName", "Product Test " + i);
-            product.put("productName", "Product Test " + i);
-            product.put("createdStamp", UtilDateTime.nowTimestamp());
-            products.add(product);
+            GenericValue testingNode = delegator.makeValue("TestingNode");
+            testingNode.put("testingNodeId", "TESTING_NODE" + i);
+            testingNode.put("description", "Testing Node " + i);
+            testingNode.put("createdStamp", UtilDateTime.nowTimestamp());
+            testingNodes.add(testingNode);
         }
-        response.put("products", products);
+        response.put("testingNodes", testingNodes);
         return response;
     }
 

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java?rev=893087&r1=893086&r2=893087&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelService.java Tue Dec 22 06:47:20 2009
@@ -1191,7 +1191,7 @@
         def.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
         this.getWSDL(def, locationURI);
         return factory.newWSDLWriter().getDocument(def);
-}
+    }
 
     public void getWSDL(Definition def, String locationURI) throws WSDLException {
 
@@ -1231,6 +1231,22 @@
                     documentation.appendChild(attribute);
                 }
             }
+            Element usernameAttr = document.createElement("attribute");
+            usernameAttr.setAttribute("name", "login.username");
+            usernameAttr.setAttribute("type", "std-String");
+            usernameAttr.setAttribute("namespace", TNS);
+            usernameAttr.setAttribute("java-class", String.class.getName());
+            usernameAttr.setAttribute("optional", Boolean.toString(!this.auth));
+            documentation.appendChild(usernameAttr);
+
+            Element passwordAttr = document.createElement("attribute");
+            passwordAttr.setAttribute("name", "login.password");
+            passwordAttr.setAttribute("type", "std-String");
+            passwordAttr.setAttribute("namespace", TNS);
+            passwordAttr.setAttribute("java-class", String.class.getName());
+            passwordAttr.setAttribute("optional", Boolean.toString(!this.auth));
+            documentation.appendChild(passwordAttr);
+
             parametersPart.setDocumentationElement(documentation);
             def.addMessage(inMessage);
             input.setMessage(inMessage);
@@ -1546,12 +1562,22 @@
         /* eepk- Element */
         Element eepkElement = document.createElement("xsd:element");
         eepkElement.setAttribute("name", "eepk-");
-        eepkElement.setAttribute("type", "tns:map-Value");
+        eepkElement.setAttribute("type", "tns:map-Map");
+        Element eepkElement0 = document.createElement("xsd:annotation");
+        eepkElement.appendChild(eepkElement0);
+        Element eepkElement1 = document.createElement("xsd:documentation");
+        eepkElement0.appendChild(eepkElement1);
+        eepkElement1.setTextContent("The name of element need to be appended with name of entity such as eepk-Product for Product entity.");
         schema.appendChild(eepkElement);
         /* eeval- Element */
         Element eevalElement = document.createElement("xsd:element");
         eevalElement.setAttribute("name", "eeval-");
-        eevalElement.setAttribute("type", "tns:map-Value");
+        eevalElement.setAttribute("type", "tns:map-Map");
+        Element eevalElement0 = document.createElement("xsd:annotation");
+        eevalElement.appendChild(eevalElement0);
+        Element eevalElement1 = document.createElement("xsd:documentation");
+        eevalElement0.appendChild(eevalElement1);
+        eevalElement1.setTextContent("The name of element need to be appended with name of entity such as eeval-Product for Product entity.");
         schema.appendChild(eevalElement);
 
         /*-----------------------------------*/
@@ -1561,6 +1587,11 @@
         /* cus-obj Element */
         Element cusObjElement = document.createElement("xsd:element");
         cusObjElement.setAttribute("name", "cus-obj");
+        Element cusObjElement0 = document.createElement("xsd:annotation");
+        cusObjElement.appendChild(cusObjElement0);
+        Element cusObjElement1 = document.createElement("xsd:documentation");
+        cusObjElement0.appendChild(cusObjElement1);
+        cusObjElement1.setTextContent("Object content need to be in CDATA such as <cus-obj><![CDATA[--byteHex--]]></cus-obj>");
         schema.appendChild(cusObjElement);
 
         /*-----------------------------------*/

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceSOAPTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceSOAPTests.java?rev=893087&r1=893086&r2=893087&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceSOAPTests.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceSOAPTests.java Tue Dec 22 06:47:20 2009
@@ -5,9 +5,7 @@
 
 import javolution.util.FastMap;
 
-import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.service.testtools.OFBizTestCase;
 
@@ -30,14 +28,14 @@
     
     public void testSOAPService() throws Exception {
         Map<String, Object> serviceContext = FastMap.newInstance();
-        GenericValue productCategory = delegator.makeValue("ProductCategory");
-        productCategory.put("productCategoryId", "PRODCAT_TEST");
-        productCategory.put("productCategoryTypeId", "CATALOG_CATEGORY");
-        productCategory.put("categoryName", "Test ProductCategory");
-        productCategory.put("createdStamp", UtilDateTime.nowTimestamp());
-        serviceContext.put("productCategory", productCategory);
+        GenericValue testing = delegator.makeValue("Testing");
+        testing.put("testingId", "COMPLEX_TYPE_TEST");
+        testing.put("testingTypeId", "SOAP_TEST");
+        testing.put("testingName", "Complex Type Test");
+        testing.put("createdStamp", UtilDateTime.nowTimestamp());
+        serviceContext.put("testing", testing);
         Map<String, Object> results = dispatcher.runSync("testSoap", serviceContext);
-        List<GenericValue> products = (List<GenericValue>) results.get("products");
-        assertNotNull(products);
+        List<GenericValue> testingNodes = (List<GenericValue>) results.get("testingNodes");
+        assertNotNull(testingNodes);
     }
 }