svn commit: r631224 - in /ofbiz/trunk/applications/product: ofbiz-component.xml src/org/ofbiz/product/test/ src/org/ofbiz/product/test/StockMovesTest.java testdef/ 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: r631224 - in /ofbiz/trunk/applications/product: ofbiz-component.xml src/org/ofbiz/product/test/ src/org/ofbiz/product/test/StockMovesTest.java testdef/ testdef/FacilityTest.xml

mor-2
Author: mor
Date: Tue Feb 26 06:25:53 2008
New Revision: 631224

URL: http://svn.apache.org/viewvc?rev=631224&view=rev
Log:
Applied patch from Jira Issue OFBIZ-1470 (https://issues.apache.org/jira/browse/OFBIZ-1470)
This issue is about a test case relating to Stock Moves functionality in facility.

Thanks to Alok Agnihotri for testing this patch.

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

Modified: ofbiz/trunk/applications/product/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/ofbiz-component.xml?rev=631224&r1=631223&r2=631224&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/product/ofbiz-component.xml Tue Feb 26 06:25:53 2008
@@ -57,6 +57,9 @@
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas_shipment.xml"/>
 
+    <!-- test suite -->
+    <test-suite loader="main" location="testdef/FacilityTest.xml"/>
+    
     <webapp name="catalog" title="Catalog" server="default-server" location="webapp/catalog"
         base-permission="OFBTOOLS,CATALOG" mount-point="/catalog"/>
     <webapp name="facility" title="Facility" server="default-server" location="webapp/facility"

Added: ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java?rev=631224&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java (added)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/test/StockMovesTest.java Tue Feb 26 06:25:53 2008
@@ -0,0 +1,85 @@
+/*
+ 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 java.util.ArrayList;
+import java.util.Map;
+import java.util.List;
+import javolution.util.FastMap;
+
+/**
+ * Facility Tests
+ */
+public class StockMovesTest extends TestCase {
+
+    protected LocalDispatcher dispatcher = null;
+    protected GenericDelegator delegator = null;
+    protected GenericValue userLogin = null;
+
+    public StockMovesTest(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 testStockMoves() throws Exception {
+        Map fsmnCtx = FastMap.newInstance();
+        Map stockMoveHandled = null;
+        List warningList = new ArrayList();
+        
+        fsmnCtx.put("facilityId", "WebStoreWarehouse");
+        fsmnCtx.put("userLogin", userLogin);
+        Map respMap1 = dispatcher.runSync("findStockMovesNeeded", fsmnCtx);
+        stockMoveHandled = (Map) respMap1.get("stockMoveHandled");
+        warningList = (List) respMap1.get("warningMessageList");
+        assertNull(warningList);
+        
+        if (stockMoveHandled != null) {
+            fsmnCtx.put("stockMoveHandled", stockMoveHandled);
+        }
+        Map respMap2 = dispatcher.runSync("findStockMovesRecommended", fsmnCtx);
+        warningList = (List) respMap2.get("warningMessageList");
+        assertNull(warningList);
+        
+        Map ppsmCtx = FastMap.newInstance();
+        ppsmCtx.put("productId", "GZ-2644");
+        ppsmCtx.put("facilityId", "WebStoreWarehouse");
+        ppsmCtx.put("locationSeqId","TLTLTLUL01" );
+        ppsmCtx.put("targetLocationSeqId", "TLTLTLLL01");
+        ppsmCtx.put("quantityMoved", new Double(5));
+        ppsmCtx.put("userLogin", userLogin);
+        Map respMap3 = dispatcher.runSync("processPhysicalStockMove", ppsmCtx);
+    }
+}    
\ No newline at end of file

Added: ofbiz/trunk/applications/product/testdef/FacilityTest.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/testdef/FacilityTest.xml?rev=631224&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/testdef/FacilityTest.xml (added)
+++ ofbiz/trunk/applications/product/testdef/FacilityTest.xml Tue Feb 26 06:25:53 2008
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<test-suite suite-name="facilitytests"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd">
+    <test-case case-name="stockMove-test">
+        <junit-test-suite class-name="org.ofbiz.product.test.StockMovesTest"/>
+    </test-case>
+</test-suite>
\ No newline at end of file