manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1164524 - in /incubator/lcf/trunk: ./ framework/ framework/script-engine/ framework/script-engine/src/test/ framework/script-engine/src/test/java/ framework/script-engine/src/test/java/org/ framework/script-engine/src/test/java/org/apache/...
Date Fri, 02 Sep 2011 13:29:27 GMT
Author: kwright
Date: Fri Sep  2 13:29:25 2011
New Revision: 1164524

URL: http://svn.apache.org/viewvc?rev=1164524&view=rev
Log:
Add infrastructure and single test for script engine test suite.  Also turned on better output
for all test runs, in case they fail.

Added:
    incubator/lcf/trunk/framework/script-engine/src/test/
    incubator/lcf/trunk/framework/script-engine/src/test/java/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
  (with props)
    incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
  (with props)
Modified:
    incubator/lcf/trunk/build.xml
    incubator/lcf/trunk/framework/build.xml
    incubator/lcf/trunk/framework/script-engine/pom.xml

Modified: incubator/lcf/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/build.xml?rev=1164524&r1=1164523&r2=1164524&view=diff
==============================================================================
--- incubator/lcf/trunk/build.xml (original)
+++ incubator/lcf/trunk/build.xml Fri Sep  2 13:29:25 2011
@@ -1806,7 +1806,7 @@
 
     <target name="run-filesystem-tests" depends="compile-filesystem-tests,calculate-filesystem-tests-condition"
if="filesystem-tests.include">
         <mkdir dir="test-output/filesystem"/>
-        <junit fork="true" maxmemory="128m" dir="test-output/filesystem" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output/filesystem" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -1831,6 +1831,8 @@
 	      </fileset>
                 <pathelement location="build/filesystem-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.filesystem_tests.SanityTest" todir="test-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.APISanityTest" todir="test-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.HopcountTest" todir="test-output/filesystem"/>
@@ -1841,7 +1843,7 @@
 
     <target name="run-cmis-tests" depends="compile-cmis-tests,calculate-cmis-tests-condition"
if="cmis-tests.include">
         <mkdir dir="test-output/cmis"/>
-        <junit fork="true" maxmemory="128m" dir="test-output/cmis" showoutput="true" haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output/cmis" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -1869,6 +1871,8 @@
 	      </fileset>
                 <pathelement location="build/cmis-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+	    
             <test name="org.apache.manifoldcf.cmis_tests.APISanityTest" todir="test-output/cmis"/>
             <!-- MHL -->
         </junit>
@@ -1876,7 +1880,7 @@
 
     <target name="run-sharepoint-tests" depends="compile-sharepoint-tests,calculate-sharepoint-tests-condition"
if="sharepoint-tests.include">
         <mkdir dir="test-output/sharepoint"/>
-        <junit fork="true" maxmemory="128m" dir="test-output/sharepoint" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output/sharepoint" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -1901,13 +1905,15 @@
 	      </fileset>
                 <pathelement location="build/sharepoint-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <!-- MHL -->
         </junit>
     </target>
 
     <target name="run-filesystem-tests-postgresql" depends="compile-filesystem-tests,calculate-filesystem-tests-condition"
if="filesystem-tests.include">
         <mkdir dir="test-postgresql-output/filesystem"/>
-        <junit fork="true" maxmemory="128m" dir="test-postgresql-output/filesystem" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-postgresql-output/filesystem" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -1932,6 +1938,8 @@
 	      </fileset>
                 <pathelement location="build/filesystem-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.filesystem_tests.SanityPostgresqlTest" todir="test-postgresql-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.APISanityPostgresqlTest"
todir="test-postgresql-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.HopcountPostgresqlTest"
todir="test-postgresql-output/filesystem"/>
@@ -1942,7 +1950,7 @@
 
     <target name="run-filesystem-tests-HSQLDB" depends="compile-filesystem-tests,calculate-filesystem-tests-condition"
if="filesystem-tests.include">
         <mkdir dir="test-HSQLDB-output/filesystem"/>
-        <junit fork="true" maxmemory="128m" dir="test-HSQLDB-output/filesystem" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-HSQLDB-output/filesystem" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -1967,6 +1975,8 @@
 	      </fileset>
                 <pathelement location="build/filesystem-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.filesystem_tests.SanityHSQLDBTest" todir="test-HSQLDB-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.APISanityHSQLDBTest" todir="test-HSQLDB-output/filesystem"/>
             <test name="org.apache.manifoldcf.filesystem_tests.HopcountHSQLDBTest" todir="test-HSQLDB-output/filesystem"/>
@@ -1977,7 +1987,7 @@
 
     <target name="run-sharepoint-tests-postgresql" depends="compile-sharepoint-tests,calculate-sharepoint-tests-condition"
if="sharepoint-tests.include">
         <mkdir dir="test-postgresql-output/sharepoint"/>
