continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wsm...@apache.org
Subject svn commit: r748952 - in /continuum/trunk/continuum-webapp-test: Readme.txt pom.xml src/test/java/org/apache/continuum/web/test/AboutTest.java src/test/resources/it.properties
Date Sun, 01 Mar 2009 02:26:02 GMT
Author: wsmoak
Date: Sun Mar  1 02:26:01 2009
New Revision: 748952

URL: http://svn.apache.org/viewvc?rev=748952&view=rev
Log:
[CONTINUUM-2073] Use Cargo plugin's support for multiple data sources.  Add in conditional
logic to create the admin user, log in, and save the general configuration so that the About
test will succeed.

Modified:
    continuum/trunk/continuum-webapp-test/Readme.txt
    continuum/trunk/continuum-webapp-test/pom.xml
    continuum/trunk/continuum-webapp-test/src/test/java/org/apache/continuum/web/test/AboutTest.java
    continuum/trunk/continuum-webapp-test/src/test/resources/it.properties

Modified: continuum/trunk/continuum-webapp-test/Readme.txt
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/Readme.txt?rev=748952&r1=748951&r2=748952&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/Readme.txt (original)
+++ continuum/trunk/continuum-webapp-test/Readme.txt Sun Mar  1 02:26:01 2009
@@ -6,12 +6,11 @@
  * in Selenium IDE, modify the Base URL if necessary (for example, http://localhost:8080/continuum)
  * in Selenium IDE, click the 'Play entire test suite' icon
 
-Run Selenium tests in src/test/java with Maven
- * Start Continuum, create admin user, and save General Configuration
+Run Selenium tests in src/test/java with Maven and Cargo using support for multiple data
sources
  * modify src/test/resources/it.properties as needed
  * mvn clean install
 
-Run Selenium tests in src/test/it with Maven
+Run Selenium tests in src/test/it with Maven and Cargo with alternate configuration
  * modify src/test/resources/it.properties as needed
  * mvn clean install -f it-pom.xml
 

Modified: continuum/trunk/continuum-webapp-test/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/pom.xml?rev=748952&r1=748951&r2=748952&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/pom.xml (original)
+++ continuum/trunk/continuum-webapp-test/pom.xml Sun Mar  1 02:26:01 2009
@@ -29,7 +29,6 @@
   <packaging>pom</packaging>
 
   <build>
-    <!--testSourceDirectory>src/test/it</testSourceDirectory-->
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -73,6 +72,95 @@
         </executions>
       </plugin>
       <plugin>
+        <groupId>org.codehaus.cargo</groupId>
+        <artifactId>cargo-maven2-plugin</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>start-container</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start</goal>
+            </goals>
+            <configuration>
+              <wait>false</wait>
+            </configuration>
+          </execution>
+          <execution>
+            <id>stop-container</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <container>
+            <containerId>${container.name}</containerId>
+            <zipUrlInstaller>
+              <url>${container.url}</url>
+              <installDir>${project.build.directory}/installs/${container.name}</installDir>
+            </zipUrlInstaller>
+            <log>${project.build.directory}/logs/${container.name}.log</log>
+            <output>${project.build.directory}/logs/${container.name}.out</output>
+            <timeout>600000</timeout>
+            <systemProperties>
+              <appserver.base>${project.build.directory}</appserver.base>
+              <derby.system.home>${project.build.directory}</derby.system.home>
+            </systemProperties>
+            <dependencies>
+              <dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+              </dependency>
+              <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+              </dependency>
+              <dependency>
+                <groupId>javax.activation</groupId>
+                <artifactId>activation</artifactId>
+              </dependency>
+            </dependencies>
+          </container>
+          <configuration>
+            <home>${project.build.directory}/${container.name}</home>
+            <type>standalone</type>
+            <properties>
+              <cargo.servlet.port>9595</cargo.servlet.port>
+              <cargo.datasource.datasource.users>
+                cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
+                cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/users;create=true|
+                cargo.datasource.jndi=jdbc/users|
+                cargo.datasource.username=sa
+              </cargo.datasource.datasource.users>
+              <cargo.datasource.datasource.builds>
+                cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
+                cargo.datasource.url=jdbc:derby:${project.build.directory}/databases/${container.name}/builds;create=true|
+                cargo.datasource.jndi=jdbc/continuum|
+                cargo.datasource.username=sa
+              </cargo.datasource.datasource.builds>
+              <cargo.resource.resource.mail>
+                cargo.resource.name=mail/Session|
+                cargo.resource.type=javax.mail.Session|
+                cargo.resource.factory=org.apache.naming.factory.MailSessionFactory|
+                cargo.resource.parameters=mail.smtp.host=localhost
+              </cargo.resource.resource.mail>
+            </properties>
+            <deployables>
+              <deployable>
+                <groupId>${project.goupId}</groupId>
+                <artifactId>continuum-webapp</artifactId>
+                <type>war</type>
+                <properties>
+                  <context>continuum</context>
+                </properties>
+              </deployable>
+            </deployables>
+          </configuration>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <executions>
@@ -106,17 +194,66 @@
       <scope>test</scope>
     </dependency>
     
-    <!-- dependencies below are for code in src/test/it -->
+    <!-- deployables -->
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
+      <groupId>org.apache.continuum</groupId>
+      <artifactId>continuum-webapp</artifactId>
+      <version>${project.version}</version>
+      <type>war</type>
+    </dependency>
+
+    <!-- container dependencies -->
+    <dependency>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>10.1.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.mail</groupId>
+      <artifactId>mail</artifactId>
       <version>1.4</version>
     </dependency>
     <dependency>
-      <groupId>org.openqa.selenium.server</groupId>
-      <artifactId>selenium-server</artifactId>
-      <version>0.8.1</version>
+      <groupId>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <version>1.1</version>
     </dependency>
-
   </dependencies>
+
+  <profiles>
+    <profile>
+      <id>tomcat5x</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <container.name>tomcat5x</container.name>
+        <container.url>http://apache.mirrors.redwire.net/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.zip
+        </container.url>
+      </properties>
+    </profile>
+    <profile>
+      <id>firefox</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <properties>
+        <browser>*firefox</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>iexplore</id>
+      <properties>
+        <browser>*iexplore</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>otherbrowser</id>
+      <properties>
+        <browser>*custom ${browserPath}</browser>
+      </properties>
+    </profile>
+
+  </profiles>
+
 </project>

Modified: continuum/trunk/continuum-webapp-test/src/test/java/org/apache/continuum/web/test/AboutTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/java/org/apache/continuum/web/test/AboutTest.java?rev=748952&r1=748951&r2=748952&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/java/org/apache/continuum/web/test/AboutTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/java/org/apache/continuum/web/test/AboutTest.java
Sun Mar  1 02:26:01 2009
@@ -12,6 +12,10 @@
 	private String baseUrl;
     public String maxWaitTimeInMs;
     private Selenium selenium;
+    private String adminUsername;
+    private String adminFullname;
+    private String adminEmail;
+    private String adminPassword;
 
     public void setUp() throws Exception {
 
@@ -25,8 +29,19 @@
         int seleniumPort = Integer.parseInt( (p.getProperty( "SELENIUM_PORT" ) ) );
         String seleniumBrowser = p.getProperty( "SELENIUM_BROWSER" );
 
+        adminUsername = p.getProperty( "ADMIN_USERNAME" );
+        adminFullname = p.getProperty( "ADMIN_FULLNAME" );
+        adminEmail = p.getProperty( "ADMIN_EMAIL" );
+        adminPassword = p.getProperty( "ADMIN_PASSWORD" );
+
         selenium = new DefaultSelenium( seleniumHost, seleniumPort, seleniumBrowser, baseUrl
);
         selenium.start();
+
+        //make sure the initial config has been done
+        createAdminUser();
+        adminLogin();
+        generalConfiguration();
+
     }
 
     public void tearDown() throws Exception {
@@ -34,9 +49,46 @@
     }
 
     public void testAboutDisplay() {
+
     	selenium.open( baseUrl + "/about.action" );
     	selenium.waitForPageToLoad( maxWaitTimeInMs );
 
     	assertEquals("Continuum - About", selenium.getTitle());
     }
-}
+
+    private void createAdminUser() {
+
+        selenium.open( baseUrl );
+
+        if( selenium.getTitle().endsWith( "Create Admin User") ) {
+            selenium.type( "user.fullName", adminFullname );
+            selenium.type( "user.email", adminEmail );
+            selenium.type( "user.password", adminPassword );
+            selenium.type( "user.confirmPassword", adminPassword );
+            selenium.click( "adminCreateForm_0" );
+            selenium.waitForPageToLoad( maxWaitTimeInMs );
+        }
+    }
+
+    private void adminLogin() {
+
+        selenium.open( baseUrl );
+
+        if ( selenium.getTitle().endsWith( "Login Page") ) {
+            selenium.type( "username", adminUsername );
+            selenium.type( "password", adminPassword );
+            selenium.click( "loginForm__login");
+            selenium.waitForPageToLoad( maxWaitTimeInMs );
+        }
+    }
+
+    private void generalConfiguration() {
+
+        selenium.open( baseUrl );
+
+        if ( selenium.getTitle().endsWith( "Configuration" ) ) {
+            selenium.click( "configuration_" );
+            selenium.waitForPageToLoad( maxWaitTimeInMs );
+        }
+    }
+}
\ No newline at end of file

Modified: continuum/trunk/continuum-webapp-test/src/test/resources/it.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/it.properties?rev=748952&r1=748951&r2=748952&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/it.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/it.properties Sun Mar  1 02:26:01
2009
@@ -1,9 +1,11 @@
 #properties for integration tests
 
-BASE_URL=http://localhost:9090
+BASE_URL=http://localhost:9595/continuum
 MAX_WAIT_TIME_IN_MS=60000
 
 ADMIN_USERNAME=admin
+ADMIN_FULLNAME=Administrator
+ADMIN_EMAIL=admin@localhost
 ADMIN_PASSWORD=admin123
 
 SELENIUM_HOST=localhost



Mime
View raw message