Related to issue 32912: The test has been improved
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Thu, 12 May 2016 11:32:36 +0200
changeset 29501 eea6dae45251
parent 29500 4631e87e35e7
child 29502 bf305189b86e
Related to issue 32912: The test has been improved

The test now checks the correct behavior of the Storage Bin subtab
(of the Warehouse and Storage Bins window).
It has now a private method which is the one that fills up the parameters map.
src-test/src/org/openbravo/test/datasource/EmptyStringWhereAndFilterClauseParameter.java
--- a/src-test/src/org/openbravo/test/datasource/EmptyStringWhereAndFilterClauseParameter.java	Thu May 12 13:59:40 2016 +0200
+++ b/src-test/src/org/openbravo/test/datasource/EmptyStringWhereAndFilterClauseParameter.java	Thu May 12 11:32:36 2016 +0200
@@ -39,18 +39,9 @@
  * 
  */
 public class EmptyStringWhereAndFilterClauseParameter extends BaseDataSourceTestDal {
-  private Map<String, String> params;
-
-  public EmptyStringWhereAndFilterClauseParameter() {
-    params = new HashMap<String, String>();
-    params.put("_targetRecordId", "17435FB915B14A93B51F3A6375B12BEE");
-    params.put("_filterByParentProperty", "priceList");
-    params.put("windowId", "146");
-    params.put("tabId", "238");
-    params.put("_operationType", "fetch");
-    params.put("_startRow", "0");
-    params.put("_endRow", "100");
-  }
+  private static final String WAREHOUSE_AND_STORAGE_BIN_WINDOW_ID = "139";
+  private static final String STORAGE_BIN_TAB_ID = "178";
+  private static final String WAREHOUSE_LOCATOR_ID = "54EB861A446D464EAA433477A1D867A6";
 
   @Test
   public void datasourceRequestStatusShouldBeSuccessful() throws Exception {
@@ -60,9 +51,21 @@
         is(String.valueOf(JsonConstants.RPCREQUEST_STATUS_SUCCESS)));
   }
 
+  private Map<String, String> fillInTheParameters() throws Exception {
+    Map<String, String> params = new HashMap<String, String>();
+    params.put("_targetRecordId", WAREHOUSE_LOCATOR_ID);
+    params.put("_filterByParentProperty", "warehouse");
+    params.put("windowId", WAREHOUSE_AND_STORAGE_BIN_WINDOW_ID);
+    params.put("tabId", STORAGE_BIN_TAB_ID);
+    params.put("_operationType", "fetch");
+    params.put("_startRow", "0");
+    params.put("_endRow", "100");
+    return params;
+  }
+
   private String getDataSourceResponse() throws Exception {
-    String response = doRequest("/org.openbravo.service.datasource/" + "PricingPriceListVersion",
-        params, 200, "POST");
+    String response = doRequest("/org.openbravo.service.datasource/" + "Locator",
+        fillInTheParameters(), 200, "POST");
     return response;
   }