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 2010/02/09 16:21:06 UTC

svn commit: r908069 - /ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml

Author: jacopoc
Date: Tue Feb  9 15:21:06 2010
New Revision: 908069

URL: http://svn.apache.org/viewvc?rev=908069&view=rev
Log:
Automated test for the production run start date change; misc minor fixes to a cople of assert statement of another test.

Modified:
    ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml

Modified: ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml?rev=908069&r1=908068&r2=908069&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml (original)
+++ ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml Tue Feb  9 15:21:06 2010
@@ -56,8 +56,8 @@
             <if-compare-field field="productionRunHeader.facilityId" operator="equals" to-field="facilityId"/>
             <if-compare field="productionRunHeader.currentStatusId" operator="equals" value="PRUN_CREATED"/>
             <if-compare-field field="productionRunHeader.quantityToProduce" operator="equals" to-field="quantity"/>
-            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunStartDate"/>
-            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="less" to-field="productionRunHeader.estimatedCompletionDate"/>
+            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunStartDate" type="Timestamp"/>
+            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="less" to-field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
         </assert>
 
         <entity-and list="productionRunProducts" entity-name="WorkEffortGoodStandard">
@@ -84,8 +84,8 @@
             <if-compare field="productionRunTask.fixedAssetId" operator="equals" value="WORKCENTER_COST"/>
             <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
             <if-compare-field field="productionRunTask.quantityToProduce" operator="equals" to-field="quantity"/>
-            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunTask.estimatedStartDate"/>
-            <if-compare-field field="productionRunHeader.estimatedCompletionDate" operator="equals" to-field="productionRunTask.estimatedCompletionDate"/>
+            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunTask.estimatedStartDate" type="Timestamp"/>
+            <if-compare-field field="productionRunHeader.estimatedCompletionDate" operator="equals" to-field="productionRunTask.estimatedCompletionDate" type="Timestamp"/>
             <if-compare field="productionRunTask.estimatedSetupMillis" operator="equals" value="600000.00" type="BigDecimal"/>
             <if-compare field="productionRunTask.estimatedMilliSeconds" operator="equals" value="300000.00" type="BigDecimal"/>
         </assert>
@@ -114,7 +114,6 @@
         <check-errors/>
     </simple-method>
 
-
     <simple-method method-name="testProductionRunScheduleConfirm" short-description="Test the production run status change to scheduled and confirmed" login-required="false">
         <set field="productId" value="PROD_MANUF"/>
         <set field="facilityId" value="WebStoreWarehouse"/>
@@ -200,4 +199,65 @@
         <check-errors/>
     </simple-method>
 
+    <simple-method method-name="testProductionRunDateChange" short-description="Test the production run start date change" login-required="false">
+        <set field="productId" value="PROD_MANUF"/>
+        <set field="facilityId" value="WebStoreWarehouse"/>
+        <set field="quantity" value="5.0" type="BigDecimal"/>
+        <now-timestamp field="nowTimestamp"/>
+        <set-calendar field="productionRunStartDate" from-field="nowTimestamp" days="1"/>
+
+        <entity-one entity-name="UserLogin" value-field="userLogin">
+            <field-map field-name="userLoginId" value="admin"/>
+        </entity-one>
+        <set field="serviceCtx.userLogin" from-field="userLogin"/>
+        <set field="serviceCtx.productId" from-field="productId"/>
+        <set field="serviceCtx.pRQuantity" from-field="quantity"/>
+        <set field="serviceCtx.startDate" from-field="productionRunStartDate"/>
+        <set field="serviceCtx.facilityId" from-field="facilityId"/>
+
+        <call-service service-name="createProductionRun" in-map-name="serviceCtx">
+            <result-to-field result-name="productionRunId"/>
+        </call-service>
+        <clear-field field="serviceCtx"/>
+        <set field="serviceCtx.userLogin" from-field="userLogin"/>
+        <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
+        <set field="serviceCtx.statusId" value="PRUN_SCHEDULED"/>
+        <call-service service-name="quickChangeProductionRunStatus" in-map-name="serviceCtx"/>
+
+        <!-- the tests -->
+        <entity-one entity-name="WorkEffort" value-field="productionRunHeader">
+            <field-map field-name="workEffortId" from-field="productionRunId"/>
+        </entity-one>
+        <entity-and list="productionRunTasks" entity-name="WorkEffort">
+            <field-map field-name="workEffortParentId" from-field="productionRunId"/>
+        </entity-and>
+        <first-from-list entry="productionRunTask" list="productionRunTasks"/>
+
+        <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="originalProductionRunEstimatedTime">
+            <field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
+            <field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
+        </call-class-method>
+
+        <set-calendar field="productionRunNewStartDate" from-field="nowTimestamp" days="8"/>
+        <clear-field field="serviceCtx"/>
+        <set field="serviceCtx.userLogin" from-field="userLogin"/>
+        <set field="serviceCtx.productionRunId" from-field="productionRunId"/>
+        <set field="serviceCtx.estimatedStartDate" from-field="productionRunNewStartDate"/>
+        <call-service service-name="updateProductionRun" in-map-name="serviceCtx"/>
+
+        <refresh-value value-field="productionRunHeader"/>
+        <refresh-value value-field="productionRunTask"/>
+        <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getInterval" ret-field="newProductionRunEstimatedTime">
+            <field field="productionRunHeader.estimatedStartDate" type="Timestamp"/>
+            <field field="productionRunHeader.estimatedCompletionDate" type="Timestamp"/>
+        </call-class-method>
+        <assert>
+            <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
+            <if-compare-field field="productionRunTask.estimatedStartDate" operator="equals" to-field="productionRunNewStartDate" type="Timestamp"/>
+            <if-compare-field field="originalProductionRunEstimatedTime" operator="equals" to-field="newProductionRunEstimatedTime" type="Double"/>
+        </assert>
+
+        <check-errors/>
+    </simple-method>
+
 </simple-methods>
\ No newline at end of file