You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/01/08 15:46:41 UTC

svn commit: r1228858 - in /incubator/lcf/trunk: ./ tests/jcifs/ tests/jcifs/src/ tests/jcifs/src/test/ tests/jcifs/src/test/java/ tests/jcifs/src/test/java/org/ tests/jcifs/src/test/java/org/apache/ tests/jcifs/src/test/java/org/apache/manifoldcf/ test...

Author: kwright
Date: Sun Jan  8 14:46:41 2012
New Revision: 1228858

URL: http://svn.apache.org/viewvc?rev=1228858&view=rev
Log:
Add first cut of jcifs UI test.  Part of CONNECTORS-339.

Added:
    incubator/lcf/trunk/tests/jcifs/
    incubator/lcf/trunk/tests/jcifs/src/
    incubator/lcf/trunk/tests/jcifs/src/test/
    incubator/lcf/trunk/tests/jcifs/src/test/java/
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java   (with props)
    incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java   (with props)
Modified:
    incubator/lcf/trunk/build.xml

Modified: incubator/lcf/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/build.xml?rev=1228858&r1=1228857&r2=1228858&view=diff
==============================================================================
--- incubator/lcf/trunk/build.xml (original)
+++ incubator/lcf/trunk/build.xml Sun Jan  8 14:46:41 2012
@@ -1951,6 +1951,15 @@
       </condition>
     </target>
 
+    <target name="calculate-jcifs-tests-condition" depends="calculate-jcifs-condition,calculate-nulloutput-condition">
+      <condition property="jcifs-tests.include">
+        <and>
+            <isset property="jcifs.include"/>
+            <isset property="nulloutput.include"/>
+        </and>
+      </condition>
+    </target>
+
     <target name="calculate-activedirectory-tests-condition" depends="calculate-activedirectory-condition">
       <condition property="activedirectory-tests.include">
         <and>
@@ -2038,9 +2047,6 @@
                  <fileset dir="framework/lib"> 
                     <include name="*.jar"/> 
                 </fileset>
-                <fileset dir="framework/lib">
-                    <include name="*.jar"/>
-                </fileset>
 	      <fileset dir="framework/build/jar">
 		<include name="*.jar"/>
 	      </fileset>
@@ -2069,6 +2075,35 @@
         </javac>
     </target>
 
+    <target name="compile-jcifs-tests" depends="build-framework,build-jcifs-connector,build-nulloutput-connector,calculate-jcifs-tests-condition,build-tests-jcifs-connector,build-tests-nulloutput-connector" if="jcifs-tests.include">
+        <mkdir dir="build/jcifs-tests/classes"/>
+        <javac srcdir="tests/jcifs/src/test/java" destdir="build/jcifs-tests/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
+            <classpath>
+                 <fileset dir="framework/lib"> 
+                    <include name="*.jar"/> 
+                </fileset>
+	      <fileset dir="framework/build/jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="framework/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/jcifs/build/jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/jcifs/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/nulloutput/build/jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/nulloutput/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+            </classpath>
+        </javac>
+    </target>
+
     <target name="compile-activedirectory-tests" depends="build-framework,build-activedirectory-connector,calculate-activedirectory-tests-condition,build-tests-activedirectory-connector" if="activedirectory-tests.include">
         <mkdir dir="build/activedirectory-tests/classes"/>
         <javac srcdir="tests/activedirectory/src/test/java" destdir="build/activedirectory-tests/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
@@ -2469,6 +2504,40 @@
         </junit>
     </target>
 
+    <target name="run-jcifs-UI-tests-derby" depends="compile-jcifs-tests,calculate-jcifs-tests-condition" if="jcifs-tests.include">
+        <mkdir dir="test-derby-output/jcifs"/>
+        <junit fork="true" maxmemory="128m" dir="test-derby-output/jcifs" outputtoformatters="true" showoutput="true" haltonfailure="true">
+            <classpath>
+                <fileset dir="framework/lib">
+                    <include name="*.jar"/>
+                </fileset>
+	      <fileset dir="framework/build/jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="framework/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/jcifs/dist/lib">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/jcifs/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/nulloutput/dist/lib">
+		<include name="*.jar"/>
+	      </fileset>
+	      <fileset dir="connectors/nulloutput/build/test-jar">
+		<include name="*.jar"/>
+	      </fileset>
+                <pathelement location="build/jcifs-tests/classes"/>
+            </classpath>
+            <formatter type="brief" usefile="false"/>
+
+            <test name="org.apache.manifoldcf.jcifs_tests.NavigationDerbyUI" todir="test-derby-output/jcifs"/>
+            <!-- MHL -->
+        </junit>
+    </target>
+
     <target name="run-solr-UI-tests-derby" depends="compile-solr-tests,calculate-solr-tests-condition" if="solr-tests.include">
         <mkdir dir="test-derby-output/solr"/>
         <junit fork="true" maxmemory="128m" dir="test-derby-output/solr" outputtoformatters="true" showoutput="true" haltonfailure="true">
