]> source.dussan.org Git - archiva.git/commitdiff
use dynamic port allocation of tomcat maven plugin
authorOlivier Lamy <olamy@apache.org>
Fri, 4 May 2012 13:09:55 +0000 (13:09 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 4 May 2012 13:09:55 +0000 (13:09 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1333933 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index 1a36d93a3bd439bf7bcac602b32da5fbcba81b5c..cc81ea119c10fa39b47a548febbf62b15930d4ba 100644 (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>
                 <maxWaitTimeInMs>${maxWaitTimeInMs}</maxWaitTimeInMs>
                 <seleniumHost>${seleniumHost}</seleniumHost>
                 <seleniumPort>${seleniumPort}</seleniumPort>
+                <tomcat.propertiesPortFilePath>${tomcat.propertiesPortFilePath}</tomcat.propertiesPortFilePath>
               </systemPropertyVariables>
             </configuration>
           </execution>
                   </tasks>
                 </configuration>
               </execution>
-              <execution>
+              <!--execution>
                 <id>check-archiva-loaded</id>
                 <phase>integration-test</phase>
                 <configuration>
                 <goals>
                   <goal>run</goal>
                 </goals>
-              </execution>
+              </execution-->
             </executions>
           </plugin>
           <plugin>
                     <archiva.devMode>true</archiva.devMode>
                   </systemProperties>
                   <contextFile>${project.build.testOutputDirectory}/archiva.xml</contextFile>
+                  <propertiesPortFilePath>${tomcat.propertiesPortFilePath}</propertiesPortFilePath>
                   <useNaming>true</useNaming>
                 </configuration>
               </execution>
index 69bb0791f94e046540479432721fcb7ab22cb17f..c486fea38da1f90adb4987d98fc336afe7355fe4 100644 (file)
@@ -26,6 +26,7 @@ import org.junit.Assert;
 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 abstract class AbstractSeleniumTest
     {
         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();