details:   /erp/devel/main/rev/80925690f42b
changeset: 7808:80925690f42b
user:      Harikrishnan Raja <harikrishnan.raja <at> openbravo.com>
date:      Fri Jul 02 17:23:16 2010 +0530
summary:   Fixes issue 12982 Data from Select query is different from the Count 
rows.And test cases for multiple business partner is added.

details:   /erp/devel/main/rev/52b62276390c
changeset: 7809:52b62276390c
user:      RM packaging bot <staff.rm <at> openbravo.com>
date:      Sat Jul 03 04:17:21 2010 +0000
summary:   CI: promote changesets from pi to main

details:   /erp/devel/main/rev/244f7cfdddaf
changeset: 7810:244f7cfdddaf
user:      RM packaging bot <staff.rm <at> openbravo.com>
date:      Sat Jul 03 04:17:22 2010 +0000
summary:   CI: update AD_MODULE - Core version and label

diffstat:

 src-db/database/sourcedata/AD_MODULE.xml                           |   4 +-
 src-test/org/openbravo/erpCommon/info/ClassicSelectorTest.java     |  83 
++++++++++
 src-test/org/openbravo/test/AllAntTaskTests.java                   |   3 +
 src-test/org/openbravo/test/AllQuickAntTaskTests.java              |   4 +-
 src-test/org/openbravo/test/AllTests.java                          |   3 +
 src-test/org/openbravo/test/AntTaskTests.java                      |   3 +
 src/org/openbravo/erpCommon/info/BusinessPartnerMultiple_data.xsql |   3 +-
 7 files changed, 99 insertions(+), 4 deletions(-)

diffs (211 lines):

diff -r c57a3ccf09e2 -r 244f7cfdddaf src-db/database/sourcedata/AD_MODULE.xml
--- a/src-db/database/sourcedata/AD_MODULE.xml  Fri Jul 02 12:13:07 2010 +0200
+++ b/src-db/database/sourcedata/AD_MODULE.xml  Sat Jul 03 04:17:22 2010 +0000
@@ -6,7 +6,7 @@
 <!--0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--0-->  <NAME><![CDATA[core]]></NAME>
-<!--0-->  <VERSION><![CDATA[2.50.17732]]></VERSION>
+<!--0-->  <VERSION><![CDATA[2.50.17809]]></VERSION>
 <!--0-->  <DESCRIPTION><![CDATA[Core module is the base one]]></DESCRIPTION>
 <!--0-->  <HELP><![CDATA[Core module is the base one, all developments in core 
are included as part of the standard Openbravo ERP.]]></HELP>
 <!--0-->  <URL><![CDATA[www.openbravo.com]]></URL>
@@ -21,7 +21,7 @@
 <!--0-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--0-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--0-->  <HASREFERENCEDATA><![CDATA[Y]]></HASREFERENCEDATA>
-<!--0-->  <VERSION_LABEL><![CDATA[dev]]></VERSION_LABEL>
+<!--0-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--0-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--0--></AD_MODULE>
 
