svn commit: r801317 - in /ofbiz/trunk/applications/order: servicedef/services.xml src/org/ofbiz/order/test/OrderTestServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r801317 - in /ofbiz/trunk/applications/order: servicedef/services.xml src/org/ofbiz/order/test/OrderTestServices.java

jacopoc
Author: jacopoc
Date: Wed Aug  5 17:22:00 2009
New Revision: 801317

URL: http://svn.apache.org/viewvc?rev=801317&view=rev
Log:
Added option to quick ship test orders

Modified:
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=801317&r1=801316&r2=801317&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Wed Aug  5 17:22:00 2009
@@ -855,6 +855,7 @@
         <attribute name="currencyUomId" type="String" mode="IN" optional="true" default-value="USD"/>
         <attribute name="partyId" type="String" mode="IN" optional="true" default-value="DemoCustomer"/>
         <attribute name="numberOfOrders" type="Integer" mode="IN" optional="true" default-value="10"/>
+        <attribute name="shipOrder" type="Boolean" mode="IN" optional="true" default-value="false"/>
         <attribute name="numberOfProductsPerOrder" type="Integer" mode="IN" optional="true" default-value="5"/>
         <attribute name="salesChannel" type="String" mode="IN" optional="true"/>
     </service>
@@ -868,6 +869,8 @@
         <attribute name="partyId" type="String" mode="IN" optional="true" default-value="DemoCustomer"/>
         <attribute name="numberOfProductsPerOrder" type="Integer" mode="IN" optional="true" default-value="5"/>
         <attribute name="salesChannel" type="String" mode="IN" optional="true"/>
+        <attribute name="shipOrder" type="Boolean" mode="IN" optional="true" default-value="false"/>
+        <attribute name="orderId" type="String" mode="OUT" optional="false"/>
     </service>
 
     <service name="changeOrderPaymentStatus" engine="java" auth="true"

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java?rev=801317&r1=801316&r2=801317&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java Wed Aug  5 17:22:00 2009
@@ -57,7 +57,9 @@
         for (int i = 1; i <= numberOfOrdersInt; i++) {
             try {
                 ModelService modelService = dctx.getModelService("createTestSalesOrderSingle");
-                dispatcher.runSync("createTestSalesOrderSingle", modelService.makeValid(context, ModelService.IN_PARAM));
+                Map outputMap = dispatcher.runSync("createTestSalesOrderSingle", modelService.makeValid(context, ModelService.IN_PARAM));
+                String orderId = (String)outputMap.get("orderId");
+                Debug.logInfo("Test sales order with id [" + orderId + "] has been processed.", module);
             } catch (GenericServiceException e) {
                 String errMsg = "Error calling createTestSalesOrderSingle: " + e.toString();
                 Debug.logError(e, errMsg, module);
@@ -139,13 +141,24 @@
         Map orderCreateResult = checkout.createOrder(userLogin);
         String orderId = (String) orderCreateResult.get("orderId");
 
+        Map resultMap = ServiceUtil.returnSuccess();
         // approve the order
         if (UtilValidate.isNotEmpty(orderId)) {
             Debug.logInfo("Created test order with id: " + orderId, module);
             boolean approved = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId);
             Debug.logInfo("Test order with id: " + orderId + " has been approved: " + approved, module);
+            resultMap.put("orderId", orderId);
+        }
+        Boolean shipOrder = (Boolean) context.get("shipOrder");
+        if (shipOrder.booleanValue() && UtilValidate.isNotEmpty(orderId)) {
+            try {
+                Map outputMap = dispatcher.runSync("quickShipEntireOrder", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin));
+                Debug.logInfo("Test sales order with id [" + orderId + "] has been shipped", module);
+            } catch (Exception exc) {
+                Debug.logWarning("Unable to quick ship test sales order with id [" + orderId + "] with error: " + exc.getMessage(), module);
+            }
         }
 
-        return ServiceUtil.returnSuccess();
+        return resultMap;
     }
 }