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/07 20:18:47 UTC
svn commit: r1228703 - in /incubator/lcf/trunk: ./ tests/solr/
tests/solr/src/ tests/solr/src/test/ tests/solr/src/test/java/
tests/solr/src/test/java/org/ tests/solr/src/test/java/org/apache/
tests/solr/src/test/java/org/apache/manifoldcf/ tests/solr/...
Author: kwright
Date: Sat Jan 7 19:18:46 2012
New Revision: 1228703
URL: http://svn.apache.org/viewvc?rev=1228703&view=rev
Log:
First cut of solr connector UI test. Part of CONNECTORS-339.
Added:
incubator/lcf/trunk/tests/solr/
incubator/lcf/trunk/tests/solr/src/
incubator/lcf/trunk/tests/solr/src/test/
incubator/lcf/trunk/tests/solr/src/test/java/
incubator/lcf/trunk/tests/solr/src/test/java/org/
incubator/lcf/trunk/tests/solr/src/test/java/org/apache/
incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/
incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/
incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java (with props)
incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_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=1228703&r1=1228702&r2=1228703&view=diff
==============================================================================
--- incubator/lcf/trunk/build.xml (original)
+++ incubator/lcf/trunk/build.xml Sat Jan 7 19:18:46 2012
@@ -1951,6 +1951,15 @@
</condition>
</target>
+ <target name="calculate-solr-tests-condition" depends="calculate-filesystem-condition,calculate-solr-condition">
+ <condition property="solr-tests.include">
+ <and>
+ <isset property="filesystem.include"/>
+ <isset property="solr.include"/>
+ </and>
+ </condition>
+ </target>
+
<target name="calculate-rss-tests-condition" depends="calculate-rss-condition,calculate-nulloutput-condition">
<condition property="rss-tests.include">
<and>
@@ -2043,6 +2052,38 @@
</javac>
</target>
+ <target name="compile-solr-tests" depends="build-framework,build-filesystem-connector,build-solr-connector,calculate-solr-tests-condition,build-tests-filesystem-connector,build-tests-solr-connector" if="solr-tests.include">
+ <mkdir dir="build/solr-tests/classes"/>
+ <javac srcdir="tests/solr/src/test/java" destdir="build/solr-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/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/filesystem/build/jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/filesystem/build/test-jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/solr/build/jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/solr/build/test-jar">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </javac>
+ </target>
+
<target name="compile-rss-tests" depends="build-framework,build-rss-connector,build-nulloutput-connector,calculate-rss-tests-condition,build-tests-rss-connector,build-tests-nulloutput-connector" if="rss-tests.include">
<mkdir dir="build/rss-tests/classes"/>
<javac srcdir="tests/rss/src/test/java" destdir="build/rss-tests/classes" target="1.5" source="1.5" debug="true" debuglevel="lines,vars,source">
@@ -2358,6 +2399,40 @@
</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">
+ <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/filesystem/build/jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/filesystem/build/test-jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/solr/build/jar">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="connectors/solr/build/test-jar">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="build/solr-tests/classes"/>
+ </classpath>
+ <formatter type="brief" usefile="false"/>
+
+ <test name="org.apache.manifoldcf.solr_tests.NavigationDerbyUI" todir="test-derby-output/solr"/>
+ <!-- MHL -->
+ </junit>
+ </target>
+
<target name="run-rss-UI-tests-derby" depends="compile-rss-tests,calculate-rss-tests-condition" if="rss-tests.include">
<mkdir dir="test-derby-output/rss"/>
<junit fork="true" maxmemory="128m" dir="test-derby-output/rss" outputtoformatters="true" showoutput="true" haltonfailure="true">
@@ -4111,7 +4186,7 @@
<target name="ldtest" depends="load-dr,load-hs"/>
- <target name="uitest" depends="run-filesystem-UI-tests-derby,run-rss-UI-tests-derby,run-webcrawler-UI-tests-derby,run-wiki-UI-tests-derby"/>
+ <target name="uitest" depends="run-filesystem-UI-tests-derby,run-rss-UI-tests-derby,run-webcrawler-UI-tests-derby,run-wiki-UI-tests-derby,run-solr-UI-tests-derby"/>
<target name="all" depends="build,javadoc,doc,image,test-dr,test-hs"/>
Added: incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java?rev=1228703&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java (added)
+++ incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java Sat Jan 7 19:18:46 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.solr_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[]{"File Connector"};
+ }
+
+ protected String[] getConnectorClasses()
+ {
+ return new String[]{"org.apache.manifoldcf.crawler.connectors.filesystem.FileConnector"};
+ }
+
+ protected String[] getOutputNames()
+ {
+ return new String[]{"Solr Output"};
+ }
+
+ protected String[] getOutputClasses()
+ {
+ return new String[]{"org.apache.manifoldcf.agents.output.solr.SolrConnector"};
+ }
+
+}
Propchange: incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/BaseUIDerby.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java?rev=1228703&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java (added)
+++ incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java Sat Jan 7 19:18:46 2012
@@ -0,0 +1,191 @@
+/* $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.solr_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.solr.SolrConnector"));
+ 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();
+ // Visit the Solr tabs
+ // MHL
+ // 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.filesystem.FileConnector"));
+ 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 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 Solr 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/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/lcf/trunk/tests/solr/src/test/java/org/apache/manifoldcf/solr_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
svn:keywords = Id