Author: kwright
Date: Tue Mar 21 01:16:48 2017
New Revision: 1787894
URL: http://svn.apache.org/viewvc?rev=1787894&view=rev
Log:
Minor refactoring so that job status method blows up if job not found at all.
Modified:
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
Modified:
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java?rev=1787894&r1=1787893&r2=1787894&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
(original)
+++
manifoldcf/branches/CONNECTORS-1196-2/connectors/rss/connector/src/test/java/org/apache/manifoldcf/crawler/connectors/rss/tests/NavigationHSQLDBUI.java
Tue Mar 21 01:16:48 2017
@@ -159,9 +159,6 @@ public class NavigationHSQLDBUI extends
System.out.println("JobId: " + jobID);
/* Can't do this because we wind up crawling CNN and that's not allowed
for a test like this.
- //Navigate to Status and Job management
- testerInstance.navigateTo("Manage jobs");
- testerInstance.waitForElementWithName("liststatuses");
//Start the job
testerInstance.performJobAction(jobID,"Start minimal");
Modified:
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java?rev=1787894&r1=1787893&r2=1787894&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
(original)
+++
manifoldcf/branches/CONNECTORS-1196-2/framework/core/src/test/java/org/apache/manifoldcf/core/tests/SeleniumTester.java
Tue Mar 21 01:16:48 2017
@@ -405,8 +405,12 @@ public class SeleniumTester
* @param jobID
* @param action
*/
- public void performJobAction(String jobID,String action)
+ public void performJobAction(String jobID, String action)
{
+ //Navigate to Status and Job management
+ navigateTo("Manage jobs");
+ waitForElementWithName("liststatuses");
+
waitElementClickable(By.xpath("//tr[@job-id=" + jobID +
"]//a[contains(@class,'btn') and text()='" + action + "']")).click();
}
@@ -417,14 +421,25 @@ public class SeleniumTester
* @param timeoutAmount
* @throws Exception
*/
- public void waitForJobStatus(String jobID,String jobStatus,int
timeoutAmount) throws Exception
+ public String waitForJobStatus(String jobID, String jobStatus, int
timeoutAmount) throws Exception
{
- while (!exists(By.xpath("//tr[@job-id='" + jobID + "' and
@job-status-name='" + jobStatus + "']")))
+ //Navigate to Status and Job management
+ navigateTo("Manage jobs");
+ waitForElementWithName("liststatuses");
+
+ while (true)
{
- System.out.println("Job Status: " + getJobStatus(jobID));
+ if (!exists(By.xpath("//tr[@job-id='" + jobID + "']")))
+ {
+ throw new Exception("Job "+jobID+" not found");
+ }
+ if (exists(By.xpath("//tr[@job-id='" + jobID + "' and
@job-status-name='" + jobStatus + "']")))
+ {
+ break;
+ }
if (timeoutAmount == 0)
{
- throw new Exception("Timed out waiting for job " + jobID + " to go
away");
+ throw new Exception("Timed out waiting for job " + jobID + " to
acheive status '" + jobStatus + "'");
}
clickButton("Refresh");
waitForElementWithName("liststatuses");
@@ -432,7 +447,13 @@ public class SeleniumTester
Thread.sleep(1000L);
timeoutAmount--;
}
- System.out.println("Final Job Status: " + getJobStatus(jobID));
+ return getJobStatus(jobID);
+ }
+
+ public String getJobStatus(String jobID)
+ {
+ WebElement element =
driver.findElement(By.xpath("//tr[@job-id="+jobID+"]"));
+ return element.getAttribute("job-status-name");
}
/**
@@ -443,12 +464,10 @@ public class SeleniumTester
*/
public void waitForJobDelete(final String jobID, int timeoutAmount) throws
Exception
{
-
navigateTo("Manage jobs");
waitForElementWithName("liststatuses");
while (exists(By.xpath("//tr[@job-id=\"" + jobID + "\"]")))
{
- System.out.println("Job Status: " + getJobStatus(jobID));
if (timeoutAmount == 0)
{
throw new Exception("Timed out waiting for job "+jobID+" to go away");
@@ -461,11 +480,6 @@ public class SeleniumTester
}
}
- public String getJobStatus(String jobID)
- {
- WebElement element =
driver.findElement(By.xpath("//tr[@job-id="+jobID+"]"));
- return element.getAttribute("job-status-name");
- }
/**
* Get the source of the html document