You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by mi...@apache.org on 2013/06/24 05:26:58 UTC
svn commit: r1495913 [5/5] - in /manifoldcf/branches/CONNECTORS-728: ./
connectors/
connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/filesystem/
connectors/filesystem/connector/src/main/native2ascii/org/apache/mani...
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationDerbyUI.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationDerbyUI.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationDerbyUI.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationDerbyUI.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,43 @@
+/* $Id: NavigationDerbyUI.java 1422222 2012-12-15 11:29:02Z kwright $ */
+
+/**
+* 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.filesystem_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
+ {
+ new NavigationUITester(testerInstance,"http://localhost:8346/mcf-crawler-ui/index.jsp").createConnectionsAndJob();
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationUITester.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationUITester.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationUITester.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationUITester.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,227 @@
+/* $Id: NavigationUITester.java 1422222 2012-12-15 11:29:02Z kwright $ */
+
+/**
+* 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.filesystem_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 NavigationUITester
+{
+ protected final HTMLTester testerInstance;
+ protected final String startURL;
+
+ public NavigationUITester(HTMLTester tester, String startURL)
+ {
+ this.testerInstance = tester;
+ this.startURL = startURL;
+ }
+
+ 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(startURL);
+
+ // 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.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 tabs. Scheduling tab first
+ window = testerInstance.findWindow(null);
+ link = window.findLink(testerInstance.createStringDescription("Scheduling tab"));
+ link.click();
+ window = testerInstance.findWindow(null);
+ form = window.findForm(testerInstance.createStringDescription("editjob"));
+ selectbox = form.findSelectbox(testerInstance.createStringDescription("dayofweek"));
+ selectbox.selectValue(testerInstance.createStringDescription("0"));
+ selectbox = form.findSelectbox(testerInstance.createStringDescription("hourofday"));
+ selectbox.selectValue(testerInstance.createStringDescription("1"));
+ selectbox = form.findSelectbox(testerInstance.createStringDescription("minutesofhour"));
+ selectbox.selectValue(testerInstance.createStringDescription("30"));
+ selectbox = form.findSelectbox(testerInstance.createStringDescription("monthofyear"));
+ selectbox.selectValue(testerInstance.createStringDescription("11"));
+ selectbox = form.findSelectbox(testerInstance.createStringDescription("dayofmonth"));
+ selectbox.selectValue(testerInstance.createStringDescription("none"));
+ textarea = form.findTextarea(testerInstance.createStringDescription("duration"));
+ textarea.setValue(testerInstance.createStringDescription("120"));
+ button = window.findButton(testerInstance.createStringDescription("Add new schedule record"));
+ button.click();
+ // Now, HopFilters
+ window = testerInstance.findWindow(null);
+ link = window.findLink(testerInstance.createStringDescription("Hop Filters tab"));
+ link.click();
+ window = testerInstance.findWindow(null);
+ form = window.findForm(testerInstance.createStringDescription("editjob"));
+ radiobutton = form.findRadiobutton(testerInstance.createStringDescription("hopcountmode"),testerInstance.createStringDescription("2"));
+ radiobutton.select();
+ link = window.findLink(testerInstance.createStringDescription("Paths tab"));
+ link.click();
+ // Add a record to the Paths list
+
+ // 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: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/NavigationUITester.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityDerbyIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityDerbyIT.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityDerbyIT.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityDerbyIT.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,56 @@
+/* $Id: Sanity.java 988245 2010-08-23 18:39:35Z kwright $ */
+
+/**
+* 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.filesystem_tests;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+/** This is a very basic sanity check */
+public class SanityDerbyIT extends BaseDerby
+{
+ protected SanityTester tester;
+
+ public SanityDerbyIT()
+ {
+ tester = new SanityTester(mcfInstance);
+ }
+
+ @Before
+ public void setupTester()
+ throws Exception
+ {
+ tester.setupTestArea();
+ }
+
+ @After
+ public void teardownTester()
+ throws Exception
+ {
+ tester.teardownTestArea();
+ }
+
+ @Test
+ public void sanityCheck()
+ throws Exception
+ {
+ tester.executeTest();
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityDerbyIT.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityHSQLDBIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityHSQLDBIT.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityHSQLDBIT.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityHSQLDBIT.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,56 @@
+/* $Id: SanityHSQLDBIT.java 1226141 2011-12-31 17:23:35Z kwright $ */
+
+/**
+* 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.filesystem_tests;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+/** This is a very basic sanity check */
+public class SanityHSQLDBIT extends BaseHSQLDB
+{
+ protected SanityTester tester;
+
+ public SanityHSQLDBIT()
+ {
+ tester = new SanityTester(mcfInstance);
+ }
+
+ @Before
+ public void setupTester()
+ throws Exception
+ {
+ tester.setupTestArea();
+ }
+
+ @After
+ public void teardownTester()
+ throws Exception
+ {
+ tester.teardownTestArea();
+ }
+
+ @Test
+ public void sanityCheck()
+ throws Exception
+ {
+ tester.executeTest();
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityHSQLDBIT.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityMySQLIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityMySQLIT.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityMySQLIT.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityMySQLIT.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,56 @@
+/* $Id: SanityMySQLIT.java 1226141 2011-12-31 17:23:35Z kwright $ */
+
+/**
+* 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.filesystem_tests;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+/** This is a very basic sanity check */
+public class SanityMySQLIT extends BaseMySQL
+{
+ protected SanityTester tester;
+
+ public SanityMySQLIT()
+ {
+ tester = new SanityTester(mcfInstance);
+ }
+
+ @Before
+ public void setupTester()
+ throws Exception
+ {
+ tester.setupTestArea();
+ }
+
+ @After
+ public void teardownTester()
+ throws Exception
+ {
+ tester.teardownTestArea();
+ }
+
+ @Test
+ public void sanityCheck()
+ throws Exception
+ {
+ tester.executeTest();
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityMySQLIT.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityPostgresqlIT.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityPostgresqlIT.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityPostgresqlIT.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityPostgresqlIT.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,56 @@
+/* $Id: Sanity.java 988245 2010-08-23 18:39:35Z kwright $ */
+
+/**
+* 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.filesystem_tests;
+
+import java.io.*;
+import java.util.*;
+import org.junit.*;
+
+/** This is a very basic sanity check */
+public class SanityPostgresqlIT extends BasePostgresql
+{
+ protected SanityTester tester;
+
+ public SanityPostgresqlIT()
+ {
+ tester = new SanityTester(mcfInstance);
+ }
+
+ @Before
+ public void setupTester()
+ throws Exception
+ {
+ tester.setupTestArea();
+ }
+
+ @After
+ public void teardownTester()
+ throws Exception
+ {
+ tester.teardownTestArea();
+ }
+
+ @Test
+ public void sanityCheck()
+ throws Exception
+ {
+ tester.executeTest();
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityPostgresqlIT.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityTester.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityTester.java?rev=1495913&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityTester.java (added)
+++ manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityTester.java Mon Jun 24 03:26:56 2013
@@ -0,0 +1,189 @@
+/* $Id: SanityTester.java 1457305 2013-03-16 21:03:08Z kwright $ */
+
+/**
+* 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.filesystem_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.*;
+
+/** This is a very basic sanity check */
+public class SanityTester
+{
+ protected org.apache.manifoldcf.crawler.tests.ManifoldCFInstance instance;
+
+ public SanityTester(org.apache.manifoldcf.crawler.tests.ManifoldCFInstance instance)
+ {
+ this.instance = instance;
+ }
+
+ public void setupTestArea()
+ throws Exception
+ {
+ File f = new File("testdata");
+ FileHelper.removeDirectory(f);
+ FileHelper.createDirectory(f);
+ }
+
+ public void teardownTestArea()
+ throws Exception
+ {
+ File f = new File("testdata");
+ FileHelper.removeDirectory(f);
+ }
+
+ public void executeTest()
+ throws Exception
+ {
+ // Hey, we were able to install the file system connector etc.
+ // Now, create a local test job and run it.
+ IThreadContext tc = ThreadContextFactory.make();
+
+ // Create a basic file system connection, and save it.
+ IRepositoryConnectionManager mgr = RepositoryConnectionManagerFactory.make(tc);
+ IRepositoryConnection conn = mgr.create();
+ conn.setName("File Connection");
+ conn.setDescription("File Connection");
+ conn.setClassName("org.apache.manifoldcf.crawler.connectors.filesystem.FileConnector");
+ conn.setMaxConnections(100);
+ // Now, save
+ mgr.save(conn);
+
+ // Create a basic null output connection, and save it.
+ IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc);
+ IOutputConnection outputConn = outputMgr.create();
+ outputConn.setName("Null Connection");
+ outputConn.setDescription("Null Connection");
+ outputConn.setClassName("org.apache.manifoldcf.agents.output.nullconnector.NullConnector");
+ outputConn.setMaxConnections(100);
+ // Now, save
+ outputMgr.save(outputConn);
+
+ // Create a job.
+ IJobManager jobManager = JobManagerFactory.make(tc);
+ IJobDescription job = jobManager.createJob();
+ job.setDescription("Test Job");
+ job.setConnectionName("File Connection");
+ job.setOutputConnectionName("Null Connection");
+ job.setType(job.TYPE_SPECIFIED);
+ job.setStartMethod(job.START_DISABLE);
+ job.setHopcountMode(job.HOPCOUNT_ACCURATE);
+
+ // Now, set up the document specification.
+ DocumentSpecification ds = job.getSpecification();
+ // Crawl everything underneath the 'testdata' area
+ File testDataFile = new File("testdata").getCanonicalFile();
+ if (!testDataFile.exists())
+ throw new ManifoldCFException("Test data area not found! Looking in "+testDataFile.toString());
+ if (!testDataFile.isDirectory())
+ throw new ManifoldCFException("Test data area not a directory! Looking in "+testDataFile.toString());
+ SpecificationNode sn = new SpecificationNode("startpoint");
+ sn.setAttribute("path",testDataFile.toString());
+ SpecificationNode n = new SpecificationNode("include");
+ n.setAttribute("type","file");
+ n.setAttribute("match","*");
+ sn.addChild(sn.getChildCount(),n);
+ n = new SpecificationNode("include");
+ n.setAttribute("type","directory");
+ n.setAttribute("match","*");
+ sn.addChild(sn.getChildCount(),n);
+ ds.addChild(ds.getChildCount(),sn);
+
+ // Set up the output specification.
+ OutputSpecification os = job.getOutputSpecification();
+ // Null output connections have no output specification, so this is a no-op.
+
+ // Save the job.
+ jobManager.save(job);
+
+ // Create the test data files.
+ FileHelper.createFile(new File("testdata/test1.txt"),"This is a test file");
+ FileHelper.createFile(new File("testdata/test2.txt"),"This is another test file");
+ FileHelper.createDirectory(new File("testdata/testdir"));
+ FileHelper.createFile(new File("testdata/testdir/test3.txt"),"This is yet another test file");
+
+ // Now, start the job, and wait until it completes.
+ jobManager.manualStart(job.getID());
+ instance.waitJobInactiveNative(jobManager,job.getID(),120000L);
+
+ // Check to be sure we actually processed the right number of documents.
+ JobStatus status = jobManager.getStatus(job.getID());
+ // The test data area has 3 documents and one directory, and we have to count the root directory too.
+ if (status.getDocumentsProcessed() != 5)
+ throw new ManifoldCFException("Wrong number of documents processed - expected 5, saw "+new Long(status.getDocumentsProcessed()).toString());
+
+ // Add a file and recrawl using minimal crawl
+ FileHelper.createFile(new File("testdata/testdir/test4.txt"),"Added file");
+
+ // Now, start the job, and wait until it completes.
+ jobManager.manualStart(job.getID(),true);
+ instance.waitJobInactiveNative(jobManager,job.getID(),120000L);
+
+ status = jobManager.getStatus(job.getID());
+ // The test data area has 4 documents and one directory, and we have to count the root directory too.
+ if (status.getDocumentsProcessed() != 6)
+ throw new ManifoldCFException("Wrong number of documents processed after add - expected 6, saw "+new Long(status.getDocumentsProcessed()).toString());
+
+ // Change a file, and recrawl, once again using minimal
+ FileHelper.changeFile(new File("testdata/test1.txt"),"Modified contents");
+
+ // Now, start the job, and wait until it completes.
+ jobManager.manualStart(job.getID(),true);
+ instance.waitJobInactiveNative(jobManager,job.getID(),120000L);
+
+ status = jobManager.getStatus(job.getID());
+ // The test data area has 4 documents and one directory, and we have to count the root directory too.
+ if (status.getDocumentsProcessed() != 6)
+ throw new ManifoldCFException("Wrong number of documents processed after change - expected 6, saw "+new Long(status.getDocumentsProcessed()).toString());
+ // We also need to make sure the new document was indexed. Have to think about how to do this though.
+ // MHL
+
+ // Delete a file, and recrawl
+ FileHelper.removeFile(new File("testdata/test2.txt"));
+
+ // Do a minimal recrawl first; the delete should not be picked up.
+ jobManager.manualStart(job.getID(),true);
+ instance.waitJobInactiveNative(jobManager,job.getID(),120000L);
+
+ status = jobManager.getStatus(job.getID());
+ // The test data area has 4 documents and one directory, and we have to count the root directory too.
+ if (status.getDocumentsProcessed() != 6)
+ throw new ManifoldCFException("Wrong number of documents processed after delete with minimal crawl - expected 6, saw "+new Long(status.getDocumentsProcessed()).toString());
+
+ // Now, do a complete crawl - the delete should be found now.
+ jobManager.manualStart(job.getID());
+ instance.waitJobInactiveNative(jobManager,job.getID(),120000L);
+
+ // Check to be sure we actually processed the right number of documents.
+ status = jobManager.getStatus(job.getID());
+ // The test data area has 3 documents and one directory, and we have to count the root directory too.
+ if (status.getDocumentsProcessed() != 5)
+ throw new ManifoldCFException("Wrong number of documents processed after delete - expected 5, saw "+new Long(status.getDocumentsProcessed()).toString());
+
+ // Now, delete the job.
+ jobManager.deleteJob(job.getID());
+ instance.waitJobDeletedNative(jobManager,job.getID(),120000L);
+
+ // Cleanup is automatic by the base class, so we can feel free to leave jobs and connections lying around.
+ }
+
+}
Propchange: manifoldcf/branches/CONNECTORS-728/tests/hdfs/src/test/java/org/apache/manifoldcf/hdfs_tests/SanityTester.java
------------------------------------------------------------------------------
svn:mime-type = text/plain