incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piergior...@apache.org
Subject svn commit: r1232839 - in /incubator/lcf/trunk: connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/ tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/
Date Wed, 18 Jan 2012 11:30:46 GMT
Author: piergiorgio
Date: Wed Jan 18 11:30:46 2012
New Revision: 1232839

URL: http://svn.apache.org/viewvc?rev=1232839&view=rev
Log:
part of CONNECTORS-380: added the UI test implementation for the Alfresco connector, updated
javascript and html templates

Added:
    incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
  (with props)
    incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
  (with props)
Modified:
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
    incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.js

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html?rev=1232839&r1=1232838&r2=1232839&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.html
Wed Jan 18 11:30:46 2012
@@ -99,7 +99,7 @@
 <script type="text/javascript">
 <!--
 var protocol = "${PROTOCOL:BJ}";
-var protocolSelect = document.getElementById("protocol");
+var protocolSelect = editconnection.protocol;
 if(protocol=="https"){
   protocolSelect.options[1].selected = true;
 } else {

Modified: incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.js
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.js?rev=1232839&r1=1232838&r2=1232839&view=diff
==============================================================================
--- incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.js
(original)
+++ incubator/lcf/trunk/connectors/alfresco/connector/src/main/resources/org/apache/manifoldcf/crawler/connectors/alfresco/editConfiguration_en_US.js
Wed Jan 18 11:30:46 2012
@@ -19,52 +19,55 @@
 <!--
 function checkConfig()
 {
-
   return true;
 }
  
 function checkConfigForSave()
 {
 	if (editconnection.username.value == "")
-	  {
-	    alert("The username must be not null");
-	    editconnection.username.focus();
-	    return false;
-	  }
-	  if (editconnection.password.value == "")
-	  {
-	    alert("The password must be not null");
-	    editconnection.password.focus();
-	    return false;
-	  }
-	  
-	  if (editconnection.server.value ==""){
-		  alert("Server name must be not null");
-		  editconnection.server.focus();
-		  return false;
-	  } else if(!editconnection.server.value.indexOf('/')==-1) {
-		  alert("Server name can't contain the character '/'");
-		  editconnection.server.focus();
-		  return false;
-	  }
-	  
-	  if (editconnection.port.value == "")
-	  {
-		alert("The port must be not null");
-		editconnection.port.focus();
-		return false;
-	  } else if (!isInteger(editconnection.port.value)){
-		alert("The server port must be a valid integer");
-		editconnection.port.focus();
-		return false;
-	  }
-	  
-	  if(editconnection.path.value == ""){
-		  alert("Path must be not null");
+  {
+    alert("The username must be not null");
+    SelectTab("Server");
+    editconnection.username.focus();
+    return false;
+  }
+  if (editconnection.password.value == "")
+  {
+    alert("The password must be not null");
+    SelectTab("Server");
+    editconnection.password.focus();
+    return false;
+  }
+  if (editconnection.server.value =="") {
+    alert("Server name must be not null");
+    SelectTab("Server");
+	  editconnection.server.focus();
+	  return false;
+  } else if(!editconnection.server.value.indexOf('/')==-1) {
+  	alert("Server name can't contain the character '/'");
+  	SelectTab("Server");
+	  editconnection.server.focus();
+	  return false;
+  }
+  if (editconnection.port.value == "")
+  {
+  	alert("The port must be not null");
+  	SelectTab("Server");
+  	editconnection.port.focus();
+  	return false;
+  } else if (!isInteger(editconnection.port.value)){
+  	alert("The server port must be a valid integer");
+  	SelectTab("Server");
+  	editconnection.port.focus();
+  	return false;
+  }
+  if(editconnection.path.value == ""){
+  		alert("Path must be not null");
+  		SelectTab("Server");
 		  editconnection.path.focus();
 		  return false;
 	  }
   return true;
 }
-//-->
+// -->
 </script>
\ No newline at end of file

Added: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java?rev=1232839&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
(added)
+++ incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
Wed Jan 18 11:30:46 2012
@@ -0,0 +1,45 @@
+/* $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.alfresco_tests;
+
+
+/** 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[]{"Alfresco Connector"};
+  }
+  
+  protected String[] getConnectorClasses()
+  {
+    return new String[]{"org.apache.manifoldcf.crawler.connectors.alfresco.AlfrescoRepositoryConnector"};
+  }
+  
+  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/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/BaseUIDerby.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java?rev=1232839&view=auto
==============================================================================
--- incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
(added)
+++ incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
Wed Jan 18 11:30:46 2012
@@ -0,0 +1,219 @@
+/* $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.alfresco_tests;
+
+import java.util.Locale;
+
+import org.apache.manifoldcf.core.tests.HTMLTester;
+import org.junit.Test;
+
+/** 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.alfresco.AlfrescoRepositoryConnector"));
+    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();
+    // Server tab
+    window = testerInstance.findWindow(null);
+    link = window.findLink(testerInstance.createStringDescription("Server tab"));
+    link.click();
+    window = testerInstance.findWindow(null);
+    form = window.findForm(testerInstance.createStringDescription("editconnection"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("username"));
+    textarea.setValue(testerInstance.createStringDescription("admin"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("password"));
+    textarea.setValue(testerInstance.createStringDescription("admin"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("tenantDomain"));
+    textarea.setValue(testerInstance.createStringDescription(""));
+    selectbox = form.findSelectbox(testerInstance.createStringDescription("protocol"));
+    selectbox.selectValue(testerInstance.createStringDescription("http"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("server"));
+    textarea.setValue(testerInstance.createStringDescription("localhost"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("port"));
+    textarea.setValue(testerInstance.createStringDescription("9090"));
+    textarea = form.findTextarea(testerInstance.createStringDescription("path"));
+    textarea.setValue(testerInstance.createStringDescription("/alfresco/api"));
+    // Go back to the Name tab
+    link = window.findLink(testerInstance.createStringDescription("Name tab"));
+    link.click();
+    // Now save the connection.
+    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();
+    window = testerInstance.findWindow(null);
+    // MHL
+    // Save the job
+    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/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/lcf/trunk/tests/alfresco/src/test/java/org/apache/manifoldcf/alfresco_tests/NavigationDerbyUI.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message