continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wsm...@apache.org
Subject svn commit: r784790 - in /continuum/sandbox/continuum-webapp-test-many-roles: ./ src/ src/site/ src/site/apt/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/continuum/ src/test/java/org/apache/continuum/w...
Date Mon, 15 Jun 2009 14:25:32 GMT
Author: wsmoak
Date: Mon Jun 15 14:25:31 2009
New Revision: 784790

URL: http://svn.apache.org/viewvc?rev=784790&view=rev
Log:
Add a Selenium test to explore what happens when there are many project groups (which means
many security roles) in Continuum.

Added:
    continuum/sandbox/continuum-webapp-test-many-roles/
    continuum/sandbox/continuum-webapp-test-many-roles/pom.xml
    continuum/sandbox/continuum-webapp-test-many-roles/src/
    continuum/sandbox/continuum-webapp-test-many-roles/src/site/
    continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/
    continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/index.apt
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java
    continuum/sandbox/continuum-webapp-test-many-roles/src/test/resources/

Added: continuum/sandbox/continuum-webapp-test-many-roles/pom.xml
URL: http://svn.apache.org/viewvc/continuum/sandbox/continuum-webapp-test-many-roles/pom.xml?rev=784790&view=auto
==============================================================================
--- continuum/sandbox/continuum-webapp-test-many-roles/pom.xml (added)
+++ continuum/sandbox/continuum-webapp-test-many-roles/pom.xml Mon Jun 15 14:25:31 2009
@@ -0,0 +1,409 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.continuum</groupId>
+    <artifactId>continuum</artifactId>
+    <version>1.4.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>continuum-webapp-test-many-roles</artifactId>
+  <name>Continuum Webapp Test</name>
+  <packaging>pom</packaging>
+
+  <build>
+    <testResources>
+      <testResource>
+        <directory>src/test/resources</directory>
+        <filtering>true</filtering>
+        <includes>
+          <include>**/*</include>
+        </includes>
+      </testResource>
+    </testResources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+          <verbose>true</verbose>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>testResources</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>selenium-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start-server</goal>
+            </goals>
+            <configuration>
+              <background>true</background>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>integration-tests</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <systemProperties>
+                <property>
+                  <name>browser</name>
+                  <value>${browser}</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <repositories>
+    <repository>
+      <id>openqa</id>
+      <url>http://nexus.openqa.org/content/repositories/releases</url>
+      <snapshots><enabled>false</enabled></snapshots>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>openqa</id>
+      <url>http://nexus.openqa.org/content/repositories/releases</url>
+      <snapshots><enabled>false</enabled></snapshots>
+    </pluginRepository>
+  </pluginRepositories>
+	
+  <dependencies>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <version>5.8</version>
+      <scope>test</scope>
+      <classifier>jdk15</classifier>
+    </dependency>
+    
+    <!-- deployables -->
+    <dependency>
+      <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>javax.activation</groupId>
+      <artifactId>activation</artifactId>
+      <version>1.1</version>
+    </dependency>
+
+    <!-- dependencies below are for code in src/test/it -->
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openqa.selenium.server</groupId>
+      <artifactId>selenium-server</artifactId>
+      <version>0.9.2</version>
+      <exclusions>
+        <exclusion>
+          <groupId> commons-logging</groupId>
+          <artifactId> commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.openqa.selenium.client-drivers</groupId>
+      <artifactId>selenium-java-client-driver</artifactId>
+      <version>0.9.2</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId> commons-logging</groupId>
+          <artifactId> commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>create-container</id>
+      <activation>
+        <property>
+          <name>!container</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-maven2-plugin</artifactId>
+            <version>1.0</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>${cargo.installs.directory}/${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>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>tomcat5x</id>
+      <activation>
+        <property>
+          <name>!container</name>
+        </property>
+      </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>existing-container</id>
+      <activation>
+        <property>
+          <name>container</name>
+          <value>existing</value>
+        </property>
+      </activation>
+      <!-- edit src/test/resources/it.properties as needed -->
+    </profile>
+    <profile>
+      <id>firefox</id>
+      <activation>
+        <property>
+          <name>!browser</name>
+        </property>
+      </activation>
+      <properties>
+        <browser>*firefox</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>iexplore</id>
+      <activation>
+        <property>
+          <name>browser</name>
+          <value>iexplore</value>
+        </property>
+      </activation>
+      <properties>
+        <browser>*iexplore</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>safari</id>
+      <activation>
+        <property>
+          <name>browser</name>
+          <value>safari</value>
+        </property>
+      </activation>
+      <properties>
+        <browser>*safari</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>otherbrowser</id>
+      <activation>
+        <property>
+          <name>browser</name>
+          <value>other</value>
+        </property>
+      </activation>
+      <properties>
+        <browser>*custom ${browserPath}</browser>
+      </properties>
+    </profile>
+    <profile>
+      <id>headless</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>selenium-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>xvfb</id>
+                <phase>validate</phase>
+                <goals>
+                  <goal>xvfb</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  <profile>
+    <id>reporting</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <testFailureIgnore>true</testFailureIgnore>
+            </configuration>
+          </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-report-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>report-only</id>
+              <goals>
+                <goal>report-only</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </build>
+  </profile>
+  </profiles>
+  <properties>
+    <cargo.installs.directory>${basedir}/target/installs</cargo.installs.directory>
+  </properties>
+</project>

Added: continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/index.apt?rev=784790&view=auto
==============================================================================
--- continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/index.apt (added)
+++ continuum/sandbox/continuum-webapp-test-many-roles/src/site/apt/index.apt Mon Jun 15 14:25:31
2009
@@ -0,0 +1,11 @@
+
+
+
+
+ First, start Continuum.
+
+ For example, from the continuum-webapp module with:  mvn clean jetty:run
+
+ Edit the class file to change the url if necessary
+
+ Then run this module with:  mvn clean install -Dcontainer=existing
\ No newline at end of file

Added: continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java
URL: http://svn.apache.org/viewvc/continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java?rev=784790&view=auto
==============================================================================
--- continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java
(added)
+++ continuum/sandbox/continuum-webapp-test-many-roles/src/test/java/org/apache/continuum/web/test/SlowLoginWithManyRolesTest.java
Mon Jun 15 14:25:31 2009
@@ -0,0 +1,147 @@
+package org.apache.continuum.web.test;
+
+import org.testng.annotations.Test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Test for slow login when there are many roles
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import com.thoughtworks.selenium.SeleneseTestCase;
+import java.util.regex.Pattern;
+import java.util.Date;
+
+/**
+ * Based on AboutTest of Wendy Smoak test.
+ *
+ * @author JosŽ Morales Mart’nez
+ * @version $Id$
+ */
+
+@Test
+public class SlowLoginWithManyRolesTest extends SeleneseTestCase
+{
+
+	public void setUp() throws Exception {
+		setUp("http://localhost:9090/", "*chrome");
+	}
+
+	public void testNew() throws Exception {
+
+        long begin, end;
+
+        // Add the admin user
+		selenium.open("/security/addadmin.action");
+		selenium.type("adminCreateForm_user_fullName", "Administrator");
+		selenium.type("adminCreateForm_user_email", "admin@example.com");
+		selenium.type("adminCreateForm_user_password", "admin123");
+		selenium.type("adminCreateForm_user_confirmPassword", "admin123");
+		selenium.click("adminCreateForm_0");
+		selenium.waitForPageToLoad("30000");
+
+        //Save the general configuration
+		selenium.click("configuration_");
+		selenium.waitForPageToLoad("30000");
+
+        //Add a project group
+        selenium.click("link=Show Project Groups");
+        selenium.waitForPageToLoad("30000");
+        selenium.click("addProjectGroup");
+        selenium.waitForPageToLoad("30000");
+        selenium.type("addProjectGroup_name", "group1");
+        selenium.type("addProjectGroup_groupId", "group1");
+        selenium.click("addProjectGroup_");
+        selenium.waitForPageToLoad("30000");
+
+        //Add many project groups
+        for( int x = 2; x < 400; x++) {
+            selenium.click("link=Show Project Groups");
+            selenium.waitForPageToLoad("30000");
+            selenium.click("addProjectGroup");
+            selenium.waitForPageToLoad("30000");
+            selenium.type("addProjectGroup_name", "group" + x);
+            selenium.type("addProjectGroup_groupId", "group" + x);
+            begin = new Date().getTime();
+            selenium.click("addProjectGroup_");
+            selenium.waitForPageToLoad("30000");
+            end = new Date().getTime();
+
+            System.out.println("===== It took " + (end-begin) + " to add group" + x );
+
+        }
+
+        //Add a user
+        selenium.click("link=Users");
+        selenium.waitForPageToLoad("30000");
+        selenium.click("usercreate_0");
+        selenium.waitForPageToLoad("30000");
+        selenium.type("userCreateForm_user_username", "user1");
+        selenium.type("userCreateForm_user_fullName", "User 1");
+        selenium.type("userCreateForm_user_email", "user1@example.com");
+        selenium.type("userCreateForm_user_password", "user1");
+        selenium.type("userCreateForm_user_password", "user123");
+        selenium.type("userCreateForm_user_confirmPassword", "user123");
+        begin = new Date().getTime();
+        selenium.click("userCreateForm_0");
+        selenium.waitForPageToLoad("30000");
+        selenium.click("//input[@name='addDSelectedRoles' and @value='Project Developer -
group1']");
+        selenium.click("addRolesToUser_submitRolesButton");
+        selenium.waitForPageToLoad("30000");
+        end = new Date().getTime();
+
+        System.out.println( "===== It took " + (end-begin) + " to log in.");
+
+        // User should not have to change its password on login
+		selenium.click("link=user1");
+		selenium.waitForPageToLoad("30000");
+		selenium.click("userEditForm_user_passwordChangeRequired");
+		selenium.click("userEditForm__submit");
+		selenium.waitForPageToLoad("30000");
+		selenium.open("/configuration!save.action");
+
+        // Log out
+        selenium.click("link=Logout");
+        selenium.waitForPageToLoad("30000");
+
+        // Log in as the new user
+        selenium.click("link=Login");
+        selenium.waitForPageToLoad("30000");
+        selenium.type("loginForm_username", "user1");
+        selenium.type("loginForm_password", "user123");
+        selenium.click("loginForm__login");
+        selenium.waitForPageToLoad("30000");
+
+
+        // TODO:  Need to time the login step
+
+
+        selenium.click("link=Logout");
+        selenium.waitForPageToLoad("30000");
+
+	}
+
+}
+



Mime
View raw message