details: https://code.openbravo.com/erp/devel/pi/rev/4032b01dbe02 changeset: 32453:4032b01dbe02 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Jul 14 12:12:33 2017 +0200 summary: fixes 36373: delete js files related to api-checks code in pi
Removed unused test code details: https://code.openbravo.com/erp/devel/pi/rev/022400f75d09 changeset: 32454:022400f75d09 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Jul 14 12:54:19 2017 +0200 summary: fixed bug 36494: dojo GET requests have incorrect Content-Type header GET requests shouldn't include Content-Type header, which was the case for dojo grid requests. Patched dojo to prevent it. details: https://code.openbravo.com/erp/devel/pi/rev/485d1a99a09d changeset: 32455:485d1a99a09d user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Jul 14 13:33:10 2017 +0200 summary: fixed bug 36167: Tree view is not correctly filtered if tab has where clause In case a tab that can be seen in tree mode, has a where clase with any OR, the query generated for the tree view, was not applying this wehere clause corretly because it didn't take into consideration operator precedence. Fixed by isolating tab's where clause in the genereted query. details: https://code.openbravo.com/erp/devel/pi/rev/ec7a1e4535e3 changeset: 32456:ec7a1e4535e3 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Jul 14 14:42:14 2017 +0200 summary: related to bug 36494: patch also dojo.js.uncompressed.js details: https://code.openbravo.com/erp/devel/pi/rev/a9f32d3139f2 changeset: 32457:a9f32d3139f2 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Mon Jul 17 08:18:09 2017 +0200 summary: related to issue 36373: delete js files related to api-checks code in pi Recover previously removed run.test target and remove unneeded run.api.test.javascript diffstat: build.xml | 4 - modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java | 6 +- src-test/build.xml | 8 +- src-test/src/org/openbravo/test/javascript/CompressionTest.java | 39 - src-test/src/org/openbravo/test/javascript/JavaScriptAPIChecker.java | 211 ---- src-test/src/org/openbravo/test/javascript/JavaScriptAPITest.java | 95 -- src-test/src/org/openbravo/test/javascript/JavaScriptAntTest.java | 116 -- src-test/src/org/openbravo/test/javascript/JavaScriptParser.java | 135 --- src-test/src/org/openbravo/test/javascript/test-compression.js | 446 ---------- src/org/openbravo/erpCommon/security/Login.html | 2 +- web/js/dojotoolkit/dojo/_base/xhr.js | 4 +- web/js/dojotoolkit/dojo/dojo.js | 2 +- web/js/dojotoolkit/dojo/dojo.js.uncompressed.js | 5 +- web/js/utils.js | 2 +- 14 files changed, 14 insertions(+), 1061 deletions(-) diffs (truncated from 1196 to 300 lines): diff -r e109968e82aa -r a9f32d3139f2 build.xml --- a/build.xml Wed Jul 12 12:28:55 2017 +0200 +++ b/build.xml Mon Jul 17 08:18:09 2017 +0200 @@ -617,10 +617,6 @@ <target name="run.test" depends="init"> <ant dir="${base.src.test}" target="run.test" inheritAll="true" inheritRefs="true" /> </target> - - <target name="run.api.test.javascript"> - <ant dir="${base.src.test}" target="run.api.test.javascript" inheritAll="true" inheritRefs="true" /> - </target> <target name="run.api.test.model" description="Checks current xml db model and dictionary API for not-allowed changes. Requires stableDBdir parameter"> diff -r e109968e82aa -r a9f32d3139f2 modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java --- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java Wed Jul 12 12:28:55 2017 +0200 +++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/LinkToParentTreeDatasourceService.java Mon Jul 17 08:18:09 2017 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2013-2016 Openbravo SLU + * All portions are Copyright (C) 2013-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -236,7 +236,7 @@ boolean allowNotApplyingWhereClauseToChildren = !tableTree.isApplyWhereClauseToChildNodes(); if ((fetchRoot || !allowNotApplyingWhereClauseToChildren) && hqlWhereClause != null) { // Include the hql where clause for all root nodes and for child nodes only if it is required - whereClause.append(hqlWhereClause + " and "); + whereClause.append("(" + hqlWhereClause + ") and "); } if (hqlWhereClauseRootNodes != null && fetchRoot) { @@ -555,7 +555,7 @@ whereClause.append(".id"); } whereClause.append(" = ? "); - whereClause.append(" and " + hqlWhereClause); + whereClause.append(" and (" + hqlWhereClause + ")"); final OBQuery<BaseOBObject> query = OBDal.getInstance().createQuery(entity.getName(), whereClause.toString()); diff -r e109968e82aa -r a9f32d3139f2 src-test/build.xml --- a/src-test/build.xml Wed Jul 12 12:28:55 2017 +0200 +++ b/src-test/build.xml Mon Jul 17 08:18:09 2017 +0200 @@ -13,7 +13,7 @@ * 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) 2014-2015 Openbravo SLU + * All portions are Copyright (C) 2014-2017 Openbravo SLU * All Rights Reserved. * Contributor(s): Openbravo S.L.U. ************************************************************************ @@ -115,10 +115,4 @@ </test> </junit> </target> - - <target name="run.api.test.javascript" depends="compile.test"> - <taskdef name="jstest" classname="org.openbravo.test.javascript.JavaScriptAntTest" classpathref="test.class.path" /> - <property name="export" value="no" /> - <jstest apiDetailsPath="${api.test.javascript.details}" jsPath="${base.web}/js" export="${export}" /> - </target> </project> \ No newline at end of file diff -r e109968e82aa -r a9f32d3139f2 src-test/src/org/openbravo/test/javascript/CompressionTest.java --- a/src-test/src/org/openbravo/test/javascript/CompressionTest.java Wed Jul 12 12:28:55 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - ************************************************************************* - * The contents of this file are subject to the Openbravo Public License - * Version 1.1 (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-2014 Openbravo SLU - * All Rights Reserved. - * Contributor(s): ______________________________________. - ************************************************************************ - */ - -package org.openbravo.test.javascript; - -import org.junit.Test; -import org.openbravo.test.ant.BaseAntTest; - -/** - * Test the compression of a static js file. - * - * @author mtaal - */ - -public class CompressionTest extends BaseAntTest { - // private static final Logger log = Logger.getLogger(JavaScriptAntTest.class); - - @Test - public void testAntCompression() { - doTest("minimizeJSandCSS"); - } - -} diff -r e109968e82aa -r a9f32d3139f2 src-test/src/org/openbravo/test/javascript/JavaScriptAPIChecker.java --- a/src-test/src/org/openbravo/test/javascript/JavaScriptAPIChecker.java Wed Jul 12 12:28:55 2017 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* - ************************************************************************* - * The contents of this file are subject to the Openbravo Public License - * Version 1.1 (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) 2009-2010 Openbravo SLU - * All Rights Reserved. - * Contributor(s): ______________________________________. - ************************************************************************ - */ -package org.openbravo.test.javascript; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FilenameFilter; -import java.io.IOException; -import java.util.HashMap; - -import org.apache.log4j.Logger; -import org.mozilla.javascript.FunctionNode; -import org.mozilla.javascript.Node; -import org.mozilla.javascript.ScriptOrFnNode; -import org.mozilla.javascript.Token; - -/** - * Checks the API of all .js files on a specific folder. This check verifies that your current - * JavaScript API matches the ones specified in the .details files - * - * @author iperdomo - */ -public class JavaScriptAPIChecker { - private static final Logger log = Logger.getLogger(JavaScriptAPIChecker.class); - private HashMap<String, String> apiMap = new HashMap<String, String>(); - private File apiDetailsFolder = null; - private File jsFolder = null; - private boolean export = false; - - /** - * Returns if the export of .details file should be made - * - * @return true if the export procedure should be made, false if not - */ - public boolean isExport() { - return export; - } - - /** - * Sets the flag to export the .details file - * - * @param export - * boolean that sets that export procedure should be made - */ - public void setExport(boolean export) { - this.export = export; - } - - /** - * Sets the folder where the .details file are located - * - * @param details - */ - public void setDetailsFolder(File details) { - if (!details.isDirectory()) { - throw new RuntimeException("A API (.details) folder path must be passed as parameter"); - } - apiDetailsFolder = details; - } - - /** - * Sets the folder that contains the .js files we want to check - * - * @param jsFolder - */ - public void setJSFolder(File jsFolder) { - if (!jsFolder.isDirectory()) { - throw new RuntimeException("A JavaScript folder path must be passed as parameter"); - } - this.jsFolder = jsFolder; - } - - /** - * Returns a Map with all the broken entries on the API. This map must be empty after running the - * check process - * - * @return a Map containing the broken API - */ - public HashMap<String, String> getAPIMap() { - return apiMap; - } - - /** - * Process all the files defined in the js folder, and checks them against the files in the API - * (.details) folder - */ - public void process() { - if (apiDetailsFolder == null) { - throw new RuntimeException("A JavaScript API details folder must be set"); - } - - if (jsFolder == null) { - throw new RuntimeException("A folder containing the JavaScript files must be set"); - } - - if (isExport()) { // export - // Parsing the .js files and checking it agains the api map - - FilenameFilter jsFilter = new FilenameFilter() { - public boolean accept(File dir, String fileName) { - return fileName.endsWith(".js"); - } - }; - - final JavaScriptParser jsp = new JavaScriptParser(); - - final String[] jsFiles = jsFolder.list(jsFilter); - for (int j = 0; j < jsFiles.length; j++) { - final File jsFile = new File(jsFolder, jsFiles[j]); - jsp.setFile(jsFile); - try { - final File detailFile = new File(apiDetailsFolder, jsFiles[j] + ".details"); - jsp.toFile(detailFile); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - log.info("Export done!"); - } else { // check - FilenameFilter detailsFilter = new FilenameFilter() { - public boolean accept(File dir, String fileName) { - return fileName.endsWith(".details"); - } - }; - - // Building a map with the current API details - final String[] detailFiles = apiDetailsFolder.list(detailsFilter); - for (int i = 0; i < detailFiles.length; i++) { - final File dFile = new File(apiDetailsFolder, detailFiles[i]); - int pos = detailFiles[i].indexOf(".details"); - final String jsFileName = detailFiles[i].substring(0, pos); - String line; - int lineNo = 1; - try { - BufferedReader br = new BufferedReader(new FileReader(dFile)); - while ((line = br.readLine()) != null) { - apiMap.put(jsFileName + line, String.valueOf(lineNo)); - lineNo++; - } - br.close(); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } - - // Parsing the .js files and checking it agains the api map - - FilenameFilter jsFilter = new FilenameFilter() { - public boolean accept(File dir, String fileName) { - return fileName.endsWith(".js"); - } - }; - - final JavaScriptParser jsp = new JavaScriptParser(); - - final String[] jsFiles = jsFolder.list(jsFilter); - for (int j = 0; j < jsFiles.length; j++) { - final File jsFile = new File(jsFolder, jsFiles[j]); - jsp.setFile(jsFile); - try { - checkJS(jsp, jsFiles[j]); - } catch (IOException e) { - log.error(e.getMessage(), e); - } - } - } - } - ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits