svn commit: r631895 - in /ofbiz/trunk/applications/product: src/org/ofbiz/product/test/InventoryItemTransferTest.java testdef/FacilityTest.xml

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

svn commit: r631895 - in /ofbiz/trunk/applications/product: src/org/ofbiz/product/test/InventoryItemTransferTest.java testdef/FacilityTest.xml

mor-2
Author: mor
Date: Thu Feb 28 00:58:54 2008
New Revision: 631895

URL: http://svn.apache.org/viewvc?rev=631895&view=rev
Log:
Test case for Inventory Item Transfer
Applied patch from Jira issue OFBIZ-1471 (https://issues.apache.org/jira/browse/OFBIZ-1471)
With modification to the class name.
Thanks to Ratnesh Upadhyay for testing and posting a improved patch

Added:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
Modified:
    ofbiz/trunk/applications/product/testdef/FacilityTest.xml

Added: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java?rev=631895&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java (added)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/InventoryItemTransferTest.java Thu Feb 28 00:58:54 2008
@@ -0,0 +1,83 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.ofbiz.product.test;
+
+import junit.framework.TestCase;
+
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilDateTime;
+
+import java.util.Map;
+import javolution.util.FastMap;
+
+public class InventoryItemTransferTest extends TestCase {
+
+    protected LocalDispatcher dispatcher = null;
+    protected GenericDelegator delegator = null;
+    protected GenericValue userLogin = null;
+    protected static String inventoryTransferId = null;
+    protected double transferQty = 1;
+
+    public InventoryItemTransferTest(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception {
+        delegator = GenericDelegator.getGenericDelegator("test");
+        dispatcher = GenericDispatcher.getLocalDispatcher("test-dispatcher", delegator);
+        userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", "system"));
+    }
+
+    protected void tearDown() throws Exception {
+    }
+    
+    public void testCreateInventoryItemsTransfer() throws Exception {
+        Map ctx = FastMap.newInstance();
+        String statusId = "IXF_REQUESTED";
+        String inventoryItemId = "9005";
+        ctx.put("inventoryItemId", inventoryItemId);
+        ctx.put("statusId", statusId );
+        ctx.put("facilityId", "WebStoreWarehouse");
+        ctx.put("facilityIdTo", "WebStoreWarehouse");
+        ctx.put("receiveDate", UtilDateTime.nowTimestamp());
+        ctx.put("xferQty", new Double (transferQty));
+        ctx.put("userLogin", userLogin);
+        Map resp = dispatcher.runSync("createInventoryTransfer", ctx);
+        inventoryTransferId = (String) resp.get("inventoryTransferId");
+        assertNotNull(inventoryTransferId);
+    }
+    
+    public void testUpdateInventoryItemTransfer() throws Exception {
+        Map ctx = FastMap.newInstance();
+        String statusId = "IXF_COMPLETE";
+        ctx.put("inventoryTransferId", inventoryTransferId);
+        String inventoryItemId = delegator.findByPrimaryKey("InventoryTransfer", UtilMisc.toMap("inventoryTransferId", inventoryTransferId)).getString("inventoryItemId");
+        ctx.put("inventoryItemId", inventoryItemId);
+        ctx.put("statusId", statusId);
+        ctx.put("userLogin", userLogin);
+        Map resp = dispatcher.runSync("updateInventoryTransfer", ctx);
+        String respMsg = (String) resp.get("responseMessage");
+        assertNotSame("error", respMsg);
+    }
+}      

Modified: ofbiz/trunk/applications/product/testdef/FacilityTest.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/testdef/FacilityTest.xml?rev=631895&r1=631894&r2=631895&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/testdef/FacilityTest.xml (original)
+++ ofbiz/trunk/applications/product/testdef/FacilityTest.xml Thu Feb 28 00:58:54 2008
@@ -24,4 +24,7 @@
     <test-case case-name="stockMove-test">
         <junit-test-suite class-name="org.ofbiz.product.test.StockMovesTest"/>
     </test-case>
+    <test-case case-name="inventoryItemTransfer-test">
+        <junit-test-suite class-name="org.ofbiz.product.test.InventoryItemTransferTest"/>
+    </test-case>    
 </test-suite>