@@ -4273,7 +4342,7 @@
 
     <target name="ldtest" depends="load-dr,load-hs"/>
 
-    <target name="uitest" depends="run-filesystem-UI-tests-derby,run-activedirectory-UI-tests-derby,run-rss-UI-tests-derby,run-webcrawler-UI-tests-derby,run-wiki-UI-tests-derby,run-solr-UI-tests-derby,run-cmis-UI-tests-derby,run-gts-UI-tests-derby"/>
+    <target name="uitest" depends="run-filesystem-UI-tests-derby,run-jcifs-UI-tests-derby,run-activedirectory-UI-tests-derby,run-rss-UI-tests-derby,run-webcrawler-UI-tests-derby,run-wiki-UI-tests-derby,run-solr-UI-tests-derby,run-cmis-UI-tests-derby,run-gts-UI-tests-derby"/>
     
     <target name="all" depends="build,javadoc,doc,image,test-dr,test-hs"/>
 

Added: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java?rev=1228858&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java (added)
+++ incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java Sun Jan  8 14:46:41 2012
@@ -0,0 +1,53 @@
+/* $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.jcifs_tests;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.crawler.interfaces.*;
+import org.apache.manifoldcf.crawler.system.ManifoldCF;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+/** Tests that run the "agents daemon" should be derived from this */
+public class BaseUIDerby extends org.apache.manifoldcf.crawler.tests.ConnectorBaseUIDerby
+{
+  protected String[] getConnectorNames()
+  {
+    return new String[]{"JCIFS Connector"};
+  }
+  
+  protected String[] getConnectorClasses()
+  {
+    return new String[]{"org.apache.manifoldcf.crawler.connectors.sharedrive.SharedDriveConnector"};
+  }
+  
+  protected String[] getOutputNames()
+  {
+    return new String[]{"Null Output"};
+  }
+  
+  protected String[] getOutputClasses()
+  {
+    return new String[]{"org.apache.manifoldcf.agents.output.nullconnector.NullConnector"};
+  }
+
+}

