Author: nilsga
Date: Thu Nov 15 23:11:07 2007
New Revision: 595584

URL: http://svn.apache.org/viewvc?rev=595584&view=rev
Log:
Enabling the tests, trying a new strategy for locating a free port.

Modified:
    struts/struts2/trunk/apps/portlet/pom.xml
    
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java

Modified: struts/struts2/trunk/apps/portlet/pom.xml
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/pom.xml?rev=595584&r1=595583&r2=595584&view=diff
==============================================================================
--- struts/struts2/trunk/apps/portlet/pom.xml (original)
+++ struts/struts2/trunk/apps/portlet/pom.xml Thu Nov 15 23:11:07 2007
@@ -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>

Modified: 
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java?rev=595584&r1=595583&r2=595584&view=diff
==============================================================================
--- 
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java
 (original)
+++ 
struts/struts2/trunk/apps/portlet/src/test/java/org/apache/struts2/portlet/test/BasePortletTest.java
 Thu Nov 15 23:11:07 2007
@@ -10,11 +10,11 @@
 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 @@
                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 @@
                clickElementByXPath("//[EMAIL PROTECTED]'help']/..");
        }
        
-       public void setPort(int port) {
-               this.port = port;
-       }
-       
        public void setContextPath(String contextPath) {
                if(!contextPath.startsWith("/")) {
                        this.contextPath = "/" + contextPath;
@@ -69,6 +68,10 @@
                else {
                        this.contextPath = contextPath;
                }
+       }
+       
+       public void setPort(int port) {
+               this.port = port;
        }
        
        public abstract String getPortletName();


Reply via email to