-        <junit fork="true" maxmemory="128m" dir="test-postgresql-output/sharepoint" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-postgresql-output/sharepoint" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -2002,13 +2012,15 @@
 	      </fileset>
                 <pathelement location="build/sharepoint-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <!-- MHL -->
         </junit>
     </target>
 
     <target name="run-sharepoint-tests-HSQLDB" depends="compile-sharepoint-tests,calculate-sharepoint-tests-condition"
if="sharepoint-tests.include">
         <mkdir dir="test-postgresql-output/sharepoint"/>
-        <junit fork="true" maxmemory="128m" dir="test-HSQLDB-output/sharepoint" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-HSQLDB-output/sharepoint" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="framework/lib">
                     <include name="*.jar"/>
@@ -2033,6 +2045,8 @@
 	      </fileset>
                 <pathelement location="build/sharepoint-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <!-- MHL -->
         </junit>
     </target>

Modified: incubator/lcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/build.xml?rev=1164524&r1=1164523&r2=1164524&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/build.xml (original)
+++ incubator/lcf/trunk/framework/build.xml Fri Sep  2 13:29:25 2011
@@ -510,7 +510,20 @@
         </javac>
     </target>
 
-    <target name="compile-tests" depends="compile-core-tests,compile-agents-tests,compile-pull-agent-tests"/>
+    <target name="compile-script-engine-tests" depends="compile-core,compile-script-engine">
+        <mkdir dir="build/script-engine-tests/classes"/>
+        <javac srcdir="script-engine/src/test/java" destdir="build/script-engine-tests/classes"
target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
+            <classpath>
+                 <fileset dir="lib"> 
+                    <include name="*.jar"/> 
+                </fileset>
+                <pathelement location="build/core/classes"/>
+                <pathelement location="build/script-engine/classes"/>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="compile-tests" depends="compile-core-tests,compile-agents-tests,compile-pull-agent-tests,compile-script-engine-tests"/>
     
     <target name="jar-core-tests" depends="compile-core-tests">
         <mkdir dir="build/test-jar"/>
@@ -527,13 +540,37 @@
         <jar destfile="build/test-jar/mcf-pull-agent-tests.jar" basedir="build/pull-agent-tests/classes"/>
     </target>
 
-    <target name="jar-tests" depends="jar-core-tests,jar-agents-tests,jar-pull-agent-tests"/>
+    <target name="jar-script-engine-tests" depends="compile-script-engine-tests">
+        <mkdir dir="build/test-jar"/>
+        <jar destfile="build/test-jar/mcf-script-engine-tests.jar" basedir="build/script-engine-tests/classes"/>
+    </target>
+
+    <target name="jar-tests" depends="jar-core-tests,jar-agents-tests,jar-pull-agent-tests,jar-script-engine-tests"/>
 
     <target name="build-tests" depends="jar-tests"/>
 
-    <target name="run-tests" depends="compile-tests">
+    <target name="run-script-engine-tests" depends="compile-core,compile-script-engine,compile-script-engine-tests">
         <mkdir dir="test-output"/>
-        <junit fork="true" maxmemory="128m" dir="test-output" showoutput="true" haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true"
showoutput="true" haltonfailure="true">
+            <classpath>
+                <fileset dir="lib">
+                    <include name="*.jar"/>
+                </fileset>
+                <pathelement location="build/core/classes"/>
+                <pathelement location="build/script-engine/classes"/>
+                <pathelement location="build/script-engine-tests/classes"/>
+            </classpath>
+            <formatter type="brief" usefile="false"/>
+
+            <test name="org.apache.manifoldcf.scriptengine.tests.ExpressionTest" todir="test-output"/>
+            <!-- MHL -->
+            
+        </junit>
+    </target>
+    
+    <target name="run-tests" depends="compile-tests,run-script-engine-tests">
+        <mkdir dir="test-output"/>
+        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="lib">
                     <include name="*.jar"/>
@@ -548,6 +585,8 @@
                 <pathelement location="build/agents-tests/classes"/>
                 <pathelement location="build/pull-agent-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.agents.tests.SanityTest" todir="test-output"/>
             <test name="org.apache.manifoldcf.crawler.tests.SanityTest" todir="test-output"/>
             <!-- MHL -->
@@ -556,7 +595,7 @@
 
     <target name="run-tests-postgresql" depends="compile-tests">
         <mkdir dir="test-output-postgresql"/>
-        <junit fork="true" maxmemory="128m" dir="test-output-postgresql" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output-postgresql" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="lib">
                     <include name="*.jar"/>
@@ -571,6 +610,8 @@
                 <pathelement location="build/agents-tests/classes"/>
                 <pathelement location="build/pull-agent-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.agents.tests.SanityPostgresqlTest" todir="test-output-postgresql"/>
             <test name="org.apache.manifoldcf.crawler.tests.SanityPostgresqlTest" todir="test-output-postgresql"/>
             <!-- MHL -->
