details:   /erp/devel/pi/rev/c0a2362bd1ec
changeset: 6479:c0a2362bd1ec
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Feb 24 10:49:26 2010 +0100
summary:   Added test case, related to issue 12426

details:   /erp/devel/pi/rev/f1b39044e9e9
changeset: 6480:f1b39044e9e9
user:      Iván Perdomo <ivan.perdomo <at> openbravo.com>
date:      Wed Feb 24 10:52:44 2010 +0100
summary:   Merge

diffstat:

 src-diagnostics/build.xml                              |   1 +
 src-diagnostics/config/log4j.properties                |  22 ++++
 src-diagnostics/src/Test.java                          |  29 +++++
 src-test/org/openbravo/test/AllTests.java              |   2 +
 src-test/org/openbravo/test/model/ClassLoaderTest.java |  88 ++++++++++++++++++
 5 files changed, 142 insertions(+), 0 deletions(-)

diffs (181 lines):

diff -r 2c3334aee6eb -r f1b39044e9e9 src-diagnostics/build.xml
--- a/src-diagnostics/build.xml Tue Feb 23 21:39:26 2010 +0100
+++ b/src-diagnostics/build.xml Wed Feb 24 10:52:44 2010 +0100
@@ -38,6 +38,7 @@
 
   <path id="diagnostic.class.path">
     <pathelement path="build/classes" />
+    <pathelement path="config"/>
     <fileset dir="WebContent/WEB-INF/lib">
       <include name="**/*.jar" />
     </fileset>
diff -r 2c3334aee6eb -r f1b39044e9e9 src-diagnostics/config/log4j.properties
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src-diagnostics/config/log4j.properties   Wed Feb 24 10:52:44 2010 +0100
@@ -0,0 +1,22 @@
+# *************************************************************************
+# * 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 SL 
+# * All portions are Copyright (C) 2010 Openbravo SL 
+# * All Rights Reserved. 
+# * Contributor(s):  ______________________________________.
+# ************************************************************************
+
+log4j.rootCategory=INFO, C
+log4j.category.org.openbravo=INFO
+log4j.appender.C=org.apache.log4j.ConsoleAppender
+log4j.appender.C.layout=org.apache.log4j.PatternLayout
+
diff -r 2c3334aee6eb -r f1b39044e9e9 src-diagnostics/src/Test.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src-diagnostics/src/Test.java     Wed Feb 24 10:52:44 2010 +0100
@@ -0,0 +1,29 @@
+/*
+ *************************************************************************
+ * 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 SL 
+ * All portions are Copyright (C) 2010 Openbravo SL 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+public class Test {
+
+  /**
+   * Dummy class to test that compilation can be done from Tomcat applications
+   */
+  public static void main(String[] args) {
+
+  }
+
+}
diff -r 2c3334aee6eb -r f1b39044e9e9 src-test/org/openbravo/test/AllTests.java
--- a/src-test/org/openbravo/test/AllTests.java Tue Feb 23 21:39:26 2010 +0100
+++ b/src-test/org/openbravo/test/AllTests.java Wed Feb 24 10:52:44 2010 +0100
@@ -34,6 +34,7 @@
 import org.openbravo.test.dal.MappingGenerationTest;
 import org.openbravo.test.dal.ValidationTest;
 import org.openbravo.test.expression.EvaluationTest;
+import org.openbravo.test.model.ClassLoaderTest;
 import org.openbravo.test.model.OneToManyTest;
 import org.openbravo.test.model.RuntimeModelTest;
 import org.openbravo.test.security.AccessLevelTest;
@@ -77,6 +78,7 @@
     // model
     suite.addTestSuite(RuntimeModelTest.class);
     suite.addTestSuite(OneToManyTest.class);
+    suite.addTestSuite(ClassLoaderTest.class);
 
     // expression
     suite.addTestSuite(EvaluationTest.class);
diff -r 2c3334aee6eb -r f1b39044e9e9 
src-test/org/openbravo/test/model/ClassLoaderTest.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/model/ClassLoaderTest.java    Wed Feb 24 
10:52:44 2010 +0100
@@ -0,0 +1,88 @@
+/*
+ *************************************************************************
+ * 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 SL
+ * All portions are Copyright (C) 2010 Openbravo SL
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.test.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.criterion.Expression;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.ad.domain.ModelImplementation;
+import org.openbravo.test.base.BaseTest;
+
+/**
+ * Tests registered classes in Application Dictionary
+ * 
+ * @author iperdomo
+ */
+public class ClassLoaderTest extends BaseTest {
+
+  private static final Logger log = Logger.getLogger(ClassLoaderTest.class);
+
+  /**
+   * Test if all registered classes in Application Dictionary can be loaded. 
Consistency test to
+   * have a clean web.xml
+   */
+  public void testModelObject() {
+
+    final List<String> notFoundClasses = new ArrayList<String>();
+
+    setSystemAdministratorContext();
+
+    OBCriteria<ModelImplementation> obc = OBDal.getInstance().createCriteria(
+        ModelImplementation.class);
+
+    // "S" - "Servlet"
+    // "C" - "ContextParam"
+    // "L" - "Listener"
+    // "ST" - "Session timeout"
+    // "F" - "Filter"
+    // "R" - "Resource"
+
+    final String[] in = { "S", "L", "F" };
+
+    obc.add(Expression.in(ModelImplementation.PROPERTY_OBJECTTYPE, in));
+
+    for (ModelImplementation mi : obc.list()) {
+      try {
+
+        if (mi.getId().equals("801180")) {
+          // Ugly hack!!!
+          // Check issue
+          // https://issues.openbravo.com/view.php?id=12429
+          continue;
+        }
+
+        // Testing if the defined class can be loaded
+        ClassLoader.getSystemClassLoader().loadClass(mi.getJavaClassName());
+
+      } catch (ClassNotFoundException e) {
+        notFoundClasses.add(mi.getId() + " : " + mi.getJavaClassName());
+      }
+    }
+    if (notFoundClasses.size() > 0) {
+      for (String nf : notFoundClasses) {
+        log.error(nf);
+      }
+    }
+    assertEquals(0, notFoundClasses.size());
+  }
+}

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to