details:   /erp/devel/pi/rev/5c1f2b2560f0
changeset: 12257:5c1f2b2560f0
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri May 20 03:37:45 2011 +1100
summary:   Fixes issue 17262: Test registry is empty

diffstat:

 config/Openbravo.properties.template                                           
                      |  5 +++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-test-registry.js
 |  6 ++----
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java
        |  6 ++++++
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
     |  1 +
 4 files changed, 14 insertions(+), 4 deletions(-)

diffs (65 lines):

diff -r 6b74b3730930 -r 5c1f2b2560f0 config/Openbravo.properties.template
--- a/config/Openbravo.properties.template      Thu May 19 18:29:54 2011 +0200
+++ b/config/Openbravo.properties.template      Fri May 20 03:37:45 2011 +1100
@@ -185,3 +185,8 @@
 # You are not allowed to run ant commands with the root user.
 # Set allow.root to true to override this.
 allow.root=false
+
+# Specifies if the current instance is used for automated tests.
+# Setting this to true will enable extra (hidden) functionality used 
+# automated test scripts.
+test.environment=false
\ No newline at end of file
diff -r 6b74b3730930 -r 5c1f2b2560f0 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-test-registry.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-test-registry.js
      Thu May 19 18:29:54 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-test-registry.js
      Fri May 20 03:37:45 2011 +1100
@@ -34,7 +34,7 @@
   var fullUrl = parent.document.URL;
   var queryString = fullUrl.substring(fullUrl.indexOf('?') + 1, 
fullUrl.length);
   var isTestEnvironment = queryString.indexOf('test=true') !== -1;
-  if (isTestEnvironment) {
+  if (isTestEnvironment || OB.Application.testEnvironment) {
     isc.Log.logDebug('Test Environment, registering test components enabled', 
'OB');
   } else {
     isc.Log.logDebug('No Test Environment, registering test components 
disabled', 'OB');
@@ -46,11 +46,9 @@
   TestRegistry.prototype = {
 
     registry: {},
-
-    testEnvironment: false,
     
     register: function(key, object){
-      if (isTestEnvironment || this.testEnvironment) {
+      if (isTestEnvironment || OB.Application.testEnvironment) {
         isc.Log.logDebug('Registering ' + key + ' in test registry ', 'OB');
         this.registry[key] = object;
       }
diff -r 6b74b3730930 -r 5c1f2b2560f0 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java
     Thu May 19 18:29:54 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java
     Fri May 20 03:37:45 2011 +1100
@@ -64,6 +64,12 @@
     return getFormatDefinition().getDecimalSymbol();
   }
 
+  public boolean isTestEnvironment() {
+    final String testEnvironmentStr = 
OBPropertiesProvider.getInstance().getOpenbravoProperties()
+        .getProperty("test.environment");
+    return testEnvironmentStr != null && "true".equals(testEnvironmentStr);
+  }
+
   public String getDefaultNumericMask() {
     return getFormatDefinition().getFormat();
   }
diff -r 6b74b3730930 -r 5c1f2b2560f0 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
--- 
a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
  Thu May 19 18:29:54 2011 +0200
+++ 
b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
  Fri May 20 03:37:45 2011 +1100
@@ -20,6 +20,7 @@
 
 var OB = {
     Application : {
+        testEnvironment: ${data.testEnvironment?string},
         language: '${data.languageId?js_string}',
         language_string: '${data.language?js_string}',
         systemVersion : '${data.systemVersion?js_string}', // global version 
used in all hyperlinks

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to