Propchange: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/BaseUIDerby.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java?rev=1228858&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java (added)
+++ incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java Sun Jan  8 14:46:41 2012
@@ -0,0 +1,196 @@
+/* $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.jcifs_tests;
+
+import org.apache.manifoldcf.core.interfaces.*;
+import org.apache.manifoldcf.agents.interfaces.*;
+import org.apache.manifoldcf.crawler.interfaces.*;
+import org.apache.manifoldcf.crawler.system.ManifoldCF;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+import org.apache.manifoldcf.core.tests.HTMLTester;
+
+/** Basic UI navigation tests */
+public class NavigationDerbyUI extends BaseUIDerby
+{
+
+  @Test
+  public void createConnectionsAndJob()
+    throws Exception
+  {
+    testerInstance.newTest(Locale.US);
+    
+    HTMLTester.Window window;
+    HTMLTester.Link link;
+    HTMLTester.Form form;
+    HTMLTester.Textarea textarea;
+    HTMLTester.Selectbox selectbox;
+    HTMLTester.Button button;
+    HTMLTester.Radiobutton radiobutton;
+    HTMLTester.Loop loop;
+    
+    window = testerInstance.openMainWindow("http://localhost:8346/mcf-crawler-ui/index.jsp");
+    
+    // Define an output connection via the UI
+    link = window.findLink(testerInstance.createStringDescription("List output connections"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Add an output connection"));
+    link.click();
+    // Fill in a name
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("connname"));
+    textarea.setValue(testerInstance.createStringDescription("MyOutputConnection"));
+    link = window.findLink(testerInstance.createStringDescription("Type tab"));
+    link.click();
+    // Select a type
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    selectbox = form.findSelectbox(testerInstance.createStringDescription("classname"));
+    selectbox.selectValue(testerInstance.createStringDescription("org.apache.manifoldcf.agents.output.nullconnector.NullConnector"));
+    button = window.findButton(testerInstance.createStringDescription("Continue to next page"));
+    button.click();
+    // Visit the Throttling tab
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Throttling tab"));
+    link.click();
+    // Go back to the Name tab
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Name tab"));
+    link.click();
+    // Now save the connection.
+    window = testerInstance.findWindow(null);
+    button = window.findButton(testerInstance.createStringDescription("Save this output connection"));
+    button.click();
+    
+    // Define a repository connection via the UI
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("List repository connections"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Add a connection"));
+    link.click();
+    // Fill in a name
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("connname"));
+    textarea.setValue(testerInstance.createStringDescription("MyRepositoryConnection"));
+    link = window.findLink(testerInstance.createStringDescription("Type tab"));
+    link.click();
+    // Select a type
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    selectbox = form.findSelectbox(testerInstance.createStringDescription("classname"));
+    selectbox.selectValue(testerInstance.createStringDescription("org.apache.manifoldcf.crawler.connectors.sharedrive.SharedDriveConnector"));
+    button = window.findButton(testerInstance.createStringDescription("Continue to next page"));
+    button.click();
+    window = testerInstance.findWindow(null);
+    // Visit the Server tab
+    link = window.findLink(testerInstance.createStringDescription("Server tab"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("server"));
+    textarea.setValue(testerInstance.createStringDescription("localhost"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("username"));
+    textarea.setValue(testerInstance.createStringDescription("foo"));
+    
+    // MHL
+    // Go back to the Name tab
+    link = window.findLink(testerInstance.createStringDescription("Name tab"));
+    link.click();
+    // Now save the connection.
+    window = testerInstance.findWindow(null);
+    button = window.findButton(testerInstance.createStringDescription("Save this connection"));
+    button.click();
+    
+    // Create a job
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("List jobs"));
+    link.click();
+    // Add a job
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Add a job"));
+    link.click();
+    // Fill in a name
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editjob"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("description"));
+    textarea.setValue(testerInstance.createStringDescription("MyJob"));
+    link = window.findLink(testerInstance.createStringDescription("Connection tab"));
+    link.click();
+    // Select the connections
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editjob"));
+    selectbox = form.findSelectbox(testerInstance.createStringDescription("outputname"));
+    selectbox.selectValue(testerInstance.createStringDescription("MyOutputConnection"));
+    selectbox = form.findSelectbox(testerInstance.createStringDescription("connectionname"));
+    selectbox.selectValue(testerInstance.createStringDescription("MyRepositoryConnection"));
+    button = window.findButton(testerInstance.createStringDescription("Continue to next screen"));
+    button.click();
+    // Visit all the connector tabs.
+    // MHL
+    
+    // Save the job
+    window = testerInstance.findWindow(null);
+    button = window.findButton(testerInstance.createStringDescription("Save this job"));
+    button.click();
+
+    // Delete the job
+    window = testerInstance.findWindow(null);
+    HTMLTester.StringDescription jobID = window.findMatch(testerInstance.createStringDescription("<!--jobid=(.*?)-->"),0);
+    testerInstance.printValue(jobID);
+    link = window.findLink(testerInstance.createStringDescription("Delete this job"));
+    link.click();
+    
+    // Wait for the job to go away
+    loop = testerInstance.beginLoop(120);
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Manage jobs"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    HTMLTester.StringDescription isJobNotPresent = window.isNotPresent(jobID);
+    testerInstance.printValue(isJobNotPresent);
+    loop.breakWhenTrue(isJobNotPresent);
+    loop.endLoop();
+    
+    // Delete the repository connection
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("List repository connections"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Delete MyRepositoryConnection"));
+    link.click();
+    
+    // Delete the output connection
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("List output connections"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Delete MyOutputConnection"));
+    link.click();
+    
+    testerInstance.executeTest();
+  }
+  
+}

Propchange: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/tests/jcifs/src/test/java/org/apache/manifoldcf/jcifs_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
    svn:keywords = Id