Related to issue 27362: If in development or the Openbravo.property's 'test.environment' property is true...
authorRafa Alonso <rafael.alonso@openbravo.com>
Tue, 02 Sep 2014 20:17:41 +0200
changeset 24368 f9f85e0ce62c
parent 24367 156f9b687d43
child 24369 e15f9ad57ecb
Related to issue 27362: If in development or the Openbravo.property's 'test.environment' property is true...
- the debug flag is set to true
- the generated javascript will not be compressed (to help debugging in test environments)
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java	Tue Sep 02 17:52:22 2014 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java	Tue Sep 02 20:17:41 2014 +0200
@@ -30,6 +30,7 @@
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
+import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.client.kernel.BaseComponentProvider.ComponentResource;
 import org.openbravo.client.kernel.BaseComponentProvider.ComponentResource.ComponentResourceType;
 import org.openbravo.dal.core.OBContext;
@@ -243,7 +244,8 @@
        * 
        * TODO: don't load the ob-debug.js file if not in use
        */
-      if (isInDevelopment() || referer.indexOf("/ret-") > 0) {
+      if (isInDevelopment()
+          || OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
         sb.insert(0, "var isDebug = true;\n\n");
       }
       sb.append("if (window.onerror && window.onerror.name === '"
@@ -264,7 +266,8 @@
     // when changing development status, system needs to be restarted.
     final String output;
     // in classicmode the isc combined is included, compressing that gives errors
-    if (!isInDevelopment() && !isClassicMode()) {
+    if (!isInDevelopment() && !isClassicMode()
+        && !OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
       output = JSCompressor.getInstance().compress(sb.toString());
     } else {
       output = sb.toString();