@@ -579,7 +620,7 @@
 
     <target name="run-tests-HSQLDB" depends="compile-tests">
         <mkdir dir="test-output-HSQLDB"/>
-        <junit fork="true" maxmemory="128m" dir="test-output-HSQLDB" showoutput="true"
haltonfailure="true">
+        <junit fork="true" maxmemory="128m" dir="test-output-HSQLDB" outputtoformatters="true"
showoutput="true" haltonfailure="true">
             <classpath>
                 <fileset dir="lib">
                     <include name="*.jar"/>
@@ -594,6 +635,8 @@
                 <pathelement location="build/agents-tests/classes"/>
                 <pathelement location="build/pull-agent-tests/classes"/>
             </classpath>
+            <formatter type="brief" usefile="false"/>
+
             <test name="org.apache.manifoldcf.agents.tests.SanityHSQLDBTest" todir="test-output-HSQLDB"/>
             <test name="org.apache.manifoldcf.crawler.tests.SanityHSQLDBTest" todir="test-output-HSQLDB"/>
             <!-- MHL -->

Modified: incubator/lcf/trunk/framework/script-engine/pom.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/pom.xml?rev=1164524&r1=1164523&r2=1164524&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/pom.xml (original)
+++ incubator/lcf/trunk/framework/script-engine/pom.xml Fri Sep  2 13:29:25 2011
@@ -96,6 +96,12 @@
       <artifactId>json</artifactId>
       <version>20090211</version>
     </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 

Added: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java?rev=1164524&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
(added)
+++ incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
Fri Sep  2 13:29:25 2011
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.scriptengine.tests;
+
+import org.apache.manifoldcf.scriptengine.*;
+import org.junit.*;
+import static org.junit.Assert.*;
+
+public class ExpressionTest extends ScriptEngineBase
+{
+
+  @Test
+  public void basicIntOperations()
+    throws Exception
+  {
+    VariableReference vr;
+    vr = evaluateExpression("1+2");
+    assertNotNull(vr);
+    assertEquals(vr.resolve().getIntValue(),3);
+    // MHL
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ExpressionTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java?rev=1164524&view=auto
==============================================================================
--- incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
(added)
+++ incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
Fri Sep  2 13:29:25 2011
@@ -0,0 +1,78 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.scriptengine.tests;
+
+import org.apache.manifoldcf.scriptengine.*;
+import org.junit.*;
+import static org.junit.Assert.*;
+import java.io.*;
+
+public class ScriptEngineBase
+{
+  protected ScriptParser scriptParser = new ScriptParser();
+  
+  @Before
+  public void initializeCommands()
+    throws Exception
+  {
+    scriptParser.addCommand("break",new BreakCommand());
+    scriptParser.addCommand("print",new PrintCommand());
+    scriptParser.addCommand("if",new IfCommand());
+    scriptParser.addCommand("while",new WhileCommand());
+    scriptParser.addCommand("set",new SetCommand());
+    scriptParser.addCommand("insert",new InsertCommand());
+    scriptParser.addCommand("remove",new RemoveCommand());
+    scriptParser.addCommand("error",new ErrorCommand());
+    scriptParser.addCommand("wait",new WaitCommand());
+    
+    scriptParser.addCommand("GET",new GETCommand());
+    scriptParser.addCommand("PUT",new PUTCommand());
+    scriptParser.addCommand("DELETE",new DELETECommand());
+    scriptParser.addCommand("POST", new POSTCommand());
+  }
+
+  @Before
+  public void initializeNewOperations()
+    throws Exception
+  {
+    scriptParser.addNewOperation("configuration",new NewConfiguration());
+    scriptParser.addNewOperation("configurationnode",new NewConfigurationNode());
+    scriptParser.addNewOperation("url",new NewURL());
+    scriptParser.addNewOperation("connectionname",new NewConnectionName());
+    scriptParser.addNewOperation("array",new NewArray());
+    scriptParser.addNewOperation("dictionary",new NewDictionary());
+  }
+  
+  protected VariableReference evaluateExpression(String expression)
+    throws Exception
+  {
+    Reader r = new StringReader(expression);
+    TokenStream ts = new BasicTokenStream(r);
+    return scriptParser.evaluateExpression(ts);
+  }
+  
+  protected boolean executeStatements(String statements)
+    throws Exception
+  {
+    Reader r = new StringReader(statements);
+    TokenStream ts = new BasicTokenStream(r);
+    return scriptParser.parseStatements(ts);
+  }
+
+}

Propchange: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/framework/script-engine/src/test/java/org/apache/manifoldcf/scriptengine/tests/ScriptEngineBase.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message