]> source.dussan.org Git - archiva.git/commitdiff
Customise settings so that you can debug the cargo instance, and show tests to output...
authorBrett Porter <brett@apache.org>
Thu, 30 Dec 2010 01:05:58 +0000 (01:05 +0000)
committerBrett Porter <brett@apache.org>
Thu, 30 Dec 2010 01:05:58 +0000 (01:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1053778 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test/pom.xml
archiva-modules/archiva-web/archiva-webapp-test/src/test/resources/testng.properties
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArchivaAdminTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index e39f841842aa804692d2d96d8a5a4ae250bef520..8fb377461e46b974dc8b8df61740781c9886b784 100644 (file)
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <redirectTestOutputToFile>false</redirectTestOutputToFile>
           <properties>
             <!--
               Use this instead of suiteXmlFiles so that we can add the exclusion, as it is only accepted without suiteXmlFiles
                   <name>baseUrl</name>
                   <value>${baseUrl}</value>
                 </property>
+                <property>
+                  <name>maxWaitTimeInMs</name>
+                  <value>${maxWaitTimeInMs}</value>
+                </property>
               </systemProperties>
             </configuration>
           </execution>
                 <type>existing</type>
                 <properties>
                   <cargo.servlet.port>9696</cargo.servlet.port>
+                  <cargo.jvmargs>${cargo.jvm.args}</cargo.jvmargs>
                 </properties>
               </configuration>
             </configuration>
         </plugins>
       </build>
     </profile>
+    <profile>
+      <id>debug</id>
+      <properties>
+        <cargo.jvm.args>
+          -Xdebug -Xnoagent -Djava.compiler=NONE
+          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${cargo.debug.port}
+        </cargo.jvm.args>
+        <cargo.debug.port>8000</cargo.debug.port>
+        <!-- wait an unusual amount of time (1hr) to allow debugging to occur -->
+        <maxWaitTimeInMs>3600000</maxWaitTimeInMs>
+      </properties>
+    </profile>
   </profiles>
   <properties>
     <tomcat5x.version>5.5.27</tomcat5x.version>
     <cargo.wait>false</cargo.wait>
     <cargo.install.dir>cargo-installs</cargo.install.dir>
+    <maxWaitTimeInMs>60000</maxWaitTimeInMs>
   </properties>
 </project>
index 5ceeebe76b1e5ee16f0fe32349b4342620918016..a25b6746f175cd3b1bb4f3bc6477716017b54ba9 100644 (file)
@@ -1,7 +1,5 @@
 # properties for integration tests
 
-MAX_WAIT_TIME_IN_MS=60000
-
 ADMIN_USERNAME=admin
 ADMIN_FULLNAME=Administrator
 ADMIN_EMAIL=admin@localhost
index 1d876ab23aeb7a7bf314cf60c2bfbd3517536237..25a2d1c4d2ee24613a02a619248ccb8777cb3c60 100644 (file)
@@ -27,7 +27,7 @@ import org.testng.annotations.Optional;
 import org.testng.annotations.Parameters;
 import org.testng.annotations.Test;
 
-@Test( groups = { "about" }, alwaysRun = true )
+@Test( groups = {"about"}, alwaysRun = true )
 public class ArchivaAdminTest
     extends AbstractArchivaTest
 {
@@ -49,12 +49,12 @@ public class ArchivaAdminTest
     }
 
     @BeforeTest
-    @Parameters( { "baseUrl", "browser", "seleniumHost", "seleniumPort" } )
-    public void initializeArchiva( String baseUrl, String browser, @Optional( "localhost" ) String seleniumHost,
-                                   @Optional( "4444" ) int seleniumPort )
+    @Parameters( {"baseUrl", "browser", "maxWaitTimeInMs", "seleniumHost", "seleniumPort"} )
+    public void initializeArchiva( String baseUrl, String browser, int maxWaitTimeInMs,
+                                   @Optional( "localhost" ) String seleniumHost, @Optional( "4444" ) int seleniumPort )
         throws Exception
     {
-        super.open( baseUrl, browser, seleniumHost, seleniumPort );
+        super.open( baseUrl, browser, seleniumHost, seleniumPort, Integer.toString( maxWaitTimeInMs ) );
         getSelenium().open( baseUrl );
         String title = getSelenium().getTitle();
         if ( title.endsWith( "Create Admin User" ) )
index 61ec5e137a99656cccac9d8e35b67c67e820e829..06cce2b220421876adcb908190e47620aa65fd51 100644 (file)
@@ -19,6 +19,11 @@ package org.apache.archiva.web.test.parent;
  * under the License.
  */
 
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+import org.apache.commons.io.IOUtils;
+import org.testng.Assert;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -29,11 +34,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
 
-import com.thoughtworks.selenium.DefaultSelenium;
-import com.thoughtworks.selenium.Selenium;
-import org.apache.commons.io.IOUtils;
-import org.testng.Assert;
-
 /**
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @version $Id: AbstractSeleniumTestCase.java 761154 2009-04-02 03:31:19Z wsmoak $
@@ -57,18 +57,16 @@ public abstract class AbstractSeleniumTest
     {
         p = new Properties();
         p.load( this.getClass().getClassLoader().getResourceAsStream( "testng.properties" ) );
-
-        // baseUrl = getProperty( "BASE_URL" );
-        maxWaitTimeInMs = getProperty( "MAX_WAIT_TIME_IN_MS" );
     }
 
     /**
      * Initialize selenium
      */
-    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort )
+    public void open( String baseUrl, String browser, String seleniumHost, int seleniumPort, String maxWaitTimeInMs )
         throws Exception
     {
-        this.baseUrl = baseUrl;
+        AbstractSeleniumTest.baseUrl = baseUrl;
+        AbstractSeleniumTest.maxWaitTimeInMs = maxWaitTimeInMs;
 
         if ( getSelenium() == null )
         {
@@ -201,7 +199,7 @@ public abstract class AbstractSeleniumTest
 
         assertElementPresent( locator );
     }
-    
+
     public void assertImgWithAltNotPresent( String alt )
     {
         assertElementNotPresent( "/¯img[@alt='" + alt + "']" );
@@ -285,8 +283,8 @@ public abstract class AbstractSeleniumTest
 
     public boolean isButtonWithValuePresent( String text )
     {
-        return isElementPresent( "//button[@value='" + text + "']" )
-            || isElementPresent( "//input[@value='" + text + "']" );
+        return isElementPresent( "//button[@value='" + text + "']" ) || isElementPresent(
+            "//input[@value='" + text + "']" );
     }
 
     public boolean isButtonWithIdPresent( String text )