Enabling the tests, trying a new strategy for locating a free port.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@595584 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nils-Helge Garli
2007-11-16 07:11:07 +00:00
parent 3f8c282065
commit ded8c8f491
2 changed files with 9 additions and 21 deletions
-15
View File
@@ -40,21 +40,6 @@
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/portlet/</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Excluded so the integration tests don't run in the main Bamboo build -->
<excludes>
<exclude>org/apache/struts2/portlet/test/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>pluto</id>
@@ -10,11 +10,11 @@ import org.mortbay.jetty.webapp.WebAppContext;
public abstract class BasePortletTest extends WebTestCase {
protected Server server;
private int port = 9876;
private String contextPath = "/test";
private int port;
public void setUp() throws Exception {
System.setProperty("org.apache.pluto.embedded.portletId", getPortletName());
server = new Server(port);
@@ -26,6 +26,9 @@ public abstract class BasePortletTest extends WebTestCase {
webapp.addServlet(portletServlet, "/PlutoInvoker/" + getPortletName());
server.addHandler(webapp);
server.start();
// Retrieve the actual port that is used, in case a random, free port is
// picked
int port = server.getConnectors()[0].getLocalPort();
getTestContext().setBaseUrl("http://localhost:" + port + contextPath);
}
@@ -58,10 +61,6 @@ public abstract class BasePortletTest extends WebTestCase {
clickElementByXPath("//span[@class='help']/..");
}
public void setPort(int port) {
this.port = port;
}
public void setContextPath(String contextPath) {
if(!contextPath.startsWith("/")) {
this.contextPath = "/" + contextPath;
@@ -71,5 +70,9 @@ public abstract class BasePortletTest extends WebTestCase {
}
}
public void setPort(int port) {
this.port = port;
}
public abstract String getPortletName();
}