use dynamic port allocation of tomcat maven plugin

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1333933 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-04 13:09:55 +00:00
parent 275e055e54
commit 90885c2bfa
2 changed files with 18 additions and 3 deletions

View File

@ -31,6 +31,8 @@
<properties>
<webappDirectory>${project.build.directory}/tomcat7x/webapps/archiva</webappDirectory>
<container.test.port>0</container.test.port>
<tomcat.propertiesPortFilePath>${project.build.directory}/tomcat-port.properties</tomcat.propertiesPortFilePath>
</properties>
<dependencies>
@ -201,6 +203,7 @@
<maxWaitTimeInMs>${maxWaitTimeInMs}</maxWaitTimeInMs>
<seleniumHost>${seleniumHost}</seleniumHost>
<seleniumPort>${seleniumPort}</seleniumPort>
<tomcat.propertiesPortFilePath>${tomcat.propertiesPortFilePath}</tomcat.propertiesPortFilePath>
</systemPropertyVariables>
</configuration>
</execution>
@ -279,7 +282,7 @@
</tasks>
</configuration>
</execution>
<execution>
<!--execution>
<id>check-archiva-loaded</id>
<phase>integration-test</phase>
<configuration>
@ -291,7 +294,7 @@
<goals>
<goal>run</goal>
</goals>
</execution>
</execution-->
</executions>
</plugin>
<plugin>
@ -330,6 +333,7 @@
<archiva.devMode>true</archiva.devMode>
</systemProperties>
<contextFile>${project.build.testOutputDirectory}/archiva.xml</contextFile>
<propertiesPortFilePath>${tomcat.propertiesPortFilePath}</propertiesPortFilePath>
<useNaming>true</useNaming>
</configuration>
</execution>

View File

@ -26,6 +26,7 @@
import org.junit.Rule;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@ -48,7 +49,8 @@ public abstract class AbstractSeleniumTest
public String browser = System.getProperty( "browser" );
public String baseUrl = System.getProperty( "baseUrl" );
public String baseUrl =
"http://localhost:" + System.getProperty( "tomcat.maven.http.port" ) + "/archiva/index.html?request_lang=en";
public int maxWaitTimeInMs = Integer.getInteger( "maxWaitTimeInMs" );
@ -70,6 +72,15 @@ public void open()
{
p = new Properties();
p.load( this.getClass().getClassLoader().getResourceAsStream( "test.properties" ) );
Properties tomcatPortProperties = new Properties();
tomcatPortProperties.load(
new FileInputStream( new File( System.getProperty( "tomcat.propertiesPortFilePath" ) ) ) );
int tomcatPort = Integer.parseInt( tomcatPortProperties.getProperty( "tomcat.maven.http.port" ) );
baseUrl = "http://localhost:" + tomcatPort + "/archiva/index.html?request_lang=en";
open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs );
archivaSeleniumExecutionRule.selenium = selenium;
assertAdminCreated();