diff -r c57a3ccf09e2 -r 244f7cfdddaf 
src-test/org/openbravo/erpCommon/info/ClassicSelectorTest.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/erpCommon/info/ClassicSelectorTest.java    Sat Jul 
03 04:17:22 2010 +0000
@@ -0,0 +1,83 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2010 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.erpCommon.info;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.erpCommon.utility.TableSQLData;
+import org.openbravo.test.base.BaseTest;
+
+/**
+ * Tests consistency between select and countRows methods of the (old) 
selectors in erpCommon/info.
+ * 
+ * Test-class is in this package, to allow access to non-public selector data 
classes.
+ * 
+ * @author huehner
+ */
+public class ClassicSelectorTest extends BaseTest {
+
+  /**
+   * Test BusinessPartnerMultiple selector.
+   */
+  public void testBpartnerMultiple() throws Exception {
+
+    String client = "'1000000'";
+    String org = "'0','1000000'";
+    String key = "";
+    String name = "";
+    String contact = "";
+    String postCode = "";
+    String province = "";
+    String clients = "";
+    String vendors = "";
+    String ciudad = "";
+    String orderBy = "1";
+    checkBpartnerMultiple(client, org, key, name, contact, postCode, province, 
clients, vendors,
+        ciudad, orderBy);
+  }
+
+  private void checkBpartnerMultiple(String client, String org, String key, 
String name,
+      String contact, String postCode, String province, String clients, String 
vendors,
+      String ciudad, String orderBy) throws ServletException {
+    String rownum = "0", oraLimit1 = null, oraLimit2 = null, pgLimit = null;
+    long offset = 0;
+    if (getConnectionProvider().getRDBMS().equalsIgnoreCase("ORACLE")) {
+      oraLimit1 = String.valueOf(offset + TableSQLData.maxRowsPerGridPage);
+      oraLimit2 = (offset + 1) + " AND " + oraLimit1;
+      rownum = "ROWNUM";
+    } else {
+      pgLimit = TableSQLData.maxRowsPerGridPage + " OFFSET " + offset;
+    }
+
+    BusinessPartnerMultipleData data[] = BusinessPartnerMultipleData.select(
+        getConnectionProvider(), rownum, client, org, key, name, contact, 
postCode, province,
+        clients, vendors, ciudad, orderBy, pgLimit, oraLimit1, oraLimit2);
+    String strCount = 
BusinessPartnerMultipleData.countRows(getConnectionProvider(), rownum,
+        client, org, key, name, contact, postCode, province, clients, vendors, 
ciudad, pgLimit,
+        oraLimit1, oraLimit2);
+    long count = Long.valueOf(strCount);
+
+    // check implicit consistency requirement: both select & selectCount 
methods must agree on
+    // number of records available in the selector
+    assertEquals(count, data.length);
+
+  }
+
+}
\ No newline at end of file
diff -r c57a3ccf09e2 -r 244f7cfdddaf 
src-test/org/openbravo/test/AllAntTaskTests.java
--- a/src-test/org/openbravo/test/AllAntTaskTests.java  Fri Jul 02 12:13:07 
2010 +0200
+++ b/src-test/org/openbravo/test/AllAntTaskTests.java  Sat Jul 03 04:17:22 
2010 +0000
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.openbravo.erpCommon.info.ClassicSelectorTest;
 import org.openbravo.test.dal.AdminContextTest;
 import org.openbravo.test.dal.DalComplexQueryRequisitionTest;
 import org.openbravo.test.dal.DalComplexQueryTestOrderLine;
@@ -137,6 +138,8 @@
     // preferences
     suite.addTestSuite(PreferenceTest.class);
 
+    suite.addTestSuite(ClassicSelectorTest.class);
+
     // $JUnit-END$
     return suite;
   }
diff -r c57a3ccf09e2 -r 244f7cfdddaf 
src-test/org/openbravo/test/AllQuickAntTaskTests.java
--- a/src-test/org/openbravo/test/AllQuickAntTaskTests.java     Fri Jul 02 
12:13:07 2010 +0200
+++ b/src-test/org/openbravo/test/AllQuickAntTaskTests.java     Sat Jul 03 
04:17:22 2010 +0000
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.openbravo.erpCommon.info.ClassicSelectorTest;
 import org.openbravo.test.dal.AdminContextTest;
 import org.openbravo.test.dal.DalConnectionProviderTest;
 import org.openbravo.test.dal.DalStoredProcedureTest;
@@ -118,8 +119,9 @@
     // preferences
     suite.addTestSuite(PreferenceTest.class);
 
+    suite.addTestSuite(ClassicSelectorTest.class);
+
     // $JUnit-END$
     return suite;
   }
-
 }
