Added license to new java classes. Added run.javascript.tests task
authorIván Perdomo <ivan.perdomo@openbravo.com>
Tue, 28 Apr 2009 19:53:09 +0200
changeset 3752 99f93189fbad
parent 3751 11714fc5cfc0
child 3753 1d1dae15f13f
Added license to new java classes. Added run.javascript.tests task
build.xml
src-test/org/openbravo/test/javascript/JavaScriptAPIChecker.java
src-test/org/openbravo/test/javascript/JavaScriptAPITest.java
src-test/org/openbravo/test/javascript/JavaScriptAntTest.java
src-test/org/openbravo/test/javascript/JavaScriptParser.java
src/build.xml
--- a/build.xml	Tue Apr 28 21:52:08 2009 -0400
+++ b/build.xml	Tue Apr 28 19:53:09 2009 +0200
@@ -376,6 +376,10 @@
     <ant dir="${base.src}" target="run.quick.tests" inheritAll="true" inheritRefs="true" />
   </target>
 
+  <target name="run.javascript.tests">
+    <ant dir="${base.src}" target="run.javascript.tests" inheritAll="true" inheritRefs="true" />
+  </target>
+
   <target name="export.sample.data" depends="code.rev">
     <ant dir="${base.src}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
   </target>
--- a/src-test/org/openbravo/test/javascript/JavaScriptAPIChecker.java	Tue Apr 28 21:52:08 2009 -0400
+++ b/src-test/org/openbravo/test/javascript/JavaScriptAPIChecker.java	Tue Apr 28 19:53:09 2009 +0200
@@ -1,3 +1,21 @@
+/*
+ *************************************************************************
+ * 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) 2009 Openbravo SL
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
 package org.openbravo.test.javascript;
 
 import java.io.BufferedReader;
--- a/src-test/org/openbravo/test/javascript/JavaScriptAPITest.java	Tue Apr 28 21:52:08 2009 -0400
+++ b/src-test/org/openbravo/test/javascript/JavaScriptAPITest.java	Tue Apr 28 19:53:09 2009 +0200
@@ -1,5 +1,20 @@
-/**
- * 
+/*
+ *************************************************************************
+ * 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) 2009 Openbravo SL
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
  */
 package org.openbravo.test.javascript;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/javascript/JavaScriptAntTest.java	Tue Apr 28 19:53:09 2009 +0200
@@ -0,0 +1,63 @@
+/*
+ *************************************************************************
+ * 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) 2009 Openbravo SL
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.test.javascript;
+
+import java.io.File;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * @author iperdomo
+ * 
+ */
+public class JavaScriptAntTest extends Task {
+  private JavaScriptAPIChecker jsAPIChecker = null;
+  private String apiDetailsPath = null;
+  private String jsPath = null;
+
+  public String getApiDetailsPath() {
+    return apiDetailsPath;
+  }
+
+  public void setApiDetailsPath(String apiDetailsPath) {
+    this.apiDetailsPath = apiDetailsPath;
+  }
+
+  public String getJsPath() {
+    return jsPath;
+  }
+
+  public void setJsPath(String jsPath) {
+    this.jsPath = jsPath;
+  }
+
+  @Override
+  public void execute() throws BuildException {
+    System.out.println("JS API details folder: " + this.apiDetailsPath);
+    System.out.println("JS folder:" + this.jsPath);
+    jsAPIChecker = new JavaScriptAPIChecker();
+    jsAPIChecker.setDetailsFolder(new File(this.apiDetailsPath));
+    jsAPIChecker.setJSFolder(new File(this.jsPath));
+    jsAPIChecker.process();
+    if (!jsAPIChecker.getAPIMap().isEmpty()) {
+      throw new BuildException("API Map must be empty: " + jsAPIChecker.getAPIMap());
+    }
+  }
+}
--- a/src-test/org/openbravo/test/javascript/JavaScriptParser.java	Tue Apr 28 21:52:08 2009 -0400
+++ b/src-test/org/openbravo/test/javascript/JavaScriptParser.java	Tue Apr 28 19:53:09 2009 +0200
@@ -1,3 +1,21 @@
+/*
+ *************************************************************************
+ * 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) 2009 Openbravo SL
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
 package org.openbravo.test.javascript;
 
 import java.io.BufferedWriter;
--- a/src/build.xml	Tue Apr 28 21:52:08 2009 -0400
+++ b/src/build.xml	Tue Apr 28 19:53:09 2009 +0200
@@ -251,6 +251,11 @@
       <test name="org.openbravo.test.AllQuickAntTaskTests" haltonfailure="no"/>
     </junit>
   </target>
+
+  <target name="run.javascript.tests">
+  	<taskdef name="jstest" classname="org.openbravo.test.javascript.JavaScriptAntTest" classpathref="project.class.path" />
+	<jstest apiDetailsPath="${base.config}" jsPath="${base.web}/js" />
+  </target>
   
   <target name="compileSqlc" depends="sqlc">
     <javac  srcdir="${basedir}:${build.sqlc}/src:${build.sqlc}/srcAD:${base.src.test}:${base.modules}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">