Author: jacopoc
Date: Tue Feb 16 16:17:10 2010
New Revision: 910576
URL: http://svn.apache.org/viewvc?rev=910576&view=rev
Log:
new automated test for createProductionRunFromRequirement
Modified:
ofbiz/trunk/applications/manufacturing/script/org/ofbiz/manufacturing/test/ProductionRunTests.xml
ofbiz/trunk/applications/manufacturing/testdef/data/ManufacturingTestsData.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=910576&r1=910575&r2=910576&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 16 16:17:10 2010
@@ -944,7 +944,65 @@
<if-compare-field field="producedMaterial.inventoryItemId" operator="equals"
to-field="newOrderItemShipGrpInvRes.inventoryItemId"/>
<not><if-compare-field field="producedMaterial.inventoryItemId" operator="equals"
to-field="newOrderItemShipGrpInvRes.inventoryItemId"/></not>
</assert>
-
+ </simple-method>
+
+ <simple-method method-name="testCreateProductionRunForRequirement" short-description="Test
the creation of a production run for a specified requirement" login-required="false">
+ <set field="productId" value="PROD_MANUF"/>
+ <now-timestamp field="nowTimestamp"/>
+ <set-calendar field="startDate" from-field="nowTimestamp" days="1"/>
+
+ <entity-one entity-name="UserLogin" value-field="userLogin">
+ <field-map field-name="userLoginId" value="TestSupplyAdmin"/>
+ </entity-one>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+ <set field="serviceCtx.productId" from-field="productId"/>
+ <set field="serviceCtx.requirementTypeId" value="INTERNAL_REQUIREMENT"/>
+ <set field="serviceCtx.facilityId" value="WebStoreWarehouse"/>
+ <set field="serviceCtx.requirementStartDate" from-field="startDate"/>
+
+ <call-service service-name="createRequirement" in-map-name="serviceCtx">
+ <result-to-field result-name="requirementId"/>
+ </call-service>
+
+ <set field="nowTime" value="${date:nowTimestamp()}" type="Timestamp"/>
+ <set field="serviceCtx.userLogin" from-field="userLogin"/>
+ <set field="serviceCtx.requirementId" from-field="requirementId"/>
+ <set field="serviceCtx.statusId" value="REQ_APPROVED"/>
+ <call-service service-name="updateRequirement" in-map-name="serviceCtx"/>
+
+ <entity-condition list="workEfforts" entity-name="WorkEffort">
+ <condition-list>
+ <condition-expr field-name="lastUpdatedStamp" operator="greater-equals"
from-field="nowTime"/>
+ <condition-expr field-name="workEffortTypeId" value="PROD_ORDER_HEADER"/>
+ </condition-list>
+ </entity-condition>
+ <first-from-list entry="productionRunHeader" list="workEfforts"/>
+ <entity-and list="productionRunTasks" entity-name="WorkEffort">
+ <field-map field-name="workEffortParentId" from-field="productionRunHeader.productionRunId"/>
+ </entity-and>
+ <first-from-list entry="productionRunTask" list="productionRunTasks"/>
+
+ <assert>
+ <if-compare field="productionRunHeader.workEffortTypeId" operator="equals"
value="PROD_ORDER_HEADER"/>
+ <if-compare field="productionRunHeader.facilityId" operator="equals" value="WebStoreWarehouse"/>
+ <if-compare field="productionRunHeader.currentStatusId" operator="equals"
value="PRUN_CREATED"/>
+ <if-compare field="productionRunTask.currentStatusId" operator="equals" value="PRUN_CREATED"/>
+ <if-compare field="productionRunHeader.quantityToProduce" operator="equals"
value="1.0" type="BigDecimal"/>
+ <if-compare-field field="productionRunHeader.estimatedStartDate" operator="equals"
to-field="startDate" type="Timestamp"/>
+ <if-compare-field field="productionRunTask.estimatedStartDate" operator="equals"
to-field="startDate" type="Timestamp"/>
+ </assert>
+
+ <entity-and list="productionRunProducts" entity-name="WorkEffortGoodStandard">
+ <field-map field-name="workEffortId" from-field="productionRunId"/>
+ </entity-and>
+ <first-from-list entry="productionRunProduct" list="productionRunProducts"/>
+
+ <assert>
+ <not><if-empty field="productionRunProduct"/></not>
+ <if-compare-field field="productionRunProduct.productId" operator="equals"
to-field="productId"/>
+ <if-compare field="productionRunProduct.workEffortGoodStdTypeId" operator="equals"
value="PRUN_PROD_DELIV"/>
+ <if-compare field="productionRunProduct.estimatedQuantity" operator="equals"
value="1.0" type="BigDecimal"/>
+ </assert>
</simple-method>
</simple-methods>
\ No newline at end of file
Modified: ofbiz/trunk/applications/manufacturing/testdef/data/ManufacturingTestsData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/testdef/data/ManufacturingTestsData.xml?rev=910576&r1=910575&r2=910576&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/testdef/data/ManufacturingTestsData.xml (original)
+++ ofbiz/trunk/applications/manufacturing/testdef/data/ManufacturingTestsData.xml Tue Feb
16 16:17:10 2010
@@ -35,4 +35,12 @@
<Person partyId="TestManufAdmin" firstName="Manufacturing" lastName="Admin"/>
<UserLogin partyId="TestManufAdmin" userLoginId="TestManufAdmin"/>
<UserLoginSecurityGroup userLoginId="TestManufAdmin" groupId="MANUFADMIN" fromDate="2001-05-13
00:00:00"/>
+ <SecurityGroup groupId="SUPPLYADMIN" description="Supply Chain Admin group, has permissions
to execute requirement based manufacturing tasks."/>
+ <SecurityGroupPermission groupId="SUPPLYADMIN" permissionId="MANUFACTURING_VIEW"/>
+ <SecurityGroupPermission groupId="SUPPLYADMIN" permissionId="WORKEFFORTMGR_CREATE"/>
+ <SecurityGroupPermission groupId="SUPPLYADMIN" permissionId="WORKEFFORTMGR_UPDATE"/>
+ <Party partyId="TestSupplyAdmin" partyTypeId="PERSON"/>
+ <Person partyId="TestSupplyAdmin" firstName="Supply" lastName="Admin"/>
+ <UserLogin partyId="TestSupplyAdmin" userLoginId="TestSupplyAdmin"/>
+ <UserLoginSecurityGroup userLoginId="TestSupplyAdmin" groupId="SUPPLYADMIN" fromDate="2001-05-13
00:00:00"/>
</entity-engine-xml>
|