diff -r c57a3ccf09e2 -r 244f7cfdddaf src-test/org/openbravo/test/AllTests.java
--- a/src-test/org/openbravo/test/AllTests.java Fri Jul 02 12:13:07 2010 +0200
+++ b/src-test/org/openbravo/test/AllTests.java Sat Jul 03 04:17:22 2010 +0000
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.openbravo.erpCommon.info.ClassicSelectorTest;
 import org.openbravo.test.dal.DalConnectionProviderTest;
 import org.openbravo.test.dal.DalCopyTest;
 import org.openbravo.test.dal.DalQueryTest;
@@ -94,6 +95,8 @@
     suite.addTestSuite(EntityXMLIssues.class);
     suite.addTestSuite(UniqueConstraintImportTest.class);
 
+    suite.addTestSuite(ClassicSelectorTest.class);
+
     // $JUnit-END$
     return suite;
   }
diff -r c57a3ccf09e2 -r 244f7cfdddaf 
src-test/org/openbravo/test/AntTaskTests.java
--- a/src-test/org/openbravo/test/AntTaskTests.java     Fri Jul 02 12:13:07 
2010 +0200
+++ b/src-test/org/openbravo/test/AntTaskTests.java     Sat Jul 03 04:17:22 
2010 +0000
@@ -22,6 +22,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.openbravo.erpCommon.info.ClassicSelectorTest;
 import org.openbravo.test.dal.DalComplexQueryRequisitionTest;
 import org.openbravo.test.dal.DalComplexQueryTestOrderLine;
 import org.openbravo.test.dal.DalConnectionProviderTest;
@@ -137,6 +138,8 @@
     suite.addTestSuite(UniqueConstraintImportTest.class);
     suite.addTestSuite(DatasetExportTest.class);
 
+    suite.addTestSuite(ClassicSelectorTest.class);
+
     // $JUnit-END$
     return suite;
   }
diff -r c57a3ccf09e2 -r 244f7cfdddaf 
src/org/openbravo/erpCommon/info/BusinessPartnerMultiple_data.xsql
--- a/src/org/openbravo/erpCommon/info/BusinessPartnerMultiple_data.xsql        
Fri Jul 02 12:13:07 2010 +0200
+++ b/src/org/openbravo/erpCommon/info/BusinessPartnerMultiple_data.xsql        
Sat Jul 03 04:17:22 2010 +0000
@@ -82,6 +82,7 @@
             AND bp.AD_Org_ID IN ('1')
             AND l.IsActive='Y'
             AND 1=1
+            GROUP BY bp.C_BPartner_ID, bp.VALUE, bp.NAME, bp.SO_CreditLimit, 
bp.SO_CreditUsed, bp.ActualLifetimeValue, bp.URL
             ) B
             ) A 
       ]]></Sql>
@@ -97,7 +98,7 @@
         <Parameter name="clients" optional="true" type="none" after="AND 
1=1"><![CDATA[AND bp.ISCUSTOMER = 'Y' ]]></Parameter>
         <Parameter name="vendors" optional="true" type="none" after="AND 
1=1"><![CDATA[AND bp.ISVENDOR ='Y']]></Parameter>
         <Parameter name="ciudad" ignoreValue="%" optional="true" after="AND 
1=1"><![CDATA[AND UPPER(a.City) LIKE UPPER(?) ]]></Parameter>
-        <Parameter name="pgLimit" type="argument" optional="true" after="AND 
1=1"><![CDATA[LIMIT ]]></Parameter>
+        <Parameter name="pgLimit" type="argument" optional="true" 
after="bp.URL"><![CDATA[LIMIT ]]></Parameter>
         <Parameter name="oraLimit1" type="argument" optional="true" after=") 
B"><![CDATA[ WHERE ROWNUM <= ]]></Parameter>
         <Parameter name="oraLimit2" type="argument" optional="true" after=") A 
"><![CDATA[WHERE RN1 BETWEEN ]]></Parameter>
    </SqlMethod>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to