JBoss Rich Faces SVN: r17922 - in root/tests/metamer/trunk: ftest and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-11 11:18:40 -0400 (Sun, 11 Jul 2010)
New Revision: 17922
Added:
root/tests/metamer/trunk/ftest-source/
root/tests/metamer/trunk/ftest-source/.gitignore
root/tests/metamer/trunk/ftest-source/pom.xml
root/tests/metamer/trunk/ftest-source/src/
Removed:
root/tests/metamer/trunk/ftest-source/.gitignore
root/tests/metamer/trunk/ftest-source/pom.xml
root/tests/metamer/trunk/ftest-source/src/
root/tests/metamer/trunk/ftest/ftest-source/
Modified:
root/tests/metamer/trunk/ftest/pom.xml
root/tests/metamer/trunk/pom.xml
Log:
moved ftest-source from ftest to root directory
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-11 14:54:40 UTC (rev 17921)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-11 15:18:40 UTC (rev 17922)
@@ -35,10 +35,6 @@
<name>Metamer: RichFaces Testing Application - Functional Test</name>
<packaging>pom</packaging>
- <modules>
- <module>ftest-source</module>
- </modules>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk...</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/ftest</developerConnection>
Copied: root/tests/metamer/trunk/ftest-source (from rev 17921, root/tests/metamer/trunk/ftest/ftest-source)
Deleted: root/tests/metamer/trunk/ftest-source/.gitignore
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/.gitignore 2010-07-11 14:54:40 UTC (rev 17921)
+++ root/tests/metamer/trunk/ftest-source/.gitignore 2010-07-11 15:18:40 UTC (rev 17922)
@@ -1,5 +0,0 @@
-/.classpath
-/.project
-/.settings
-/target
-/profiles.xml
Copied: root/tests/metamer/trunk/ftest-source/.gitignore (from rev 17920, root/tests/metamer/trunk/ftest/ftest-source/.gitignore)
===================================================================
--- root/tests/metamer/trunk/ftest-source/.gitignore (rev 0)
+++ root/tests/metamer/trunk/ftest-source/.gitignore 2010-07-11 15:18:40 UTC (rev 17922)
@@ -0,0 +1,5 @@
+/.classpath
+/.project
+/.settings
+/target
+/profiles.xml
Deleted: root/tests/metamer/trunk/ftest-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 14:54:40 UTC (rev 17921)
+++ root/tests/metamer/trunk/ftest-source/pom.xml 2010-07-11 15:18:40 UTC (rev 17922)
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
- and individual contributors by the @authors tag. See the copyright.txt
- in the distribution for a full listing of individual contributors.
-
- This is free software; you can redistribute it and/or modify it under
- the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2.1 of the License, or (at
- your option) any later version. This software is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this software; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
- USA, or see the FSF site: http://www.fsf.org.
- -->
-
-<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.richfaces.tests</groupId>
- <artifactId>metamer-root</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.richfaces.tests</groupId>
- <artifactId>metamer-ftest-source</artifactId>
- <name>Metamer: RichFaces Testing Application - Functional Test Source</name>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <artifactId>root</artifactId>
- <groupId>org.jboss.test.richfaces-selenium</groupId>
- <version>1.5.0.Final</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>richfaces-selenium</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: root/tests/metamer/trunk/ftest-source/pom.xml (from rev 17920, root/tests/metamer/trunk/ftest/ftest-source/pom.xml)
===================================================================
--- root/tests/metamer/trunk/ftest-source/pom.xml (rev 0)
+++ root/tests/metamer/trunk/ftest-source/pom.xml 2010-07-11 15:18:40 UTC (rev 17922)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
+ and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors.
+
+ This is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<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.richfaces.tests</groupId>
+ <artifactId>metamer-root</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-ftest-source</artifactId>
+ <name>Metamer: RichFaces Testing Application - Functional Test Source</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <artifactId>root</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.0.Final</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>richfaces-selenium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Copied: root/tests/metamer/trunk/ftest-source/src (from rev 17920, root/tests/metamer/trunk/ftest/ftest-source/src)
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-11 14:54:40 UTC (rev 17921)
+++ root/tests/metamer/trunk/pom.xml 2010-07-11 15:18:40 UTC (rev 17922)
@@ -38,6 +38,7 @@
<modules>
<module>application</module>
+ <module>ftest-source</module>
<module>ftest</module>
</modules>
14 years, 6 months
JBoss Rich Faces SVN: r17921 - in root/tests/metamer/trunk: application and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-11 10:54:40 -0400 (Sun, 11 Jul 2010)
New Revision: 17921
Modified:
root/tests/metamer/trunk/
root/tests/metamer/trunk/application/
root/tests/metamer/trunk/application/src/main/webapp/META-INF/
root/tests/metamer/trunk/application/src/main/webapp/WEB-INF/
root/tests/metamer/trunk/ftest/
root/tests/metamer/trunk/ftest/ftest-source/
Log:
initialized svn:ignore across project
Property changes on: root/tests/metamer/trunk
___________________________________________________________________
Name: svn:ignore
+ .checkstyle
.classpath
.project
.settings
target
Property changes on: root/tests/metamer/trunk/application
___________________________________________________________________
Name: svn:ignore
+ .checkstyle
.classpath
.project
.settings
target
Property changes on: root/tests/metamer/trunk/application/src/main/webapp/META-INF
___________________________________________________________________
Name: svn:ignore
+ context.xml
Property changes on: root/tests/metamer/trunk/application/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ sun-web.xml
Property changes on: root/tests/metamer/trunk/ftest
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
profiles.xml
Property changes on: root/tests/metamer/trunk/ftest/ftest-source
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
profiles.xml
14 years, 6 months
JBoss Rich Faces SVN: r17919 - root/tests/metamer/trunk.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-11 10:20:28 -0400 (Sun, 11 Jul 2010)
New Revision: 17919
Modified:
root/tests/metamer/trunk/pom.xml
Log:
richfaces version switched back to 4.0.0-SNAPSHOT
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-11 14:16:03 UTC (rev 17918)
+++ root/tests/metamer/trunk/pom.xml 2010-07-11 14:20:28 UTC (rev 17919)
@@ -95,7 +95,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<richfaces.checkstyle.version>1</richfaces.checkstyle.version>
- <version.richfaces>4.0.0.Alpha2</version.richfaces>
+ <version.richfaces>4.0.0-SNAPSHOT</version.richfaces>
</properties>
<dependencyManagement>
14 years, 6 months
JBoss Rich Faces SVN: r17918 - in root/tests/metamer/trunk: application and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-11 10:16:03 -0400 (Sun, 11 Jul 2010)
New Revision: 17918
Added:
root/tests/metamer/trunk/application/readme.txt
root/tests/metamer/trunk/release.sh
Removed:
root/tests/metamer/trunk/readme.txt
Modified:
root/tests/metamer/trunk/application/pom.xml
root/tests/metamer/trunk/ftest/ftest-source/pom.xml
root/tests/metamer/trunk/pom.xml
Log:
configured for release; added release.sh script
Modified: root/tests/metamer/trunk/application/pom.xml
===================================================================
--- root/tests/metamer/trunk/application/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
+++ root/tests/metamer/trunk/application/pom.xml 2010-07-11 14:16:03 UTC (rev 17918)
@@ -32,7 +32,6 @@
<groupId>org.richfaces.tests</groupId>
<artifactId>metamer</artifactId>
- <version>4.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Metamer: RichFaces Testing Application</name>
Copied: root/tests/metamer/trunk/application/readme.txt (from rev 17917, root/tests/metamer/trunk/readme.txt)
===================================================================
--- root/tests/metamer/trunk/application/readme.txt (rev 0)
+++ root/tests/metamer/trunk/application/readme.txt 2010-07-11 14:16:03 UTC (rev 17918)
@@ -0,0 +1,48 @@
+Testapp is an application intended to test all RichFaces components on their own, inside other JSF components and in various environments. It contains set of small use-cases implemented using RichFaces components.
+
+
+1 Building and Running the application
+
+
+1.1. Requirements
+
+- Maven 2.1.0 or later
+- Tomcat 6, JBoss 6
+- JDK 1.6
+
+1.2 Optional Additional Software
+- Eclipse IDE + JBoss Tools (to explore and run the application in IDE).
+- You're free to use any other IDE also but we haven't tested an application in other environments.
+
+
+1.3 Building the application for Tomcat
+
+To build a binary for Tomcat, you need to run
+
+ mvn clean package
+
+When you see the BUILD SUCCESSFUL message you can deploy the application on the server. You can deploy it on the server by copying .war file from 'target' folder to
+the TOMCAT_HOME/webapps folder. Then, launch the startup.sh or startup.bat script from TOMCAT_HOME/bin/ directory to start the server.
+
+
+1.4 Building the application for JEE6 containers
+
+To build a binary for JEE6 container, run
+
+ mvn clean package -P jee6
+
+When you see the BUILD SUCCESSFUL message you can deploy the application on the server. You can deploy it on the server by copying .war file from 'target' folder to
+the JBOSS_HOME/server/default/deploy folder. Then, launch the run.sh or run.bat script from JBOSS_HOME/bin/ directory to start the server.
+
+
+1.5 Building and running from Eclipse IDE
+
+In order to explore, run and deploy the application in Eclipse IDE you can use one of the following options:
+
+ * Just import as maven project if using m2eclipse plugin.
+
+ * without m2eclipse - build it with the following command and import as an existing project.
+
+ mvn clean install eclipse:clean eclipse:eclipse
+
+
Modified: root/tests/metamer/trunk/ftest/ftest-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
+++ root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 14:16:03 UTC (rev 17918)
@@ -31,7 +31,6 @@
<groupId>org.richfaces.tests</groupId>
<artifactId>metamer-ftest-source</artifactId>
- <version>4.0.0-SNAPSHOT</version>
<name>Metamer: RichFaces Testing Application - Functional Test Source</name>
<dependencyManagement>
@@ -69,4 +68,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
+++ root/tests/metamer/trunk/pom.xml 2010-07-11 14:16:03 UTC (rev 17918)
@@ -95,7 +95,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<richfaces.checkstyle.version>1</richfaces.checkstyle.version>
- <version.richfaces>4.0.0-SNAPSHOT</version.richfaces>
+ <version.richfaces>4.0.0.Alpha2</version.richfaces>
</properties>
<dependencyManagement>
@@ -126,6 +126,16 @@
</dependencyManagement>
<build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <arguments>-Dselenium.test.skip=true -Dselenium.server.skip=true</arguments>
+ <tagBase>https://svn.jboss.org/repos/qa/richfaces-selenium/tags</tagBase>
+ <branchBase>https://svn.jboss.org/repos/qa/richfaces-selenium/branches</branchBase>
+ </configuration>
+ </plugin>
+ </plugins>
<pluginManagement>
<plugins>
<plugin>
Deleted: root/tests/metamer/trunk/readme.txt
===================================================================
--- root/tests/metamer/trunk/readme.txt 2010-07-11 13:53:50 UTC (rev 17917)
+++ root/tests/metamer/trunk/readme.txt 2010-07-11 14:16:03 UTC (rev 17918)
@@ -1,48 +0,0 @@
-Testapp is an application intended to test all RichFaces components on their own, inside other JSF components and in various environments. It contains set of small use-cases implemented using RichFaces components.
-
-
-1 Building and Running the application
-
-
-1.1. Requirements
-
-- Maven 2.1.0 or later
-- Tomcat 6, JBoss 6
-- JDK 1.6
-
-1.2 Optional Additional Software
-- Eclipse IDE + JBoss Tools (to explore and run the application in IDE).
-- You're free to use any other IDE also but we haven't tested an application in other environments.
-
-
-1.3 Building the application for Tomcat
-
-To build a binary for Tomcat, you need to run
-
- mvn clean package
-
-When you see the BUILD SUCCESSFUL message you can deploy the application on the server. You can deploy it on the server by copying .war file from 'target' folder to
-the TOMCAT_HOME/webapps folder. Then, launch the startup.sh or startup.bat script from TOMCAT_HOME/bin/ directory to start the server.
-
-
-1.4 Building the application for JEE6 containers
-
-To build a binary for JEE6 container, run
-
- mvn clean package -P jee6
-
-When you see the BUILD SUCCESSFUL message you can deploy the application on the server. You can deploy it on the server by copying .war file from 'target' folder to
-the JBOSS_HOME/server/default/deploy folder. Then, launch the run.sh or run.bat script from JBOSS_HOME/bin/ directory to start the server.
-
-
-1.5 Building and running from Eclipse IDE
-
-In order to explore, run and deploy the application in Eclipse IDE you can use one of the following options:
-
- * Just import as maven project if using m2eclipse plugin.
-
- * without m2eclipse - build it with the following command and import as an existing project.
-
- mvn clean install eclipse:clean eclipse:eclipse
-
-
Added: root/tests/metamer/trunk/release.sh
===================================================================
--- root/tests/metamer/trunk/release.sh (rev 0)
+++ root/tests/metamer/trunk/release.sh 2010-07-11 14:16:03 UTC (rev 17918)
@@ -0,0 +1,19 @@
+#!/bin/bash
+RICHFACES_VERSION=`grep '<version.richfaces>' pom.xml | sed -r 's#.*>([^<]+)<.*#\1#'`
+
+echo "Project defines following version of RichFaces ${RICHFACES_VERSION}"
+echo $RICHFACES_VERSION | egrep -q '\-SNAPSHOT$' && { echo "The project cannot depend on SNAPSHOT version, correct the version first and try again."; exit 2; }
+echo "Is this version correct?"
+read -p 'Press ENTER to continue or Ctrl+C for exit...'
+read -p 'Enter release version: ' RELEASE
+read -p 'Enter new development version: ' DEVELOPMENT
+CONF="--batch-mode -Dtag=metamer-${RELEASE} -DreleaseVersion=${RELEASE} -DdevelopmentVersion=${DEVELOPMENT}"
+echo "Configuration: ${CONF}"
+read -p 'Press ENTER to clean...'
+mvn release:clean clean
+read -p 'Press ENTER to dry run...'
+mvn release:prepare -DdryRun=true ${CONF} || exit 1
+read -p 'Press ENTER to clean...'
+mvn release:clean
+read -p 'Press ENTER to prepare...'
+mvn clean release:prepare ${CONF} || exit 1
14 years, 6 months
JBoss Rich Faces SVN: r17917 - in root/tests/metamer/trunk: application and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-11 09:53:50 -0400 (Sun, 11 Jul 2010)
New Revision: 17917
Added:
root/tests/metamer/trunk/application/.gitignore
root/tests/metamer/trunk/pom.xml
Modified:
root/tests/metamer/trunk/application/pom.xml
root/tests/metamer/trunk/ftest/ftest-source/pom.xml
root/tests/metamer/trunk/ftest/pom.xml
Log:
new project structure with root (metamer-root)
Added: root/tests/metamer/trunk/application/.gitignore
===================================================================
--- root/tests/metamer/trunk/application/.gitignore (rev 0)
+++ root/tests/metamer/trunk/application/.gitignore 2010-07-11 13:53:50 UTC (rev 17917)
@@ -0,0 +1,9 @@
+/.checkstyle
+/.classpath
+/.project
+/.settings
+/target
+/profiles.xml
+/nbactions.xml
+/faces-config.NavData
+/nb-configuration.xml
Modified: root/tests/metamer/trunk/application/pom.xml
===================================================================
--- root/tests/metamer/trunk/application/pom.xml 2010-07-11 13:52:57 UTC (rev 17916)
+++ root/tests/metamer/trunk/application/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
@@ -1,397 +1,300 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
+ and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors.
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
+ This is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU Lesser General Public License for more details.
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA, or see the FSF site: http://www.fsf.org.
+ -->
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-
<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/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-parent</artifactId>
- <version>7</version>
- </parent>
-
- <groupId>org.richfaces.tests</groupId>
- <artifactId>metamer</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>war</packaging>
- <name>Metamer: RichFaces Testing Application</name>
-
- <licenses>
- <license>
- <name>GNU Lesser General Public License, Version 2.1</name>
- <distribution>repo</distribution>
- <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/trunk</developerConnection>
- <url>http://fisheye.jboss.org/browse/RichFaces/root/tests/metamer/trunk</url>
- </scm>
-
- <distributionManagement>
- <snapshotRepository>
- <id>jboss-qa-snapshots</id>
- <name>JBoss QA snapshot repository</name>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
- </snapshotRepository>
- <repository>
- <id>jboss-qa-releases</id>
- <name>JBoss QA selease repository</name>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
- </repository>
- </distributionManagement>
-
- <issueManagement>
- <system>jira</system>
- <url>https://jira.jboss.org/jira/browse/RFPL</url>
- </issueManagement>
-
- <developers>
- <developer>
- <name>Pavol Pitonak</name>
- <email>ppitonak(a)redhat.com</email>
- </developer>
- <developer>
- <name>Lukas Fryc</name>
- <email>lfryc(a)redhat.com</email>
- </developer>
- </developers>
-
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-root</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>Metamer: RichFaces Testing Application</name>
+
<repositories>
<repository>
- <id>jboss-qa-repository</id>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/groups/public-all</url>
+ <id>maven-repository2.dev.java.net</id>
+ <name>Java.net Repository for Maven 2</name>
+ <url>http://download.java.net/maven/2</url>
</repository>
- <repository>
- <id>maven-repository2.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>http://download.java.net/maven/2</url>
- </repository>
</repositories>
- <properties>
- <jetty.port>8080</jetty.port>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <richfaces.checkstyle.version>1</richfaces.checkstyle.version>
- <version.richfaces>${project.version}</version.richfaces>
- </properties>
+ <properties>
+ <jetty.port>8080</jetty.port>
+ </properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>2.2</version>
- </dependency>
+ <dependencies>
+ <!-- RichFaces 4 -->
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-bom</artifactId>
- <version>${version.richfaces}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>annotations</artifactId>
- <version>${version.richfaces}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <!-- Java Server Faces 2 -->
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ </dependency>
- <dependencies>
- <!-- RichFaces 4 -->
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>richfaces-components-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.richfaces.cdk</groupId>
- <artifactId>annotations</artifactId>
- </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
- <!-- Java Server Faces 2 -->
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- </dependency>
- <dependency>
- <groupId>${jsf2.impl.groupid}</groupId>
- <artifactId>${jsf2.impl.artifactid}</artifactId>
- </dependency>
+ <!-- Logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- </dependency>
+ <!--
+ <dependency> <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.2.GA</version> <scope>provided</scope> </dependency>
+ -->
+ </dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.12.1</version>
- <scope>test</scope>
- </dependency>
+ <build>
+ <finalName>metamer</finalName>
- <!--<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>4.0.2.GA</version>
- <scope>provided</scope>
- </dependency>-->
- </dependencies>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.18</version>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>${jetty.port}</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <build>
- <finalName>metamer</finalName>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <!-- Configure checkstyle report for this module -->
- <artifactId>maven-checkstyle-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>org.richfaces</groupId>
- <artifactId>richfaces-build-checkstyle
- </artifactId>
- <version>${richfaces.checkstyle.version}
- </version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </pluginManagement>
-
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.18</version>
- <configuration>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- <connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
- <port>${jetty.port}</port>
- <maxIdleTime>60000</maxIdleTime>
- </connector>
- </connectors>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>release</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <executions>
- <execution>
- <id>jee6</id>
- <phase>package</phase>
- <goals>
- <goal>war</goal>
- </goals>
- <configuration>
- <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
- <classifier>jee6</classifier>
- <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*</packagingExcludes>
- <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*</warSourceExcludes>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <classifier>tomcat6</classifier>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>group-sources</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <finalName>sources</finalName>
- <descriptor>assembler.xml</descriptor>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>jar</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <classesDirectory>${basedir}/target/sources/sources</classesDirectory>
- <classifier>sources</classifier>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>jee6</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6
+ <profiles>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ <classifier>jee6</classifier>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*,WEB-INF/lib/jta-*</warSourceExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <classifier>tomcat6</classifier>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>group-sources</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <finalName>sources</finalName>
+ <descriptor>assembler.xml</descriptor>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <classesDirectory>${basedir}/target/sources/sources</classesDirectory>
+ <classifier>sources</classifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jee6</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6
</webappDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <dependencies>
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>${jsf2.impl.groupid}</groupId>
- <artifactId>${jsf2.impl.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>glassfish3</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webappDirectory>${project.build.directory}/${project.build.finalName}-glassfish3
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>glassfish3</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-glassfish3
</webappDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <dependencies>
- <dependency>
- <groupId>${jsf2.api.groupid}</groupId>
- <artifactId>${jsf2.api.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>${jsf2.impl.groupid}</groupId>
- <artifactId>${jsf2.impl.artifactid}</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
Modified: root/tests/metamer/trunk/ftest/ftest-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 13:52:57 UTC (rev 17916)
+++ root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
@@ -1,92 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
+ and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors.
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
+ This is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU Lesser General Public License for more details.
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA, or see the FSF site: http://www.fsf.org.
+ -->
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-
<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>
- <artifactId>root</artifactId>
- <groupId>org.jboss.test.richfaces-selenium</groupId>
- <version>1.5.0.Final</version>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-root</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<groupId>org.richfaces.tests</groupId>
<artifactId>metamer-ftest-source</artifactId>
<version>4.0.0-SNAPSHOT</version>
<name>Metamer: RichFaces Testing Application - Functional Test Source</name>
-
- <licenses>
- <license>
- <name>GNU Lesser General Public License, Version 2.1</name>
- <distribution>repo</distribution>
- <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
- </license>
- </licenses>
-
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/ftest/ft...</developerConnection>
- <url>http://fisheye.jboss.org/browse/RichFaces/root/tests/metamer/trunk/ftest/...</url>
- </scm>
-
- <distributionManagement>
- <snapshotRepository>
- <id>jboss-qa-snapshots</id>
- <name>JBoss QA snapshot repository</name>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
- </snapshotRepository>
- <repository>
- <id>jboss-qa-releases</id>
- <name>JBoss QA selease repository</name>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
- </repository>
- </distributionManagement>
-
- <repositories>
- <repository>
- <id>jboss-qa-repository</id>
- <url>http://nexus.qa.jboss.com:8081/nexus/content/groups/public-all</url>
- </repository>
- </repositories>
-
- <developers>
- <developer>
- <name>Pavol Pitonak</name>
- <email>ppitonak(a)redhat.com</email>
- </developer>
- <developer>
- <name>Lukas Fryc</name>
- <email>lfryc(a)redhat.com</email>
- </developer>
- </developers>
-
- <issueManagement>
- <system>jira</system>
- <url>https://jira.jboss.org/jira/browse/RFPL</url>
- </issueManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <artifactId>root</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.0.Final</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>org.jboss.test</groupId>
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-11 13:52:57 UTC (rev 17916)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
@@ -1,27 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright 2010, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
+ and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors.
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
+ This is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU Lesser General Public License for more details.
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA, or see the FSF site: http://www.fsf.org.
+ -->
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-
<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>
@@ -88,7 +85,7 @@
<properties>
<context.path>/metamer/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
- <ftest.source.version>${project.version}</ftest.source.version>
+ <ftest.source.version>4.0.0-SNAPSHOT</ftest.source.version>
<testng.suite.xml>src/test/resources/testng.xml</testng.suite.xml>
</properties>
Added: root/tests/metamer/trunk/pom.xml
===================================================================
--- root/tests/metamer/trunk/pom.xml (rev 0)
+++ root/tests/metamer/trunk/pom.xml 2010-07-11 13:53:50 UTC (rev 17917)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat, Inc.
+ and individual contributors by the @authors tag. See the copyright.txt
+ in the distribution for a full listing of individual contributors.
+
+ This is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at
+ your option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ USA, or see the FSF site: http://www.fsf.org.
+ -->
+
+<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/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>7</version>
+ </parent>
+
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-root</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Metamer: RichFaces Testing Application - Project Root</name>
+
+ <modules>
+ <module>application</module>
+ <module>ftest</module>
+ </modules>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License, Version 2.1</name>
+ <distribution>repo</distribution>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/trunk</developerConnection>
+ <url>http://fisheye.jboss.org/browse/RichFaces/root/tests/metamer/trunk</url>
+ </scm>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>jboss-qa-snapshots</id>
+ <name>JBoss QA snapshot repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
+ </snapshotRepository>
+ <repository>
+ <id>jboss-qa-releases</id>
+ <name>JBoss QA selease repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
+ </repository>
+ </distributionManagement>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>https://jira.jboss.org/jira/browse/RFPL</url>
+ </issueManagement>
+
+ <developers>
+ <developer>
+ <name>Pavol Pitonak</name>
+ <email>ppitonak(a)redhat.com</email>
+ </developer>
+ <developer>
+ <name>Lukas Fryc</name>
+ <email>lfryc(a)redhat.com</email>
+ </developer>
+ </developers>
+
+ <repositories>
+ <repository>
+ <id>jboss-qa-repository</id>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/groups/public-all</url>
+ </repository>
+ </repositories>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <richfaces.checkstyle.version>1</richfaces.checkstyle.version>
+ <version.richfaces>4.0.0-SNAPSHOT</version.richfaces>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-components-bom</artifactId>
+ <version>${version.richfaces}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>annotations</artifactId>
+ <version>${version.richfaces}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.12.1</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-build-checkstyle</artifactId>
+ <version>${richfaces.checkstyle.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
+
+
+
14 years, 6 months
JBoss Rich Faces SVN: r17915 - in root/ui-sandbox/panels2/trunk/ui/src: main/java/org/richfaces/renderkit/html and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-07-11 08:16:01 -0400 (Sun, 11 Jul 2010)
New Revision: 17915
Added:
root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PopupRendererTest.java
root/ui-sandbox/panels2/trunk/ui/src/test/resources/popupPanelText.xhtml
Modified:
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java
root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js
root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelSizer.js
root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml
Log:
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPanel.java 2010-07-11 12:16:01 UTC (rev 17915)
@@ -25,17 +25,17 @@
/**
* JSF component class
- *
+ *
*/
-public class UIPanel extends UIComponentBase
-{
- public boolean getRendersChildren() {
- return true;
- }
+public class UIPanel extends UIComponentBase {
+ private static final String COMPONENT_FAMILY = "org.richfaces.Panel";
- @Override
- public String getFamily() {
- // TODO Auto-generated method stub
- return "org.richfaces.Panel";
- }
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
}
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/component/UIPopupPanel.java 2010-07-11 12:16:01 UTC (rev 17915)
@@ -24,8 +24,6 @@
import java.util.HashMap;
import java.util.Map;
-import javax.el.ELException;
-import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.UIComponentBase;
@@ -34,163 +32,172 @@
/**
* JSF component class
- *
+ *
*/
-public class UIPopupPanel extends UIComponentBase{
-
- public static final String COMPONENT_TYPE = "org.richfaces.PopupPanel";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.PopupPanel";
-
- private Map<String, Object> visualOptions;
-
- protected enum PropertyKeys {
- selectBehaviour, width, height, zIndex, minHeight, minWidth, maxHeight, maxWidth, top, left, moveable, autosized, modal, domElementAttachment, controlsClass, show, headerClass, keepVisualState, label, overlapEmbedObjects, resizeable, shadowDepth, shadowOpacity, trimOverlayedElements, style, styleClass, visualOptions, scrollerClass
+public class UIPopupPanel extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.PopupPanel";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.PopupPanel";
+
+ protected enum PropertyKeys {
+ width, height, zIndex, minHeight, minWidth, maxHeight, maxWidth, top, left, moveable, autosized, modal, domElementAttachment, controlsClass, show, headerClass, keepVisualState, overlapEmbedObjects, resizeable, shadowDepth, shadowOpacity, style, styleClass, visualOptions
}
-
- public int getZIndex() {
+
+ public Map<String, Object> getHandledVisualOptions() {
+ String options = (String) getStateHelper().eval(PropertyKeys.visualOptions);
+ Map<String, Object> result;
+ result = prepareVisualOptions(options);
+
+ if (null == result) {
+ result = new HashMap<String, Object>();
+ }
+ return result;
+ }
+
+ public String getVisualOptions() {
+ return (String) getStateHelper().eval(PropertyKeys.visualOptions);
+ }
+
+ public void setVisualOptions(String visualOptions) {
+ getStateHelper().put(PropertyKeys.visualOptions, visualOptions);
+ }
+
+ public int getZIndex() {
return (Integer) getStateHelper().eval(PropertyKeys.zIndex, 100);
}
public void setZIndex(int zIndex) {
getStateHelper().put(PropertyKeys.zIndex, zIndex);
}
-
- public int getHeight() {
- return (Integer) getStateHelper().eval(PropertyKeys.height, 400);
+
+ public int getHeight() {
+ return (Integer) getStateHelper().eval(PropertyKeys.height, -1);
}
public void setHeight(int height) {
getStateHelper().put(PropertyKeys.height, height);
}
-
+
public int getWidth() {
- return (Integer) getStateHelper().eval(PropertyKeys.width, 600);
+ return (Integer) getStateHelper().eval(PropertyKeys.width, -1);
}
public void setWidth(int width) {
getStateHelper().put(PropertyKeys.width, width);
}
-
- public int getMinHeight() {
- return (Integer) getStateHelper().eval(PropertyKeys.minHeight, 10);
+
+ public int getMinHeight() {
+ return (Integer) getStateHelper().eval(PropertyKeys.minHeight, -1);
}
public void setMinHeight(int minheight) {
getStateHelper().put(PropertyKeys.minHeight, minheight);
}
-
+
public int getMinWidth() {
- return (Integer) getStateHelper().eval(PropertyKeys.minWidth, 10);
+ return (Integer) getStateHelper().eval(PropertyKeys.minWidth, -1);
}
public void setMinWidth(int minWidth) {
getStateHelper().put(PropertyKeys.minWidth, minWidth);
}
-
+
public int getMaxHeight() {
- return (Integer) getStateHelper().eval(PropertyKeys.maxHeight, 0);
+ return (Integer) getStateHelper().eval(PropertyKeys.maxHeight, Integer.MAX_VALUE);
}
public void setMaxHeight(int maxheight) {
getStateHelper().put(PropertyKeys.maxHeight, maxheight);
}
-
+
public int getMaxWidth() {
- return (Integer) getStateHelper().eval(PropertyKeys.maxWidth, 0);
+ return (Integer) getStateHelper().eval(PropertyKeys.maxWidth, Integer.MAX_VALUE);
}
public void setMaxWidth(int maxWidth) {
getStateHelper().put(PropertyKeys.maxWidth, maxWidth);
}
-
- public String getSelectBehaviour() {
- return (String) getStateHelper().eval(PropertyKeys.selectBehaviour);
- }
-
- public void setSelectBehaviour(String selectBehaviour) {
- getStateHelper().put(PropertyKeys.selectBehaviour, selectBehaviour);
- }
-
+
public String getTop() {
- return (String) getStateHelper().eval(PropertyKeys.top);
+ return (String) getStateHelper().eval(PropertyKeys.top, "auto");
}
public void setTop(String top) {
getStateHelper().put(PropertyKeys.top, top);
}
-
+
public String getLeft() {
- return (String) getStateHelper().eval(PropertyKeys.left);
+ return (String) getStateHelper().eval(PropertyKeys.left, "auto");
}
public void setLeft(String left) {
getStateHelper().put(PropertyKeys.left, left);
}
-
- public boolean isShow() {
+
+ public boolean isShow() {
return (Boolean) getStateHelper().eval(PropertyKeys.show, false);
}
- public void setShow(Boolean show) {
+ public void setShow(boolean show) {
getStateHelper().put(PropertyKeys.show, show);
}
-
- public boolean isMoveable() {
+
+ public boolean isMoveable() {
return (Boolean) getStateHelper().eval(PropertyKeys.moveable, true);
}
- public void setMoveable(Boolean moveable) {
+ public void setMoveable(boolean moveable) {
getStateHelper().put(PropertyKeys.moveable, moveable);
}
-
+
public boolean isAutosized() {
return (Boolean) getStateHelper().eval(PropertyKeys.autosized, false);
}
- public void setAutosized(Boolean autosized) {
+ public void setAutosized(boolean autosized) {
getStateHelper().put(PropertyKeys.autosized, autosized);
}
-
+
public boolean isModal() {
return (Boolean) getStateHelper().eval(PropertyKeys.modal, true);
}
- public void setModal(Boolean modal) {
+ public void setModal(boolean modal) {
getStateHelper().put(PropertyKeys.modal, modal);
}
-
+
public boolean isKeepVisualState() {
return (Boolean) getStateHelper().eval(PropertyKeys.keepVisualState, false);
}
- public void setKeepVisualState(Boolean keepVisualState) {
+ public void setKeepVisualState(boolean keepVisualState) {
getStateHelper().put(PropertyKeys.keepVisualState, keepVisualState);
}
-
+
public boolean isOverlapEmbedObjects() {
return (Boolean) getStateHelper().eval(PropertyKeys.overlapEmbedObjects, false);
}
- public void setOverlapEmbedObjects(Boolean overlapEmbedObjects) {
+ public void setOverlapEmbedObjects(boolean overlapEmbedObjects) {
getStateHelper().put(PropertyKeys.overlapEmbedObjects, overlapEmbedObjects);
}
-
+
public boolean isResizeable() {
return (Boolean) getStateHelper().eval(PropertyKeys.resizeable, true);
}
- public void setResizeable(Boolean resizeable) {
+ public void setResizeable(boolean resizeable) {
getStateHelper().put(PropertyKeys.resizeable, resizeable);
}
-
- public boolean isTrimOverlayedElements() {
- return (Boolean) getStateHelper().eval(PropertyKeys.trimOverlayedElements, false);
- }
- public void setTrimOverlayedElements(Boolean trimOverlayedElements) {
- getStateHelper().put(PropertyKeys.trimOverlayedElements, trimOverlayedElements);
- }
+ /*
+ * public boolean isTrimOverlayedElements() { return (Boolean)
+ * getStateHelper().eval(PropertyKeys.trimOverlayedElements, false); }
+ *
+ * public void setTrimOverlayedElements(boolean trimOverlayedElements) {
+ * getStateHelper().put(PropertyKeys.trimOverlayedElements, trimOverlayedElements); }
+ */
public String getDomElementAttachment() {
return (String) getStateHelper().eval(PropertyKeys.domElementAttachment);
@@ -208,14 +215,12 @@
getStateHelper().put(PropertyKeys.controlsClass, controlsClass);
}
- public String getLabel() {
- return (String) getStateHelper().eval(PropertyKeys.label);
- }
+ /*
+ * public String getLabel() { return (String) getStateHelper().eval(PropertyKeys.label); }
+ *
+ * public void setLabel(String label) { getStateHelper().put(PropertyKeys.label, label); }
+ */
- public void setLabel(String label) {
- getStateHelper().put(PropertyKeys.label, label);
- }
-
public String getHeaderClass() {
return (String) getStateHelper().eval(PropertyKeys.headerClass);
}
@@ -223,15 +228,14 @@
public void setHeaderClass(String headerClass) {
getStateHelper().put(PropertyKeys.headerClass, headerClass);
}
-
- public String getScrollerClass() {
- return (String) getStateHelper().eval(PropertyKeys.scrollerClass);
- }
- public void setScrollerClass(String scrollerClass) {
- getStateHelper().put(PropertyKeys.scrollerClass, scrollerClass);
- }
-
+ /*
+ * public String getScrollerClass() { return (String) getStateHelper().eval(PropertyKeys.scrollerClass); }
+ *
+ * public void setScrollerClass(String scrollerClass) { getStateHelper().put(PropertyKeys.scrollerClass,
+ * scrollerClass); }
+ */
+
public String getShadowDepth() {
return (String) getStateHelper().eval(PropertyKeys.shadowDepth);
}
@@ -239,7 +243,7 @@
public void setShadowDepth(String shadowDepth) {
getStateHelper().put(PropertyKeys.shadowDepth, shadowDepth);
}
-
+
public String getShadowOpacity() {
return (String) getStateHelper().eval(PropertyKeys.shadowOpacity);
}
@@ -247,82 +251,30 @@
public void setShadowOpacity(String shadowOpacity) {
getStateHelper().put(PropertyKeys.shadowOpacity, shadowOpacity);
}
-
- public String getShadowStyle() {
- String shadow = getShadowDepth();
- String shadowStyle ="";
- if (shadow != null) {
- shadowStyle = "top: " + shadow + "px; left: " + shadow + "px;";
- }
-
- String opacity = getShadowOpacity();
- String filterOpacity;
- if (opacity != null) {
- try {
- Double op = Double.valueOf(opacity);
- filterOpacity = Integer.toString(op.intValue() * 10);
- opacity = Double.toString(op.doubleValue() / 10);
- } catch (Exception e) {
- // illegal opacity
- return "";
- }
- shadowStyle += " opacity:" + opacity
- + "; filter:alpha(opacity=" + filterOpacity + ");";
- }
- return shadowStyle;
- }
-
- public Object getVisualOptions() {
- if (null != this.visualOptions) {
- return this.visualOptions;
- }
-
- ValueExpression ve = getValueExpression("visualOptions");
- if (null != ve) {
- try {
- Object value = ve.getValue(getFacesContext().getELContext());
- this.visualOptions = prepareVisualOptions(value);
- return this.visualOptions;
- } catch (ELException e) {
- throw new FacesException(e);
- }
- }
-
- if (null == this.visualOptions) {
- this.visualOptions = new HashMap<String, Object>();
- }
- return this.visualOptions;
- }
- public void setVisualOptions(Object visualOptions) {
- this.visualOptions = prepareVisualOptions(visualOptions);
- }
+ private Map<String, Object> prepareVisualOptions(Object value) {
+ if (null == value) {
+ return new HashMap<String, Object>();
+ } else if (value instanceof Map) {
+ return (Map<String, Object>) value;
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (!s.startsWith("{")) {
+ s = "{" + s + "}";
+ }
+ try {
+ return new HashMap<String, Object>(new JSONMap(s));
+ } catch (JSONException e) {
+ throw new FacesException(e);
+ }
+ } else {
+ throw new FacesException("Attribute visualOptions of component [" + this.getClientId(getFacesContext())
+ + "] must be instance of Map or String, but its type is " + value.getClass().getSimpleName());
+ }
+ }
- private Map<String, Object> prepareVisualOptions(Object value) {
- if (null == value) {
- return new HashMap<String, Object>();
- } else if (value instanceof Map) {
- return (Map<String, Object>) value;
- } else if (value instanceof String) {
- String s = (String) value;
- if (!s.startsWith("{")) {
- s = "{" + s + "}";
- }
- try {
- return new HashMap<String, Object>(new JSONMap(s));
- } catch (JSONException e) {
- throw new FacesException(e);
- }
- } else {
- throw new FacesException("Attribute visualOptions of component [" +
- this.getClientId(getFacesContext()) + "] must be instance of Map or String, but its type is " +
- value.getClass().getSimpleName());
- }
- }
-
- @Override
- public String getFamily() {
- // TODO Auto-generated method stub
- return COMPONENT_FAMILY;
- }
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
}
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/java/org/richfaces/renderkit/html/PopupPanelBaseRenderer.java 2010-07-11 12:16:01 UTC (rev 17915)
@@ -17,224 +17,193 @@
import org.ajax4jsf.renderkit.RendererBase;
import org.richfaces.component.UIPopupPanel;
-
-@ResourceDependencies( {
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
+@ResourceDependencies( { @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-base-component.js"), @ResourceDependency(name = "script/popupPanel.js"),
- @ResourceDependency(name = "script/popupPanelBorders.js"),
- @ResourceDependency(name = "script/popupPanelSizer.js"),
+ @ResourceDependency(name = "script/popupPanelBorders.js"), @ResourceDependency(name = "script/popupPanelSizer.js"),
@ResourceDependency(name = "css/popupPanel.ecss")
})
-public class PopupPanelBaseRenderer extends RendererBase{
+public class PopupPanelBaseRenderer extends RendererBase {
- private static final String CONTROLS_FACET = "controls";
- private static final String HEADER_FACET = "header";
- private static final int sizeA = 10;
- private static final String STATE_OPTION_SUFFIX = "StateOption_";
-
- public String getShadowStyle(FacesContext context, UIComponent component) {
- UIPopupPanel panel = (UIPopupPanel)component;
- return panel.getShadowStyle();
- }
- public void renderHeaderFacet(FacesContext context, UIComponent component) throws IOException {
- renderFacet(context, component, HEADER_FACET);
+ private static final String CONTROLS_FACET = "controls";
+ private static final String HEADER_FACET = "header";
+ private static final int SIZE = 10;
+ private static final String STATE_OPTION_SUFFIX = "StateOption_";
+ private static final Set<String> ALLOWED_ATTACHMENT_OPTIONS = new HashSet<String>();
+ static {
+ ALLOWED_ATTACHMENT_OPTIONS.add("body");
+ ALLOWED_ATTACHMENT_OPTIONS.add("parent");
+ ALLOWED_ATTACHMENT_OPTIONS.add("form");
}
-
- public void renderControlsFacet(FacesContext context, UIComponent component) throws IOException {
- renderFacet(context, component, CONTROLS_FACET);
+
+ public void renderHeaderFacet(FacesContext context, UIComponent component) throws IOException {
+ renderFacet(context, component, HEADER_FACET);
}
-
- private void renderFacet(FacesContext context, UIComponent component, String facet) throws IOException{
- UIComponent headerFacet = component.getFacet(facet);
- headerFacet.encodeAll(context);
- }
-
- @SuppressWarnings("unchecked")
- protected void doDecode(FacesContext context, UIComponent component) {
- super.doDecode(context, component);
-
- UIPopupPanel panel = (UIPopupPanel)component;
- ExternalContext exCtx = context.getExternalContext();
- Map<String, String> rqMap = exCtx.getRequestParameterMap();
- Object panelOpenState = rqMap.get(panel.getClientId(context) + "OpenedState");
-
- if (panel.isKeepVisualState()) {
- if (null != panelOpenState) {
- // Bug https://jira.jboss.org/jira/browse/RF-2466
- // Incorrect old:
- // panel.setShowWhenRendered(Boolean.parseBoolean((String) clnId));
- // ShowWhenRendered can be settled separately with modal panel "showWhenRendered" attribute
- // so we should combine ShowWhenRendered || KeepVisualState && (OpenedState==TRUE) against rewriting
- boolean show = panel.isShow() || Boolean.parseBoolean((String) panelOpenState);
- panel.setShow(show);
-
- Map<String, Object> visualOptions = (Map<String, Object>) panel.getVisualOptions();
- Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
- while ( it.hasNext()) {
- Map.Entry<String, String> entry = it.next();
- int suffixPos = entry.getKey().toString().indexOf(STATE_OPTION_SUFFIX);
- if (-1 != suffixPos) {
- String key = entry.getKey().toString().substring(suffixPos + STATE_OPTION_SUFFIX.length());
- visualOptions.put(key, entry.getValue());
- }
- }
- }
- }
- }
-
- protected Class getComponentClass() {
- return UIPopupPanel.class;
- }
- private static final Set<String> ALLOWED_ATTACHMENT_OPTIONS = new HashSet<String>();
- static {
- ALLOWED_ATTACHMENT_OPTIONS.add("body");
- ALLOWED_ATTACHMENT_OPTIONS.add("parent");
- ALLOWED_ATTACHMENT_OPTIONS.add("form");
- }
-
- //TODO nick - add messages
- public void checkOptions(FacesContext context, UIComponent component) {
- UIPopupPanel panel = (UIPopupPanel)component;
- if (panel.isAutosized() && panel.isResizeable()) {
- throw new IllegalArgumentException("Autosized modal panel can't be resizeable.");
- }
-
- String domElementAttachment = panel.getDomElementAttachment();
- if (domElementAttachment != null && domElementAttachment.trim().length() != 0) {
- if (!ALLOWED_ATTACHMENT_OPTIONS.contains(domElementAttachment)) {
- throw new IllegalArgumentException("Value '" + domElementAttachment + "' of domElementAttachment attribute is illegal. " +
- "Allowed values are: " + ALLOWED_ATTACHMENT_OPTIONS);
- }
- }
-
- if (panel.getMinHeight() != -1) {
- if (panel.getMinHeight() < sizeA) {
- throw new IllegalArgumentException();
- }
-
-// if (panel.getHeight() < panel.getMinHeight()) {
-// panel.setHeight(panel.getMinHeight());
-// }
- }
+ public void renderControlsFacet(FacesContext context, UIComponent component) throws IOException {
+ renderFacet(context, component, CONTROLS_FACET);
+ }
- if (panel.getMinWidth() != -1) {
- if (panel.getMinWidth() < sizeA) {
- throw new IllegalArgumentException();
- }
+ private void renderFacet(FacesContext context, UIComponent component, String facet) throws IOException {
+ UIComponent headerFacet = component.getFacet(facet);
+ headerFacet.encodeAll(context);
+ }
-// if (panel.getWidth() < panel.getMinWidth()) {
-// panel.setWidth(panel.getMinWidth());
-// }
- }
- }
-
-// protected String buildOptions(FacesContext context, UIModalPanel panel) {
-// return getOptions(context, panel, getUtils());
-// }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public String buildShowScript(FacesContext context, UIComponent component) {
- UIPopupPanel panel = (UIPopupPanel)component;
- StringBuilder result = new StringBuilder();
-
- // Bug https://jira.jboss.org/jira/browse/RF-2466
- // We are already processed KeepVisualState and current open state in
- // doDecode, so no need to check panel.isKeepVisualState() here.
- if (/*panel.isKeepVisualState() || */panel.isShow()) {
- result.append("RichFaces.ui.PopupPanel.showPopupPanel('" + panel.getClientId(context) + "', {");
-
- Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getVisualOptions()).entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry<String, Object> entry = it.next();
-
- result.append(entry.getKey() + ": '" + entry.getValue() + "'");
- if (it.hasNext()) {
- result.append(", ");
- }
- }
-
- result.append("});");
- }
- return result.toString();
- }
-
- public String buildScript(FacesContext context, UIComponent component) throws IOException {
- UIPopupPanel panel = (UIPopupPanel)component;
- StringBuilder result = new StringBuilder();
- result.append("new RichFaces.ui.PopupPanel('");
- result.append(panel.getClientId());
- result.append("',{");
- result.append("width:");
- result.append(panel.getWidth());
- result.append(",");
- result.append("height:");
- result.append(panel.getHeight());
- result.append(",");
- result.append("minWidth:");
- result.append(panel.getMinWidth());
- result.append(",");
- result.append("minHeight:");
- result.append(panel.getMinHeight());
- result.append(",");
- result.append("maxWidth:");
- result.append(panel.getMaxWidth());
- result.append(",");
- result.append("maxHeight:");
- result.append(panel.getMaxHeight());
- result.append(",");
- result.append("resizeable:");
- result.append(panel.isResizeable());
- result.append(",");
- result.append("moveable:");
- result.append(panel.isMoveable());
- result.append(",");
- result.append("left:");
- result.append(panel.getLeft());
- result.append(",");
- result.append("top:");
- result.append(panel.getTop());
- result.append(",");
- result.append("zIndex:");
- result.append(panel.getZIndex());
- result.append(",");
- result.append(writeEventHandlerFunction(context, panel,"onresize"));
- result.append(writeEventHandlerFunction(context, panel,"onmove"));
- result.append(writeEventHandlerFunction(context, panel,"onshow"));
- result.append(writeEventHandlerFunction(context, panel,"onhide"));
- result.append(writeEventHandlerFunction(context, panel,"onbeforeshow"));
- result.append(writeEventHandlerFunction(context, panel,"onbeforehide"));
- result.append("domElementAttachment:");
- result.append(panel.getDomElementAttachment());
- result.append(",");
- result.append("keepVisualState:");
- result.append(panel.isKeepVisualState());
- result.append(",");
- result.append("show:");
- result.append(panel.isShow());
- result.append(",");
- result.append("selectBehaviour:");
- result.append(panel.getSelectBehaviour());
- result.append(",");
- result.append("autosized:");
- result.append(panel.isAutosized());
- result.append(",");
- result.append("overlapEmbedObjects:");
- result.append(panel.isOverlapEmbedObjects());
- //result.append(",");
- //result.append(writeVisualOptions(context, panel));
- result.append("});");
- return result.toString();
- }
-
- public String writeEventHandlerFunction(FacesContext context, UIComponent component, String eventName) throws IOException{
- String event = (String) component.getAttributes().get(eventName);
+ @SuppressWarnings("unchecked")
+ protected void doDecode(FacesContext context, UIComponent component) {
+ super.doDecode(context, component);
+ UIPopupPanel panel = (UIPopupPanel) component;
+ ExternalContext exCtx = context.getExternalContext();
+ Map<String, String> rqMap = exCtx.getRequestParameterMap();
+ Object panelOpenState = rqMap.get(panel.getClientId(context) + "OpenedState");
+
+ if (panel.isKeepVisualState()) {
+ if (null != panelOpenState) {
+ // Bug https://jira.jboss.org/jira/browse/RF-2466
+ // Incorrect old:
+ // panel.setShowWhenRendered(Boolean.parseBoolean((String) clnId));
+ // ShowWhenRendered can be settled separately with modal panel "showWhenRendered" attribute
+ // so we should combine ShowWhenRendered || KeepVisualState && (OpenedState==TRUE) against rewriting
+ boolean show = panel.isShow() || Boolean.parseBoolean((String) panelOpenState);
+ panel.setShow(show);
+
+ Map<String, Object> visualOptions = (Map<String, Object>) panel.getHandledVisualOptions();
+ Iterator<Entry<String, String>> it = rqMap.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<String, String> entry = it.next();
+ int suffixPos = entry.getKey().toString().indexOf(STATE_OPTION_SUFFIX);
+ if (-1 != suffixPos) {
+ String key = entry.getKey().toString().substring(suffixPos + STATE_OPTION_SUFFIX.length());
+ visualOptions.put(key, entry.getValue());
+ }
+ }
+ }
+ }
+ }
+
+ protected Class getComponentClass() {
+ return UIPopupPanel.class;
+ }
+
+ public void checkOptions(FacesContext context, UIComponent component) {
+ UIPopupPanel panel = (UIPopupPanel) component;
+ if (panel.isAutosized() && panel.isResizeable()) {
+ throw new IllegalArgumentException("Autosized modal panel can't be resizeable.");
+ }
+
+ String domElementAttachment = panel.getDomElementAttachment();
+ if (domElementAttachment != null && domElementAttachment.trim().length() != 0) {
+ if (!ALLOWED_ATTACHMENT_OPTIONS.contains(domElementAttachment)) {
+ throw new IllegalArgumentException("Value '" + domElementAttachment
+ + "' of domElementAttachment attribute is illegal. " + "Allowed values are: "
+ + ALLOWED_ATTACHMENT_OPTIONS);
+ }
+ }
+
+ if (panel.getMinHeight() != -1) {
+ if (panel.getMinHeight() < SIZE) {
+ throw new IllegalArgumentException();
+ }
+
+ }
+
+ if (panel.getMinWidth() != -1) {
+ if (panel.getMinWidth() < SIZE) {
+ throw new IllegalArgumentException();
+ }
+
+ }
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ public String buildShowScript(FacesContext context, UIComponent component) {
+ UIPopupPanel panel = (UIPopupPanel) component;
+ StringBuilder result = new StringBuilder();
+
+ // Bug https://jira.jboss.org/jira/browse/RF-2466
+ // We are already processed KeepVisualState and current open state in
+ // doDecode, so no need to check panel.isKeepVisualState() here.
+ if (panel.isShow()) {
+ result.append("RichFaces.ui.PopupPanel.showPopupPanel('" + panel.getClientId(context) + "', {");
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getHandledVisualOptions()).entrySet()
+ .iterator();
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() + "'");
+ if (it.hasNext()) {
+ result.append(", ");
+ }
+ }
+
+ result.append("});");
+ }
+ return result.toString();
+ }
+
+ private void writeOption(StringBuilder builder, String attribbute, Object value, UIComponent component,
+ boolean isString) {
+ if (component.getAttributes().get(attribbute) != null) {
+ builder.append(attribbute + ":");
+ if (isString) {
+ builder.append("'");
+ }
+ builder.append(value);
+ if (isString) {
+ builder.append("'");
+ }
+ builder.append(",");
+ }
+ }
+
+ public String buildScript(FacesContext context, UIComponent component) throws IOException {
+ UIPopupPanel panel = (UIPopupPanel) component;
+ StringBuilder result = new StringBuilder();
+ result.append("new RichFaces.ui.PopupPanel('");
+ result.append(panel.getClientId());
+ result.append("',{");
+ writeOption(result, "width", panel.getWidth(), component, false);
+ writeOption(result, "height", panel.getHeight(), component, false);
+ writeOption(result, "minWidth", panel.getMinWidth(), component, false);
+ writeOption(result, "minHeight", panel.getMinHeight(), component, false);
+ writeOption(result, "maxWidth", panel.getMaxWidth(), component, false);
+ writeOption(result, "maxHeight", panel.getMaxHeight(), component, false);
+ writeOption(result, "resizeable", panel.isResizeable(), component, false);
+ writeOption(result, "moveable", panel.isMoveable(), component, false);
+ writeOption(result, "left", panel.getLeft(), component, true);
+ writeOption(result, "top", panel.getTop(), component, true);
+ writeOption(result, "zIndex", panel.getZIndex(), component, false);
+ writeOption(result, "onresize", writeEventHandlerFunction(context, panel, "onresize"), component, false);
+ writeOption(result, "onmove", writeEventHandlerFunction(context, panel, "onmove"), component, false);
+ writeOption(result, "onshow", writeEventHandlerFunction(context, panel, "onshow"), component, false);
+ writeOption(result, "onhide", writeEventHandlerFunction(context, panel, "onhide"), component, false);
+ writeOption(result, "onbeforeshow", writeEventHandlerFunction(context, panel, "onbeforeshow"), component, false);
+ writeOption(result, "onbeforehide", writeEventHandlerFunction(context, panel, "onbeforehide"), component, false);
+ writeOption(result, "shadowDepth", panel.getShadowDepth(), component, true);
+ writeOption(result, "shadowOpacity", panel.getShadowOpacity(), component, true);
+ writeOption(result, "domElementAttachment", panel.getDomElementAttachment(), component, true);
+ writeOption(result, "keepVisualState", panel.isKeepVisualState(), component, false);
+ writeOption(result, "show", panel.isShow(), component, false);
+ writeOption(result, "autosized", panel.isAutosized(), component, false);
+ writeOption(result, "overlapEmbedObjects", panel.isOverlapEmbedObjects(), component, false);
+ result.delete(result.length() - 1, result.length());
+ if (component.getAttributes().get("visualOptions") != null) {
+ result.append(writeVisualOptions(context, panel));
+ }
+ result.append("});");
+ return result.toString();
+ }
+
+ public String writeEventHandlerFunction(FacesContext context, UIComponent component, String eventName)
+ throws IOException {
+ String event = (String) component.getAttributes().get(eventName);
+
if (event != null) {
event = event.trim();
@@ -249,24 +218,24 @@
}
return "";
- }
-
- private String writeVisualOptions(FacesContext context, UIPopupPanel panel)
- throws IOException {
- StringBuffer result = new StringBuffer();
-
- Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getVisualOptions()).entrySet().iterator();
- if (it.hasNext()) {
- result.append(",\n");
- }
- while (it.hasNext()) {
- Map.Entry<String, Object> entry = it.next();
-
- result.append(entry.getKey() + ": '" + entry.getValue() + "'");
- if (it.hasNext()) {
- result.append(",\n");
- }
- }
- return result.toString();
- }
+ }
+
+ private String writeVisualOptions(FacesContext context, UIPopupPanel panel) throws IOException {
+ StringBuffer result = new StringBuffer();
+
+ Iterator<Map.Entry<String, Object>> it = ((Map<String, Object>) panel.getHandledVisualOptions()).entrySet()
+ .iterator();
+ if (it.hasNext()) {
+ result.append(",\n");
+ }
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+
+ result.append(entry.getKey() + ": '" + entry.getValue() + "'");
+ if (it.hasNext()) {
+ result.append(",");
+ }
+ }
+ return result.toString();
+ }
}
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/css/popupPanel.ecss 2010-07-11 12:16:01 UTC (rev 17915)
@@ -8,6 +8,7 @@
top: 0px;
z-index: -300;
opacity:0.1;
+ filter : 'alpha(opacity=10)';
}
.mp_shade {
@@ -18,6 +19,7 @@
left : 0px;
background : #D0D0D0;
opacity:0.5;
+ filter : 'alpha(opacity=50)';
}
.mp_iframe {
position : absolute;
@@ -26,26 +28,16 @@
top:0px;
left : 0px;
opacity:0.3;
+ filter : 'alpha(opacity=30)';
}
.mp_shadow {
position : fixed;
- top : 50%;
- left : 50%;
- width : 602px;
- height : 402px ;
background-color : #000000;
- margin-top : -197px;
- margin-left : -297px;
opacity:0.1;
+ filter : 'alpha(opacity=10)';
}
.mp_container {
position : fixed;
- top : 50%;
- left : 50%;
- width : 600px;
- height : 400px;
- margin-top : -200px;
- margin-left : -300px;
border : '1px solid #{richSkin.panelBorderColor}';
background : '#{richSkin.generalBackgroundColor}';
z-index:100;
@@ -53,22 +45,21 @@
.mp_header {
background : "url(#{resource['org.richfaces.renderkit.html.GradientA']})";
repeat-x : 'top left #{richSkin.headerBackgroundColor}';
- height : 30px;
position : relative;
- padding-right : 60px;
padding-left : 10px;
cursor : move;
+ padding : 2px;
}
.mp_header_content {
overflow : hidden;
- width : 100%;
white-space : nowrap;
- padding-top : 8px;
text-overflow: ellipsis;
font-weight : '#{richSkin.headerWeightFont}';
color : '#{richSkin.headerTextColor}';
font-family : '#{richSkin.headerFamilyFont}';
font-size : '#{richSkin.headerSizeFont}';
+ padding : 2px;
+ padding-left : 10px;
}
.mp_header_controls {
background : "url(#{resource['images/close_act.gif']}) no-repeat center";
@@ -90,13 +81,10 @@
text-align : middle;
}
.mp_content_scroller {
- width : 600px ;
- height : 370px ;
position : relative;
top : 0px;
left : 0px;
overflow : auto;
- overflow-x : hidden;
}
.mp_content {
position : relative;
@@ -127,6 +115,16 @@
right : 0px;
cursor : w-resize;
}
+
+.mp-iframe {
+ position: absolute;
+ left: 0px;
+ top: 0px;
+ background-color: white;
+ overflow-y: hidden;
+ z-index: -1;
+}
+
.mp_handler_top {
width : 100%;
height : 7px;
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanel.js 2010-07-11 12:16:01 UTC (rev 17915)
@@ -1,21 +1,20 @@
(function ($, richfaces) {
richfaces.ui = richfaces.ui || {};
- var selectionEventHandler=function(event){event.stopPropagation();};
+ var selectionEventHandler = function(event){
+ event.stopPropagation();
+ event.preventDefault();
+ };
var disableSelection = function (element)
{
if (typeof element.onselectstart!="undefined") //IE
{
- jQuery(element).bind( 'selectstart', this.selectionEventHandler);
+ jQuery(element).bind( 'selectstart', selectionEventHandler);
}
- else if (typeof element.style.MozUserSelect!="undefined") //Firefox
- {
- jQuery(element).css('MozUserSelect','none');
- }
else //All other (ie: Opera)
{
- jQuery(element).bind( 'mousedown', this.selectionEventHandler);
+ jQuery(element).bind( 'mousedown', selectionEventHandler);
}
}
@@ -23,7 +22,7 @@
{
if (typeof element.onselectstart!="undefined") //IE
{
- jQuery(element).unbind( 'selectstart', this.selectionEventHandler);
+ jQuery(element).unbind( 'selectstart', selectionEventHandler);
}
else if (typeof element.style.MozUserSelect!="undefined") //Firefox
{
@@ -31,44 +30,32 @@
}
else //All other (ie: Opera)
{
- jQuery(element).unbind( 'mousedown', this.selectionEventHandler);
+ jQuery(element).unbind( 'mousedown', selectionEventHandler);
}
}
-
- PANELS = new Array();
- ACTIVEPANELS = new Array();
- var getSizeElements = function() {
- return document.body;
- }
-
- var getMinimumSize = function(size) {
- return Math.max(size, 2*richfaces.ui.PopupPanel.Sizer.INITIAL_MIN + 2);//TODO
- };
richfaces.ui.PopupPanel = function(id, options) {
$super.constructor.call(this,id);
-
+ this.markerId = id;
$p.attachToDom.call(this, id);
id = "#" + id;
this.options = options;
- this.firstOutside = null;
- this.lastOutside = null;
- this.markerId = $(id);
this.id = $(id);
-
+ this.minWidth = this.getMinimumSize(this.options.minWidth);
+ this.minHeight = this.getMinimumSize(this.options.minHeight);
+ this.maxWidth = this.options.maxWidth;
+ this.maxHeight = this.options.maxHeight;
this.options = options;
this.baseZIndex = this.options.zindex ? this.options.zindex : 100;
-
- this.minWidth = getMinimumSize(this.options.minWidth);
- this.minHeight = getMinimumSize(this.options.minHeight);
this.div = id;
- this.cdiv = id + "_container";//TODO remove one
+ this.cdiv = id + "_container";
this.contentDiv = id + "_content";
this.shadowDiv = id + "_shadow";
+ this.scrollerDiv = id + "_content_scroller"
this.borders = new Array();
@@ -86,21 +73,15 @@
if (this.options.moveable && $(id + "_header")) {
this.header = new richfaces.ui.PopupPanel.Border(id + "_header", this, "move", richfaces.ui.PopupPanel.Sizer.Header);
+ } else{
+ $(id + "_header").css('cursor', 'default');
}
- this.markerId.component = this;
-
- PANELS.push(this);
-
- this.firstHref = id + "FirstHref";
- this.lastHref = id + "LastHref";
- this.selectBehavior = options.selectBehavior;
};
var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent, richfaces.ui.PopupPanel);
var $p = richfaces.BaseComponent.extend(richfaces.BaseComponent,richfaces.ui.PopupPanel, {});
var $super = richfaces.ui.PopupPanel.$super;
-
$.extend(richfaces.ui.PopupPanel.prototype, (function (options) {
return {
@@ -116,46 +97,48 @@
},
width: function() {
- return this.getSizedElement().clientWidth;
+ return this.getContentElement()[0].clientWidth;//TODO
},
height: function() {
- return this.getSizedElement().clientHeight;
+ return this.getContentElement()[0].clientHeight;//TODO
},
-
- getSizedElement: function() {
- if (!this._sizedElement) {
- this._sizedElement = $(this.cdiv);
+
+ getLeft : function (){
+ return $(this.cdiv).css('left');
+ },
+
+ getTop : function (){
+ return $(this.cdiv).css('top');
+ },
+
+ getInitialSize : function(){
+ if(this.options.autosized){
+ return $(this.div+"_headerSpan").height();
+ } else{
+ return $(this.div + "_header_content").height();
}
-
- return this._sizedElement;
},
-
+
getContentElement: function() {
if (!this._contentElement) {
- this._contentElement = $(this.contentDiv);
+ this._contentElement = $(this.cdiv);
}
return this._contentElement;
},
-
+ getSizeElement : function() {
+ return document.body;
+ },
+
+ getMinimumSize : function(size) {
+ return Math.max(size, 2*this.getInitialSize() + 2);
+ },
destroy: function() {
-
- if (this.observerSize) {
- window.clearInterval(this.observerSize);
- this.observerSize = null;
- }
this._contentElement = null;
- this._sizedElement = null;
-
- //PANELS = PANELS.without(this);
-
- //ACTIVEPANELS = ACTIVEPANELS.without(this);
this.parent = null;
- this.firstOutside = null;
- this.lastOutside = null;
if (this.header) {
this.header.destroy();
this.header=null;
@@ -170,12 +153,9 @@
var element = this.id;
var parent = $(element).parent();
if (parent) {
- parent.removeChild(element);
+ parent.remove(element);
}
}
-
- this.markerId.component = null;
- this.markerId = null;
},
initIframe : function() {
@@ -187,97 +167,31 @@
}
if("transparent" == $(document.body).css("background-color")) {
- this.style.filter = "alpha(opacity=0)";
- this.style.opacity = "0";
+ $(this).css('filter', "alpha(opacity=0)");
+ $(this).css('opacity', "0");
}
},
setLeft: function(pos) {
- $(this.cdiv).css('left', pos + "px");
+ if(!isNaN(pos)){
+ $(this.cdiv).css('left', pos + "px");
+ var depth = this.options.shadowDepth ? this.options.shadowDepth : 2;
+ $(this.shadowDiv).css('left', pos + depth + "px");
+ }
},
setTop: function(pos) {
- $(this.cdiv).css('top', pos + "px");
- },
-
- firstOnfocus: function(event) {
- var e = $(this.firstHref)
- //if (e && (ACTIVEPANELS.last() == this)) {
- e.focus();
- //}
- },
-
- lastOnfocus: function(event) {
- var e = $(this.lastHref);
- //if (e && (ACTIVEPANELS.last() == this)) {
- e.focus();
- //}
- },
-
- processAllFocusElements: function(root, callback) {
-
- var popup = this;
- $('a, input, select, button, textarea', root).not(':disabled').not(':hidden').each(function(index) {
- callback.call($(this), popup);
- });
- },
-
- processTabindexes: function(popup) {
- if (!popup.firstOutside ) {
- popup.firstOutside = this;
+ if(!isNaN(pos)){
+ $(this.cdiv).css('top', pos + "px");
+ var depth = this.options.shadowDepth ? this.options.shadowDepth : 2;
+ $(this.shadowDiv).css('top', pos + depth +"px");
}
- popup.lastOutside = this;
- if (this.tabIndex && !this.prevTabIndex) {
- this.prevTabIndex = this.tabIndex;
- }
- this.tabIndex = undefined;
- if (this.accesskey && !this.prevAccesskey) {
- this.prevAccesskey = this.accesskey;
- }
- this.accesskey = undefined;
},
- restoreTabindexes: function(popup) {
- if (this.prevTabIndex) {
- this.tabIndex = this.prevTabIndex;
- this.prevTabIndex = undefined;
- }
- if (this.prevAccesskey) {
- this.accesskey = this.prevAccesskey;
- this.prevAccesskey = undefined;
- }
- },
-
- preventFocus: function() {
- this.processAllFocusElements(document, this.processTabindexes);
-
- if (this.firstOutside) {
- $(this.firstOutside).bind( "focus", this.firstOnfocus);
- }
- if (this.lastOutside && this.lastOutside != this.firstOutside) {
- $(this.lastOutside).bind( "focus", this.lastOnfocus);
- }
- },
-
- restoreFocus: function() {
- this.processAllFocusElements(document, this.restoreTabindexes);
-
- if (this.firstOutside) {
- $(this.firstOutside).unbind("focus", this.eventFirstOnfocus);
- this.firstOutside = null;
- }
- if (this.lastOutside) {
- $(this.lastOutside).unbind("focus", this.eventLastOnfocus);
- this.lastOutside = null;
- }
- },
-
show: function(event, opts) {
if(!this.shown && this.invokeEvent("beforeshow",event,null,element)) {
var element = this.id;
-
- this.preventFocus();
if (!this.domReattached) {
this.parent = $(element).parent();
@@ -303,38 +217,27 @@
if (newParent != this.parent) {
this.saveInputValues(element);
- element.insertBefore(newParent);
+ element.insertBefore(newParent.firstChild);
this.domReattached = true;
} else {
$(this.parent).show();
}
}
- var eCdiv = $(this.cdiv);
- var forms = $("form", eCdiv);
+ var forms = $("form", element);
if (this.options.keepVisualState && forms) {
for (var i = 0; i < forms.length; i++) {
- $(forms[i]).bind( "submit", this.setStateInput);
+ var popup = this;
+ $(forms[i]).bind( "submit", {popup:popup}, this.setStateInput);
}
}
- var eIframe;
- if (this.options.overlapEmbedObjects && !this.iframe) {
- this.iframe = this.id + "IFrame";
- $("<iframe src=\"javascript:''\" frameborder=\"0\" scrolling=\"no\" id=\"" + this.iframe + "\" " +
- "class=\"rich-mpnl-iframe\" style=\"width: 1px; height: 1px;\">" +
- "</iframe>").insertBefore($(':first-child', eCdiv));
-
- eIframe = jQery(this.iframe);
+
- $(eIframe).bind('load', this.initIframe);
- }
-
var options = {};
this.userOptions = {};
-
- if (!eCdiv.mpSet) {
+ if (!element.mpSet) {
$.extend(options, this.options);
}
@@ -343,44 +246,64 @@
$.extend(this.userOptions, opts);
}
- this.currentMinHeight = getMinimumSize((options.minHeight || options.minHeight == 0) ? options.minHeight : this.minHeight);
- this.currentMinWidth = getMinimumSize((options.minWidth || options.minWidth == 0) ? options.minWidth : this.minWidth);
+ this.currentMinHeight = this.getMinimumSize((options.minHeight || options.minHeight == 0) ? options.minHeight : this.minHeight);
+ this.currentMinWidth = this.getMinimumSize((options.minWidth || options.minWidth == 0) ? options.minWidth : this.minWidth);
var eContentElt = this.getContentElement();
if (!this.options.autosized) {
if (options.width && options.width == -1)
- options.width = 300;
+ options.width = 600;
if (options.height && options.height == -1)
- options.height = 200;
+ options.height = 400;
+ } else{
+ options.width = $(this.div+"_headerSpan").width() +20;
}
if (options.width && options.width != -1) {
if (this.currentMinWidth > options.width) {
options.width = this.currentMinWidth;
}
-
+ if (options.width > this.maxWidth) {
+ options.width = this.maxWidth;
+ }
$(eContentElt).css('width', options.width + (/px/.test(options.width) ? '' : 'px'));
+ $(this.shadowDiv).css('width', options.width + 4 + (/px/.test(options.width) ? '' : 'px'));
+ $(this.scrollerDiv).css('width', options.width + (/px/.test(options.width) ? '' : 'px'));
+
+
}
if (options.height && options.height != -1) {
if (this.currentMinHeight > options.height) {
options.height = this.currentMinHeight;
}
-
+ if (options.height > this.maxHeight) {
+ options.height = this.maxHeight;
+ }
$(eContentElt).css('height', options.height + (/px/.test(options.height) ? '' : 'px'));
+ $(this.shadowDiv).css('height', options.height + 4 + (/px/.test(options.height) ? '' : 'px'));
+ var headerHeight = $(this.div +"_header")[0].clientHeight;
+ $(this.scrollerDiv).css('height', options.height - headerHeight + (/px/.test(options.height) ? '' : 'px'));
+
+
}
+ var eIframe;
+ if (this.options.overlapEmbedObjects && !this.iframe) {
+ this.iframe = this.markerId + "IFrame";
+ $("<iframe src=\"javascript:''\" frameborder=\"0\" scrolling=\"no\" id=\"" + this.iframe + "\" " +
+ "class=\"mp-iframe\" style=\"width:" +this.options.width + "px; height:" + this.options.height + "px;\">" +
+ "</iframe>").insertBefore($(':first-child', $(this.cdiv))[0]);
+
+ eIframe = jQuery("#"+this.iframe);
- eCdiv.mpSet = true;
+ $(eIframe).bind('load', this.initIframe);
+ this.eIframe = eIframe;
+ }
+ element.mpSet = true;
- //ACTIVEPANELS = ACTIVEPANELS.without(this);
- ACTIVEPANELS.push(this);
-
var eDiv = $(this.div);
- $(element).css('visibility', '');
- this.correctShadowSize();
-
if (options.left) {
var _left;
if (options.left != "auto") {
@@ -414,28 +337,12 @@
this.setTop(Math.round(_top));
}
-
- if (this.options.autosized) {
- this.observerSize =
- window.setInterval(this.correctShadowSize.bindAsEventListener(this), 500);
- }
-
- this.doResizeOrMove(richfaces.ui.PopupPanel.Sizer.Diff.EMPTY);//TODO
-
- for (var k = 0; k < this.borders.length; k++ ) {
- this.borders[k].doPosition();
- }
-
- if (this.header) {
- this.header.doPosition();
- }
-
- $(eCdiv).hide().css('visibility', '');
-
- this.lastOnfocus();
-
- $(eCdiv).show();
-
+
+ var opacity = options.shadowOpacity ? options.shadowOpacity : 0.1;
+ $(this.shadowDiv).css('opacity', opacity);
+ $(this.shadowDiv).css('filter ', 'alpha(opacity='+opacity*100 +');');
+ $(element).css('visibility', '');
+ $(element).css('display', 'block');
var event = {};
event.parameters = opts || {};
this.shown = true;
@@ -459,27 +366,19 @@
},
hide: function(event, opts) {
+ var element = this.id;
if (this.shown && this.invokeEvent("beforehide",event,null,element)) {
this.currentMinHeight = undefined;
- this.currentMinWidth = undefined;
-
- this.restoreFocus();
-
- this.enableSelects();
+ this.currentMinWidth = undefined;
- //ACTIVEPANELS = ACTIVEPANELS.without(this);
-
- var eDiv = $(this.div);
- var eCdiv = $(this.cdiv);
-
$(this.id).hide();
if (this.parent) {
if (this.domReattached) {
this.saveInputValues(element);
- this.parent.appendChild(element);
+ this.parent.append(element);
this.domReattached = false;
} else {
@@ -493,7 +392,7 @@
this.options.onhide(event);
}
- var forms = $("form", eCdiv);
+ var forms = $("form", element);
if (this.options.keepVisualState && forms) {
for (var i = 0; i < forms.length; i++) {
$(forms[i]).unbind( "submit", this.setStateInput);
@@ -502,14 +401,6 @@
this.shown = false;
- if (this.observerSize) {
- window.clearInterval(this.observerSize);
- this.observerSize = null;
- }
-
- if (ACTIVEPANELS.length > 0) {
- ACTIVEPANELS.last().preventFocus();
- }
}
},
@@ -519,12 +410,18 @@
doResizeOrMove: function(diff) {
var vetoes = {};
+ var shadowHash = {};
var cssHash = {};
var cssHashWH = {};
+ var shadowHashWH = {};
+ var contentHashWH = {};
+ var scrollerHashWH = {};
var vetoeChange = false;
var newSize;
-
+ var shadowDepth = this.options.shadowDepth? this.options.shadowDepth: 4;
+ var scrollerHeight = 22;
+ var scrollerWidth = 0;
var eContentElt = this.getContentElement();
newSize = this.getStyle(eContentElt, "width");
@@ -532,20 +429,39 @@
var oldSize = newSize;
newSize += diff.deltaWidth || 0;
+
+
if (newSize >= this.currentMinWidth || this.options.autosized) {
if (diff.deltaWidth) {
cssHashWH.width = newSize + 'px';
+ shadowHashWH.width = newSize + shadowDepth + 'px';
+ contentHashWH.width = newSize - scrollerWidth + 'px';
+ scrollerHashWH.width = newSize - scrollerWidth + 'px';
}
} else {
if (diff.deltaWidth) {
cssHashWH.width = this.currentMinWidth + 'px';
-
+ shadowHashWH.width = this.currentMinWidth + shadowDepth + 'px';
+ contentHashWH.width = this.currentMinWidth - scrollerWidth + 'px';
+ scrollerHashWH.width = this.currentMinWidth - scrollerWidth + 'px';
vetoes.vx = oldSize - this.currentMinWidth;
}
vetoes.x = true;
}
+
+ if (newSize >= this.options.maxWidth) {
+ if (diff.deltaWidth) {
+ cssHashWH.width = this.currentMaxWidth + 'px';
+ shadowHashWH.width = this.currentMaxWidth + shadowDepth + 'px';
+ contentHashWH.width = this.currentMaxWidth - scrollerWidth + 'px';
+ scrollerHashWH.width = this.currentMaxWidth - scrollerWidth + 'px';
+ vetoes.vx = oldSize - this.currentMaxWidth;
+ }
+ vetoes.x = true;
+ }
+
if (vetoes.vx && diff.deltaX) {
diff.deltaX = -vetoes.vx;
}
@@ -561,6 +477,8 @@
newPos = this.getStyle(eCdiv, "left");
newPos += diff.deltaX;
cssHash.left = newPos + 'px';
+
+ shadowHash.left = newPos + shadowDepth + "px";
}
newSize = this.getStyle(eContentElt, "height")
@@ -571,17 +489,31 @@
if (newSize >= this.currentMinHeight || this.options.autosized) {
if (diff.deltaHeight) {
cssHashWH.height = newSize + 'px';
+ shadowHashWH.height = newSize + shadowDepth + 'px';
+ scrollerHashWH.height = newSize - scrollerHeight + 'px';
}
} else {
if (diff.deltaHeight) {
cssHashWH.height = this.currentMinHeight + 'px';
-
+ shadowHashWH.height = this.currentMinHeight + shadowDepth + 'px';
+ scrollerHashWH.height = this.currentMinHeight - scrollerHeight + 'px';
vetoes.vy = oldSize - this.currentMinHeight;
}
vetoes.y = true;
}
+
+ if (newSize >= this.options.maxHeight) {
+ if (diff.deltaHeight) {
+ cssHashWH.height = this.currentMaxHeight + 'px';
+ shadowHashWH.height = this.currentMaxHeight + shadowDepth + 'px';
+ scrollerHashWH.height = this.currentMaxHeight - scrollerHeight + 'px';
+ vetoes.vy = oldSize - this.currentMaxHeight;
+ }
+ vetoes.y = true;
+ }
+
if (vetoes.vy && diff.deltaY) {
diff.deltaY = -vetoes.vy;
}
@@ -592,27 +524,38 @@
}
}
-
+ if (diff.deltaY && (vetoes.vy || !vetoes.y)) {
+ if (vetoes.vy) {
+ diff.deltaY = vetoes.vy;
+ }
+ var newPos;
+
+ newPos = this.getStyle(eCdiv, "top");
+ newPos += diff.deltaY;
+ cssHash.top = newPos + 'px';
+ shadowHash.top = newPos + shadowDepth + "px";
+ }
$(eContentElt).css(cssHashWH);
+ $(this.scrollerDiv).css(scrollerHashWH);
+ if(this.eIframe)$(this.eIframe).css(scrollerHashWH);
+ $(this.shadowDiv).css(shadowHashWH);
$(eCdiv).css(cssHash);
-
- this.correctShadowSize();
-
+ $(this.shadowDiv).css(shadowHash);
+ //if(this.eIframe)$(this.eIframe).css(cssHash);
$.extend(this.userOptions, cssHash);
$.extend(this.userOptions, cssHashWH);
-
var w = this.width();
var h = this.height();
this.reductionData = null;
- if (w <= 2*richfaces.ui.PopupPanel.Sizer.INITIAL_MAX) {//todo
+ if (w <= 2*this.getInitialSize()) {
this.reductionData = {};
this.reductionData.w = w;
}
- if (h <= 2*richfaces.ui.PopupPanel.Sizer.INITIAL_MAX) {//todo
+ if (h <= 2*this.getInitialSize()) {
if (!this.reductionData) {
this.reductionData = {};
}
@@ -626,6 +569,31 @@
return vetoes;
},
+
+ setSize : function (width, height){
+ var w = width - this.width() ;
+ var h = height -this.height();
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(0,0, w, h);
+ this.doResizeOrMove(diff);
+ },
+
+ moveTo : function (top, left){
+ var shadowDepth = this.options.shadowDepth? this.options.shadowDepth: 4;
+ $(this.cdiv).css('top', top);
+ $(this.cdiv).css('left', left);
+ $(this.shadowDiv).css('top', top + shadowDepth);
+ $(this.shadowDiv).css('left', left + shadowDepth);
+ },
+
+ move : function (dx, dy){
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(dx,dy, 0, 0);
+ this.doResizeOrMove(diff);
+ },
+
+ resize : function (dx, dy){
+ var diff = new richfaces.ui.PopupPanel.Sizer.Diff(0,0, dx, dy);
+ this.doResizeOrMove(diff);
+ },
findForm: function(elt) {
var target = elt;
@@ -642,54 +610,30 @@
return target;
},
- setStateInput: function(target) {
+ setStateInput: function(event) {
// Concret input but not entire form is a target element for onsubmit in FF
- target = this.findForm(target);
+ var popup = event.data.popup;
+ target = $(popup.findForm(event.currentTarget));
var input = document.createElement("input");
input.type = "hidden";
- input.id = this.markerId.id + "OpenedState";
- input.name = this.markerId.id + "OpenedState";
- input.value = this.shown ? "true" : "false";
- target.appendChild(input);
+ input.id = popup.markerId + "OpenedState";
+ input.name = popup.markerId + "OpenedState";
+ input.value = popup.shown ? "true" : "false";
+ target.append(input);
- $.each(userOptions, function(key, value) {
+ $.each(popup.userOptions, function(key, value) {
input = document.createElement("input");
input.type = "hidden";
- input.id = this.id.id + "StateOption_" + key;
- input.name = this.id.id + "StateOption_" + key;
+ input.id = popup.markerId + "StateOption_" + key;
+ input.name = popup.markerId + "StateOption_" + key;
input.value = value;
- target.appendChild(input);
+ target.append(input);
});
return true;
},
- correctShadowSize: function() {
- var eShadowDiv = $(this.shadowDiv);
- if (!eShadowDiv) {
- return;
- }
- var eIframe = $(this.iframe);
-
- var dx = 0;
- var dy = 0;
- if (!$.browser.msie)
- {
- dx = eShadowDiv.offsetWidth-eShadowDiv.clientWidth;
- dy = eShadowDiv.offsetHeight-eShadowDiv.clientHeight;
- }
- var w = this.width();
- var h = this.height();
- $(eShadowDiv).css('width ', (w-dx)+"px");
- $(eShadowDiv).css('height' , (h-dy)+"px");
-
- if (eIframe) {
- $(eIframe).css('width',w+"px");
- $(eIframe).css('height',h+"px");
- }
- },
-
invokeEvent: function(eventName, event, value, element) {
var eventFunction = this.options['on'+eventName];
@@ -721,69 +665,22 @@
result = true;
}
return result;
- },
- showModalPanel : function (id, opts, event) {
-
- var invoke =
- ($.browser.msie || $.browser.safari) ?
- function(f) {
- if (document.readyState != "complete") {
- var args = arguments;
- var dis = this;
- window.setTimeout(
- function() {
- args.callee.apply(dis,args );
- }, 50);
- } else {
- f();
- }
- } :
- function(f) {
- f();
- };
-
- var panel = $(id);
- if (!panel) {
- panel = findModalPanel(id);
}
- invoke(function() {
- $(panel.component).show(opts);
- });
- },
-
- hideModalPanel : function (id, opts, event) {
- var panel = $(id);
- if (!panel) {
- panel = findModalPanel(id);
- }
- $(panel.component).hide(opts);
- },
-
- findModalPanel : function (id) {
- if (id) {
- var prefId = (id.charAt(0) == ':' ? id : ':' + id);
-
- for (var i = 0; i < PANELS.length; i++ ) {
- var pnl = PANELS[i];
- if (pnl && pnl.markerId) {
- var pnlId = pnl.markerId.id;
-
- if (pnlId) {
- //try to match ids
- if (pnlId.length >= prefId.length) {
- var substr = pnlId.substring(pnlId.length - prefId.length, pnlId.length);
- if (substr == prefId) {
- return pnl.markerId;
- }
- }
- }
- }
- }
- }
- }
+
}
})());
+ $.extend(richfaces.ui.PopupPanel, {
+
+ showPopupPanel : function (id, opts, event) {
+
+ $(document).ready(richfaces.$(id).show());
+ },
+ hidePopupPanel : function (id, opts, event) {
+ $(document).ready(richfaces.$(id).hide());
+ }
+ });
+
})(jQuery, window.RichFaces);
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelBorders.js 2010-07-11 12:16:01 UTC (rev 17915)
@@ -8,14 +8,11 @@
var element = jQuery(id);
jQuery(element).css('cursor',cursor);
+ var border = this;
+ jQuery(this.id).bind( 'mousedown', {border:border},this.startDrag);
- jQuery(this.id).bind( 'mousedown', this.startDrag, new Date());
-
this.modalPanel = modalPanel;
this.sizer = sizer;
-
- //this.boundDoDrag = this.doDrag.bindAsEventListener(this);
- //this.boundEndDrag = this.endDrag.bindAsEventListener(this);
};
var $super = richfaces.BaseComponent.extend(richfaces.BaseComponent, richfaces.ui.PopupPanel.Border);
@@ -48,21 +45,21 @@
},
startDrag: function(event) {
- this.doingDrag = true;
+ var border = event.data.border;
+ border.doingDrag = true;
- this.dragX = event.clientX;
- this.dragY = event.clientY;
-
- jQuery(document).bind( 'mousemove', this.doDrag);
- jQuery(document).bind( 'mouseup', this.endDrag);
+ border.dragX = event.clientX;
+ border.dragY = event.clientY;
+ jQuery(document).bind( 'mousemove',{border:border}, border.doDrag);
+ jQuery(document).bind( 'mouseup',{border:border}, border.endDrag);
- var eCursorDiv = jQuery(this.modalPanel.cDiv);
- jQuery(eCursorDiv).css('cursor', jQuery(this.id).css('cursor'));
- jQuery(eCursorDiv).css('zIndex', 10);
+ //var eCursorDiv = jQuery(border.modalPanel.cDiv);
+ //jQuery(eCursorDiv).css('cursor', jQuery(border.id).css('cursor'));
+ //jQuery(eCursorDiv).css('zIndex', 10);
- this.modalPanel.startDrag(this);
+ border.modalPanel.startDrag(border);
- this.onselectStartHandler = document.onselectstart;
+ border.onselectStartHandler = document.onselectstart;
document.onselectstart = function() { return false; }
},
@@ -82,16 +79,15 @@
},
doDrag: function(event) {
- if (!this.doingDrag) {
+ var border = event.data.border;
+ if (!border.doingDrag) {
return ;
}
var evtX = event.clientX;
var evtY = event.clientY;
- var winSize = this.getWindowSize();
-
- //window.status = "" + evtX + " " + evtY;
+ var winSize = border.getWindowSize();
if (evtX < 0) {
evtX = 0;
@@ -105,48 +101,48 @@
evtY = winSize.height - 1;
}
- var dx = evtX - this.dragX;
- var dy = evtY - this.dragY;
+ var dx = evtX - border.dragX;
+ var dy = evtY - border.dragY;
if (dx != 0 || dy != 0) {
- var id = this.id;
+ var id = border.id;
- var diff = this.sizer.doDiff(dx, dy);
+ var diff = border.sizer.prototype.doDiff(dx, dy);//TODO
var doResize;
- var element = jQuery(this.modalPanel.cdiv);
+ var element = jQuery(border.modalPanel.cdiv);
if (diff.deltaWidth || diff.deltaHeight) {
- doResize = this.modalPanel.invokeEvent("resize",event,null,element);
+ doResize = border.modalPanel.invokeEvent("resize",event,null,element);
} else if (diff.deltaX || diff.deltaY) {
- doResize = this.modalPanel.invokeEvent("move",event,null,element);
+ doResize = border.modalPanel.invokeEvent("move",event,null,element);
}
var vetoes;
if (doResize) {
- vetoes = this.modalPanel.doResizeOrMove(diff);
+ vetoes = border.modalPanel.doResizeOrMove(diff);
}
if(vetoes){
if (!vetoes.x) {
- this.dragX = evtX;
+ border.dragX = evtX;
} else {
if (!diff.deltaX) {
- this.dragX -= vetoes.vx || 0;
+ border.dragX -= vetoes.vx || 0;
} else {
- this.dragX += vetoes.vx || 0;
+ border.dragX += vetoes.vx || 0;
}
}
if (!vetoes.y) {
- this.dragY = evtY;
+ border.dragY = evtY;
} else {
if (!diff.deltaY) {
- this.dragY -= vetoes.vy || 0;
+ border.dragY -= vetoes.vy || 0;
} else {
- this.dragY += vetoes.vy || 0;
+ border.dragY += vetoes.vy || 0;
}
}
}
@@ -154,20 +150,18 @@
},
endDrag: function(event) {
- this.doingDrag = undefined;
+ var border = event.data.border;
+ border.doingDrag = undefined;
- jQuery(document).unbind( 'mousemove', this.doDrag);
- jQuery(document).unbind( 'mouseup', this.endDrag);
+ jQuery(document).unbind( 'mousemove', border.doDrag);
+ jQuery(document).unbind( 'mouseup', border.endDrag);
- this.modalPanel.endDrag(this);
+ border.modalPanel.endDrag(border);
- this.modalPanel.doResizeOrMove(richfaces.ui.PopupPanel.Sizer.Diff.EMPTY);
- jQuery(this.modalPanel.cursorDiv).css('zIndex ', -200);
+ border.modalPanel.doResizeOrMove(richfaces.ui.PopupPanel.Sizer.Diff.EMPTY);
- document.onselectstart = this.onselectStartHandler;
- this.onselectStartHandler = null;
-
- var id = this.id;
+ document.onselectstart = border.onselectStartHandler;
+ border.onselectStartHandler = null;
},
doPosition: function() {
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelSizer.js
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelSizer.js 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/resources/META-INF/script/popupPanelSizer.js 2010-07-11 12:16:01 UTC (rev 17915)
@@ -14,6 +14,7 @@
return {
name: "richfaces.ui.PopupPanel.Sizer",
+
doSetupSize: function (modalPanel, elt) {
var width = 0;
var height = 0;
@@ -33,15 +34,15 @@
if (width > 0) {
if (elt.clientWidth > width) {
if (!elt.reducedWidth) {
- elt.reducedWidth = elt.style.width;
+ elt.reducedWidth = jQuery(elt).css('width');
}
- elt.style.width = width + 'px';
- } else if (width < ModalPanel.Sizer.INITIAL_MAX && /* TODO fix the dirty code */elt.reducedWidth == ModalPanel.Sizer.INITIAL_MAX + 'px') {
- elt.style.width = width + 'px';
+ jQuery(elt).css('width', width + 'px');
+ } else if (width < 4 && elt.reducedWidth == 4 + 'px') {
+ jQuery(elt).css('width', width + 'px');
}
} else {
if (elt.reducedWidth) {
- elt.style.width = elt.reducedWidth;
+ jQuery(elt).css('width', elt.reducedWidth);
elt.reducedWidth = undefined;
}
}
@@ -49,23 +50,25 @@
if (height > 0) {
if (elt.clientHeight > height) {
if (!elt.reducedHeight) {
- elt.reducedHeight = elt.style.height;
+ elt.reducedHeight = jQuery(elt).css('height');
}
elt.style.height = height + 'px';
- } else if (height < ModalPanel.Sizer.INITIAL_MAX && /* TODO fix the dirty code */elt.reducedHeight == ModalPanel.Sizer.INITIAL_MAX + 'px') {
- elt.style.height = height + 'px';
+ } else if (height < 4 && elt.reducedHeight == 4 + 'px') {
+ jQuery(elt).css('height', height + 'px');
}
} else {
if (elt.reducedHeight) {
- elt.style.height = elt.reducedHeight;
+ jQuery(elt).css('height', elt.reducedHeight);
elt.reducedHeight = undefined;
}
}
},
doSetupPosition: function (modalPanel, elt, left, top) {
- elt.style.left = left + 'px';
- elt.style.top = top + 'px';
+ if(!isNaN(left) && !isNaN(top)){
+ jQuery(elt).css('left', left + 'px');
+ jQuery(elt).css('top', top + 'px');
+ }
},
doPosition: function (modalPanel, elt) {
@@ -95,10 +98,10 @@
richfaces.ui.PopupPanel.Sizer.N = function(){
}
- richfaces.ui.PopupPanel.Sizer.N.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.N.prototype, (function (options) {
+
+ $.extend(richfaces.ui.PopupPanel.Sizer.N.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.N.prototype, {
- return {
name: "richfaces.ui.PopupPanel.Sizer.N",
@@ -111,16 +114,13 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(0, dy, 0, -dy);
},
- }
- })());
+ });
richfaces.ui.PopupPanel.Sizer.NW = function(){
}
- richfaces.ui.PopupPanel.Sizer.NW.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.NW.prototype, (function (options) {
-
- return {
+ $.extend(richfaces.ui.PopupPanel.Sizer.NW.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.NW.prototype, {
name: "richfaces.ui.PopupPanel.Sizer.NW",
@@ -133,16 +133,13 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(dx, dy, -dx, -dy);
}
- }
- })());
+ });
richfaces.ui.PopupPanel.Sizer.NE = function(){
}
- richfaces.ui.PopupPanel.Sizer.NE.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.NE.prototype, (function (options) {
-
- return {
+ $.extend(richfaces.ui.PopupPanel.Sizer.NE.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.NE.prototype, {
name: "richfaces.ui.PopupPanel.Sizer.NE",
@@ -155,43 +152,18 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(0, dy, dx, -dy);
}
- }
- })());
+ });
- richfaces.ui.PopupPanel.Sizer.NEL = function(){
-
- }
- richfaces.ui.PopupPanel.Sizer.NEL.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.NEL.prototype, (function (options) {
-
- return {
-
- name: "richfaces.ui.PopupPanel.Sizer.NEL",
-
- doPosition : function (popupPanel, elt) {
- this.doSetupSize(popupPanel, elt);
- this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth, 0);
- },
-
- doDiff : function(dx, dy) {
- return new richfaces.ui.PopupPanel.Sizer.Diff(0, dy, dx, -dy);
- }
-
- }
- })());
-
richfaces.ui.PopupPanel.Sizer.E = function(){
}
- richfaces.ui.PopupPanel.Sizer.E.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.E.prototype, (function (options) {
-
- return {
+ $.extend(richfaces.ui.PopupPanel.Sizer.E.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.E.prototype, {
name: "richfaces.ui.PopupPanel.Sizer.E",
doPosition : function (popupPanel, elt) {
- jQuery(elt)/css('height', popupPanel.height() + 'px');
+ jQuery(elt).css('height', popupPanel.height() + 'px');
this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth, 0);
},
@@ -199,16 +171,13 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, dx, 0);
}
- }
- })());
+ });
richfaces.ui.PopupPanel.Sizer.SE = function(){
}
- richfaces.ui.PopupPanel.Sizer.SE.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.prototype.SE, (function (options) {
-
- return {
+ $.extend(richfaces.ui.PopupPanel.Sizer.SE.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.prototype.SE, {
name: "richfaces.ui.PopupPanel.Sizer.SE",
@@ -222,39 +191,13 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, dx, dy);
}
- }
- })());
+ });
- richfaces.ui.PopupPanel.Sizer.SEL = function(){
-
- }
- richfaces.ui.PopupPanel.Sizer.SEL.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.SEL.prototype, (function (options) {
-
- return {
-
- name: "richfaces.ui.PopupPanel.Sizer.SEL",
-
- doPosition : function (popupPanel, elt) {
- this.doSetupSize(PopupPanel, elt);
- this.doSetupPosition(popupPanel, elt, popupPanel.width() - elt.clientWidth,
- popupPanel.height() - elt.clientHeight);
- },
-
- doDiff : function(dx, dy) {
- return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, dx, dy);
- }
-
- }
- })());
-
richfaces.ui.PopupPanel.Sizer.S = function(){
}
- richfaces.ui.PopupPanel.Sizer.S.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.S.prototype, (function (options) {
-
- return {
+ $.extend(richfaces.ui.PopupPanel.Sizer.S.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.S.prototype,{
name: "richfaces.ui.PopupPanel.Sizer.S",
@@ -267,39 +210,16 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(0, 0, 0, dy);
}
- }
- })());
+ });
- richfaces.ui.PopupPanel.Sizer.SWL = function(){
-
- }
- richfaces.ui.PopupPanel.Sizer.SWL.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.SWL.prototype, (function (options) {
-
- return {
-
- name: "richfaces.ui.PopupPanel.Sizer.SWL",
-
- doPosition : function (popupPanel, elt) {
- this.doSetupSize(popupPanel, elt);
- this.doSetupPosition(popupPanel, elt, 0, popupPanel.height() - elt.clientHeight);
- },
-
- doDiff : function(dx, dy) {
- return new richfaces.ui.PopupPanel.Sizer.Diff(dx, 0, -dx, dy);
- }
-
- }
- })());
richfaces.ui.PopupPanel.Sizer.SW = function(){
}
- richfaces.ui.PopupPanel.Sizer.SW.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.SW.prototype, (function (options) {
+ $.extend(richfaces.ui.PopupPanel.Sizer.SW.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.SW.prototype,{
- return {
-
+
name: "richfaces.ui.PopupPanel.Sizer.SW",
doPosition : function (popupPanel, elt) {
@@ -311,17 +231,15 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(dx, 0, -dx, dy);
}
- }
- })());
+ });
richfaces.ui.PopupPanel.Sizer.W = function(){
}
- richfaces.ui.PopupPanel.Sizer.W.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.W.prototype, (function (options) {
+ $.extend(richfaces.ui.PopupPanel.Sizer.W.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.W.prototype,{
- return {
-
+
name: "richfaces.ui.PopupPanel.Sizer.W",
doPosition : function (popupPanel, elt) {
@@ -333,39 +251,17 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(dx, 0, -dx, 0);
}
- }
- })());
-
- richfaces.ui.PopupPanel.Sizer.NWL = function(){
- }
- richfaces.ui.PopupPanel.Sizer.NWL.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.NWL.prototype, (function (options) {
-
- return {
-
- name: "richfaces.ui.PopupPanel.Sizer.NWL",
-
- doPosition : function (popupPanel, elt) {
- this.doSetupSize(popupPanel, elt);
- this.doSetupPosition(popupPanel, elt, 0, 0);
- },
-
- doDiff : function(dx, dy) {
- return new richfaces.ui.PopupPanel.Sizer.Diff(dx, dy, -dx, -dy);
- }
-
- }
- })());
+ });
+
richfaces.ui.PopupPanel.Sizer.Header = function(){
}
- richfaces.ui.PopupPanel.Sizer.Header.prototype = richfaces.ui.PopupPanel.Sizer.prototype;
- $.extend(richfaces.ui.PopupPanel.Sizer.Header.prototype, (function (options) {
+ $.extend(richfaces.ui.PopupPanel.Sizer.Header.prototype, richfaces.ui.PopupPanel.Sizer.prototype);
+ $.extend(richfaces.ui.PopupPanel.Sizer.Header.prototype, {
- return {
-
+
name: "richfaces.ui.PopupPanel.Sizer.Header",
doPosition : function (popupPanel, elt) {
@@ -376,8 +272,8 @@
return new richfaces.ui.PopupPanel.Sizer.Diff(dx, dy, 0, 0);
}
- }
- })());
+
+ });
})(jQuery, window.RichFaces);
\ No newline at end of file
Modified: root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml 2010-07-11 00:06:08 UTC (rev 17914)
+++ root/ui-sandbox/panels2/trunk/ui/src/main/templates/popupPanel.template.xml 2010-07-11 12:16:01 UTC (rev 17915)
@@ -28,20 +28,21 @@
onmouseout="#{component.attributes['onmaskmouseout']}" class="mp_shade"/>
</c:if>
-<cdk:object type="java.lang.String" name="shadowStyle" value="#{getShadowStyle(facesContext,component)}" />
- <div id="#{clientId}_shadow" style="#{shadowStyle}" class="mp_shadow"/>
+ <div id="#{clientId}_shadow" class="mp_shadow"/>
<div id="#{clientId}_container" cdk:passThruWithExclusions="id,style,class,styleClass" class="mp_container #{component.attributes['styleClass']}">
<div id="#{clientId}_header" class="mp_header #{component.attributes['headerClass']}" >
<c:if test="#{component.getFacet('header')!=null and component.getFacet('header').rendered}">
<div id="#{clientId}_header_content" class="mp_header_content">
+ <c:if test="#{component.attributes['autosized']}">
+ <span id="#{clientId}_headerSpan">
<cdk:call expression="renderHeaderFacet(facesContext, component)"/>
+ </span>
+ </c:if>
+ <c:if test="#{!component.attributes['autosized']}">
+ <cdk:call expression="renderHeaderFacet(facesContext, component)"/>
+ </c:if>
</div>
</c:if>
- <c:if test="#{component.getFacet('header')==null and component.getFacet('header').rendered}">
- <div id="#{clientId}_header_content" class="mp_header_content">
- <div id="#{clientId}_header_icon" class="mp_header_icon"></div>Modal panel header name
- </div>
- </c:if>
<c:if test="#{component.getFacet('controls')!=null and component.getFacet('controls').rendered}">
<div id="#{clientId}_header_controls" class="mp_header_controls #{component.attributes['controlsClass']}">
<cdk:call expression="renderControlsFacet(facesContext, component)"/>
@@ -66,7 +67,12 @@
</c:if>
</div>
- <cdk:object type="java.lang.String" name="script" value="#{buildScript(facesContext, component)}" />
+
+
+
+<button class="mp-button" id="#{clientId}LastHref"></button>
+</div>
+<cdk:object type="java.lang.String" name="script" value="#{buildScript(facesContext, component)}" />
<cdk:object type="java.lang.String" name="showScript" value="#{buildShowScript(facesContext, component)}" />
<script type="text/javascript">
#{script}
@@ -78,9 +84,5 @@
</c:if>
-<button class="mp-button" id="#{clientId}LastHref"></button>
-</div>
-
-
</cc:implementation>
</cdk:root>
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PopupRendererTest.java
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PopupRendererTest.java (rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/test/java/org/richfaces/renderkit/html/PopupRendererTest.java 2010-07-11 12:16:01 UTC (rev 17915)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit.html;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewDeclarationLanguage;
+
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.jboss.test.faces.htmlunit.HtmlUnitEnvironment;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.component.UIPanel;
+import org.richfaces.component.UIPopupPanel;
+
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * @author Andrey Markhel
+ *
+ */
+public class PopupRendererTest {
+
+ private HtmlUnitEnvironment environment;
+
+ @Before
+ public void setUp() {
+ environment = new HtmlUnitEnvironment();
+ environment.withWebRoot(new File("src/test/resources"));
+ environment.start();
+ }
+
+ @After
+ public void tearDown() {
+ environment.release();
+ environment = null;
+ }
+
+ private FacesRequest startFacesRequest() throws IOException {
+ FacesRequest facesRequest = environment.createFacesRequest("http://localhost/popupPanelTest.jsf");
+ facesRequest.withViewId("/popupPanelTest.jsf");
+ facesRequest.start();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ViewHandler vh = facesContext.getApplication().getViewHandler();
+ ViewDeclarationLanguage vdl = vh.getViewDeclarationLanguage(facesContext, facesContext.getViewRoot()
+ .getViewId());
+ vdl.buildView(facesContext, facesContext.getViewRoot());
+ return facesRequest;
+ }
+ /**
+ * Test method for {@link org.richfaces.renderkit.ExtendedDataTableRenderer#getComponentClass()}.
+ *
+ * @throws IOException
+ */
+ @Test
+ public final void testGetComponentClass() throws IOException {
+ /*FacesRequest facesRequest = startFacesRequest();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIPopupPanel component = (UIPopupPanel) facesContext.getViewRoot().findComponent("panel");
+ PopupPanelRenderer renderer = (PopupPanelRenderer) FacesContext.getCurrentInstance()
+ .getRenderKit().getRenderer(component.getFamily(), component.getRendererType());
+ assertEquals(UIPopupPanel.class, renderer.getComponentClass());
+ facesRequest.release();*/
+ return ;
+ }
+
+ /**
+ * Test method for
+ * {@link org.richfaces.renderkit.ExtendedDataTableRenderer#doEncodeBegin(javax.faces.context.ResponseWriter,
+ * javax.faces.context.FacesContext, javax.faces.component.UIComponent)}.
+ *
+ * @throws IOException
+ */
+ /*@Test
+ public final void testDoEncode() throws IOException {
+ HtmlPage page = environment.getPage("/panelTest.jsf");
+ HtmlElement panelWithFacet = page.getElementById("panelWithFacet");
+ assertEquals("rf-panel panel", panelWithFacet.getAttribute("class"));
+ assertEquals("Write your own custom rich components with built-in AJAX support", panelWithFacet.getElementById("panelWithFacet_header").getTextContent().trim());
+ assertEquals("The CDK includes", panelWithFacet.getElementById("panelWithFacet_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement simplePanel = page.getElementById("simplePanel");
+ assertEquals("rf-panel ", simplePanel.getAttribute("class"));
+ try{
+ simplePanel.getElementById("simplePanel_header");
+ }catch(Exception e){
+ assertTrue(true);
+ }
+ assertEquals("RichFaces is a l", simplePanel
+ .getElementById("simplePanel_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement simplePanelBody = page.getElementById("simplePanel_body");
+ assertEquals("rf-panel-body rich-laguna-panel-no-header", simplePanelBody.getAttribute("class"));
+ HtmlElement simplePanel2 = page.getElementById("simplePanelWithTextHeader");
+ assertEquals("rf-panel ", simplePanel2.getAttribute("class"));
+ assertNotNull(simplePanel2.getElementById("simplePanelWithTextHeader_header"));
+ assertEquals("rich-laguna-panel-no-header", simplePanel2.getElementById("simplePanelWithTextHeader_header").getTextContent().trim());
+ assertEquals("RichFaces is a l", simplePanel2
+ .getElementById("simplePanelWithTextHeader_body")
+ .getTextContent().trim().substring(0, 16));
+
+ HtmlElement nestedPanelContainer = page.getElementById("nestedPanelContainer");
+ assertEquals("rf-panel ", nestedPanelContainer.getAttribute("class"));
+ assertNotNull(nestedPanelContainer.getElementById("nestedPanelContainer_header"));
+ assertEquals("||||", nestedPanelContainer.getElementById("nestedPanelContainer_header").getTextContent().trim());
+ HtmlElement nestedPanelContainerHeader = page.getElementById("nestedPanelContainer_header");
+ assertEquals("rf-panel-header outpanelHeader", nestedPanelContainerHeader.getAttribute("class"));
+ assertEquals("Benefits of Usin", nestedPanelContainer
+ .getElementById("nestedPanelContainer_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement nestedPanel1 = nestedPanelContainer.getElementById("nestedPanel1");
+ assertEquals("rf-panel ", nestedPanel1.getAttribute("class"));
+ HtmlElement nestedPanel1Body = page.getElementById("nestedPanel1_body");
+ assertEquals("rf-panel-body inpanelBody", nestedPanel1Body.getAttribute("class"));
+ assertNotNull(nestedPanel1.getElementById("nestedPanel1_header"));
+ assertEquals("For Application Developers", nestedPanel1.getElementById("nestedPanel1_header").getTextContent().trim());
+ assertEquals("Production quali", nestedPanel1
+ .getElementById("nestedPanel1_body")
+ .getTextContent().trim().substring(0, 16));
+ HtmlElement nestedPanel2 = nestedPanelContainer.getElementById("nestedPanel2");
+ assertEquals("rf-panel ", nestedPanel2.getAttribute("class"));
+ HtmlElement nestedPanel2Body = page.getElementById("nestedPanel2_body");
+ assertEquals("rf-panel-body inpanelBody", nestedPanel2Body.getAttribute("class"));
+ assertNotNull(nestedPanel2.getElementById("nestedPanel2_header"));
+ assertEquals("For Component Developers", nestedPanel2.getElementById("nestedPanel2_header").getTextContent().trim());
+ assertEquals("Ajax4jsf is Open", nestedPanel2
+ .getElementById("nestedPanel2_body")
+ .getTextContent().trim().substring(0, 16));
+ }*/
+
+}
\ No newline at end of file
Added: root/ui-sandbox/panels2/trunk/ui/src/test/resources/popupPanelText.xhtml
===================================================================
--- root/ui-sandbox/panels2/trunk/ui/src/test/resources/popupPanelText.xhtml (rev 0)
+++ root/ui-sandbox/panels2/trunk/ui/src/test/resources/popupPanelText.xhtml 2010-07-11 12:16:01 UTC (rev 17915)
@@ -0,0 +1,82 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:panel="http://richfaces.org/panels"
+ xmlns:rich="http://richfaces.org/rich">
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+ <h:head>
+ <title>Richfaces ExtendedDataTable Test</title>
+ </h:head>
+
+ <h:body>
+
+ <panel:popupPanel domElementAttachment="body" visualOptions="{left:400px;}" moveable="true" overlapEmbedObjects="true" keepVisualState="true" onmaskclick="alert('1')" width="600" height="400" id="panel" left="500px" top="300px">
+ <f:facet name="header">
+ Write your own custom rich components with built-in AJAX
+ </f:facet>
+ <h:form>
+ <h:panelGroup layout="block" style="width:500px,height:400px;">
+ The CDK includes a code-generation facility and a
+ templating facility using a JSP-like syntax. These capabilities help
+ to avoid a routine process of a component creation. The component factory
+ works like a well-oiled machine allowing the creation of first-class
+ rich components with built-in Ajax functionality even more easily than
+ the creation of simpler components by means of the traditional coding
+ approach.
+
+ <a4j:commandLink value="Hide">
+
+ <rich:componentControl target="panel" operation="hide" event="click">
+ </rich:componentControl>
+ </a4j:commandLink>
+
+<h:inputText value="aaa"/>
+<a href="#" onclick="RichFaces.$('panel').setSize(500, 300)" tabindex="0">setSize
+ </a>
+ <a href="#" onclick="RichFaces.$('panel').resize(20, 50)" tabindex="0">resize
+ </a>
+ <a href="#" onclick="RichFaces.$('panel').move(20, 50)" tabindex="0">move
+ </a>
+
+ <a href="#" onclick="RichFaces.$('panel').moveTo(20, 50)" tabindex="0">moveTo
+ </a>
+ </h:panelGroup>
+ </h:form>
+ </panel:popupPanel>
+
+ <a4j:commandLink value="Show">
+
+ <rich:componentControl target="panel" operation="show" event="click">
+ </rich:componentControl>
+ </a4j:commandLink>
+
+ </h:body>
+</html>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17914 - in root/tests/metamer/trunk/ftest: ftest-source and 35 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 20:06:08 -0400 (Sat, 10 Jul 2010)
New Revision: 17914
Added:
root/tests/metamer/trunk/ftest/ftest-source/
root/tests/metamer/trunk/ftest/ftest-source/.gitignore
root/tests/metamer/trunk/ftest/ftest-source/pom.xml
root/tests/metamer/trunk/ftest/ftest-source/src/
root/tests/metamer/trunk/ftest/ftest-source/src/main/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/javascript/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/PushAttributes.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java
root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java
Removed:
root/tests/metamer/trunk/ftest/test-source/.gitignore
root/tests/metamer/trunk/ftest/test-source/pom.xml
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/AbstractPushTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/IntervalTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/PushAttributes.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/SimpleTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
Modified:
root/tests/metamer/trunk/ftest/README.html
root/tests/metamer/trunk/ftest/pom.xml
root/tests/metamer/trunk/ftest/src/test/resources/testng.xml
Log:
testapp-tests refactored to place under metamer as metamer-ftest
Modified: root/tests/metamer/trunk/ftest/README.html
===================================================================
--- root/tests/metamer/trunk/ftest/README.html 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/README.html 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,13 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
+<head>
<style>
body { font-family: sans-serif; }
h1 { color: darkblue; }
.indent { text-indent: 2em; }
-</style>
+</style>
+</head>
<body>
<h1>RichFaces-Demo - functional-test</h1>
+ <p>(Stub for the Metamer Functional Test)</p>
+
<h2>About</h2>
<h3>Introduction</h3>
@@ -139,10 +143,10 @@
<p class="indent"><tt>$ mvn verify <b>-DcontainerId=tomcat6x -Dmaven.test.skip=true -P press-key-to-shutdown-server</b></tt></p>
<h4>Run Selenium server only</h4>
- <p class="indent"<tt>$ mvn verify <b>-P 'press-key-to-shutdown-server,local-selenim-session,!integration-test,!container-demoapp-deployable-dependency'</b></tt></p>
+ <p class="indent"><tt>$ mvn verify <b>-P 'press-key-to-shutdown-server,local-selenim-session,!integration-test,!container-demoapp-deployable-dependency'</b></tt></p>
<h4>Run integration test suite only</h4>
<p>If you have already running selenium server and container, you can just run a test suite:</p>
- <p class="indent"<tt>$ mvn verify -Dbrowser="*firefox" <b>-P '!local-selenium-session,!container-demoapp-deployable-dependency'</b></tt></p>
+ <p class="indent"><tt>$ mvn verify -Dbrowser="*firefox" <b>-P '!local-selenium-session,!container-demoapp-deployable-dependency'</b></tt></p>
</body>
</html>
\ No newline at end of file
Copied: root/tests/metamer/trunk/ftest/ftest-source/.gitignore (from rev 17913, root/tests/metamer/trunk/ftest/test-source/.gitignore)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/.gitignore (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/.gitignore 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,5 @@
+/.classpath
+/.project
+/.settings
+/target
+/profiles.xml
Added: root/tests/metamer/trunk/ftest/ftest-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/pom.xml (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/pom.xml 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
+<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>
+ <artifactId>root</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.0.Final</version>
+ </parent>
+
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-ftest-source</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Metamer: RichFaces Testing Application - Functional Test Source</name>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License, Version 2.1</name>
+ <distribution>repo</distribution>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/ftest/ft...</developerConnection>
+ <url>http://fisheye.jboss.org/browse/RichFaces/root/tests/metamer/trunk/ftest/...</url>
+ </scm>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>jboss-qa-snapshots</id>
+ <name>JBoss QA snapshot repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
+ </snapshotRepository>
+ <repository>
+ <id>jboss-qa-releases</id>
+ <name>JBoss QA selease repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
+ </repository>
+ </distributionManagement>
+
+ <repositories>
+ <repository>
+ <id>jboss-qa-repository</id>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/groups/public-all</url>
+ </repository>
+ </repositories>
+
+ <developers>
+ <developer>
+ <name>Pavol Pitonak</name>
+ <email>ppitonak(a)redhat.com</email>
+ </developer>
+ <developer>
+ <name>Lukas Fryc</name>
+ <email>lfryc(a)redhat.com</email>
+ </developer>
+ </developers>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>https://jira.jboss.org/jira/browse/RFPL</url>
+ </issueManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>richfaces-selenium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,101 @@
+package org.jboss.test.selenium;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.utils.PrimitiveUtils;
+import org.jboss.test.selenium.waiting.conversion.Convertor;
+
+public abstract class SeleniumGetter<P> {
+ protected AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+ protected P parameter;
+
+ public SeleniumGetter(P parameter) {
+ this.parameter = parameter;
+ }
+
+ protected abstract String obtainValue();
+
+ public Boolean asBoolean() {
+ return PrimitiveUtils.asBoolean(obtainValue());
+ }
+
+ public Integer asInteger() {
+ return PrimitiveUtils.asInteger(obtainValue());
+ }
+
+ public Long asLong() {
+ return PrimitiveUtils.asLong(obtainValue());
+ }
+
+ public Float asFloat() {
+ return PrimitiveUtils.asFloat(obtainValue());
+ }
+
+ public Double asDouble() {
+ return PrimitiveUtils.asDouble(obtainValue());
+ }
+
+ public <C> C convert(Convertor<String, C> converter) {
+ return converter.forwardConversion(obtainValue());
+ }
+
+ public static ValueGetter getValue(ElementLocator elementLocator) {
+ return new ValueGetter(elementLocator);
+ }
+
+ public static TextGetter getText(ElementLocator elementLocator) {
+ return new TextGetter(elementLocator);
+ }
+
+ public static Evaluator getEval(JavaScript script) {
+ return new Evaluator(script);
+ }
+
+ public static class ValueGetter extends SeleniumGetter<ElementLocator> {
+
+ public ValueGetter(ElementLocator parameter) {
+ super(parameter);
+ }
+
+ @Override
+ protected String obtainValue() {
+ return selenium.getValue(parameter);
+ }
+
+ }
+
+ public static class TextGetter extends SeleniumGetter<ElementLocator> {
+
+ public TextGetter(ElementLocator parameter) {
+ super(parameter);
+ }
+
+ @Override
+ protected String obtainValue() {
+ return selenium.getText(parameter);
+ }
+ }
+
+ public static class Evaluator extends SeleniumGetter<JavaScript> {
+
+ public Evaluator(JavaScript parameter) {
+ super(parameter);
+ }
+
+ @Override
+ protected String obtainValue() {
+ String evaluated = selenium.getEval(parameter);
+ evaluated = checkNull(evaluated);
+ return evaluated;
+ }
+ }
+
+ private static String checkNull(String evaluatedResult) {
+ if ("null".equals(evaluatedResult) || "undefined".equals(evaluatedResult)) {
+ return null;
+ }
+ return evaluatedResult;
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.selenium.javascript;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.waiting.conversion.Convertor;
+
+import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
+
+/**
+ * Simplifies manipulation with results of evaluated JavaScript.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public final class JavaScriptEvaluator {
+
+ private static final AjaxSelenium SELENIUM = AjaxSeleniumProxy.getInstance();
+
+ private JavaScriptEvaluator() {
+ }
+
+ /**
+ * Returns the evaluated JavaScript result.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result.
+ */
+ public static String evaluateString(JavaScript script) {
+ return checkNull(SELENIUM.getEval(script));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Boolean.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Boolean.
+ */
+ public static Boolean evaluateBoolean(JavaScript script) {
+ return asBoolean(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Float.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Float.
+ */
+ public static Float evaluateFloat(JavaScript script) {
+ return asFloat(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Double.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Double.
+ */
+ public static Double evaluateDouble(JavaScript script) {
+ return asDouble(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Long.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Long.
+ */
+ public static Long evaluateLong(JavaScript script) {
+ return asLong(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result as Integer.
+ *
+ * @param script
+ * to evaluate
+ * @return the evaluated JavaScript result as Integer.
+ */
+ public static Integer evaluateInteger(JavaScript script) {
+ return asInteger(checkNull(SELENIUM.getEval(script)));
+ }
+
+ /**
+ * Returns the evaluated JavaScript result converted to T by specified converter.
+ *
+ * @param script
+ * the script to evaluate
+ * @return the evaluated JavaScript result converted to T by specified converter.
+ */
+ public static <T> T evaluate(JavaScript script, Convertor<String, T> converter) {
+ String result = checkNull(SELENIUM.getEval(script));
+ if (result == null) {
+ return null;
+ }
+ return converter.forwardConversion(result);
+ }
+
+ private static String checkNull(String evaluatedResult) {
+ if ("null".equals(evaluatedResult) || "undefined".equals(evaluatedResult)) {
+ return null;
+ }
+ return evaluatedResult;
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+
+/**
+ * Abstract test case used as a basis for majority of test cases.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestappTestCase extends AbstractTestCase {
+
+ /**
+ * timeout in miliseconds
+ */
+ public static final long TIMEOUT = 5000;
+ private String[][] templates;
+
+ /**
+ * Returns the url to test page to be opened by Selenium
+ *
+ * @return absolute url to the test page to be opened by Selenium
+ */
+ public abstract URL getTestUrl();
+
+ /**
+ * Data provider for templates.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined
+ */
+ @DataProvider(name = "templates")
+ protected Object[][] getTemplates() {
+ if (templates != null && templates.length > 0) {
+ return templates;
+ }
+
+ return new Object[][]{{"plain"}};
+ }
+
+ /**
+ * Loads and parses attribute "templates" from testng.xml.
+ *
+ * @param urlParams
+ */
+ @BeforeClass(alwaysRun = true)
+ @Parameters({"templates"})
+ public void initTemplates(@Optional String urlParams) {
+ if (urlParams == null) {
+ return;
+ }
+
+ String[] array = urlParams.split(" ");
+ templates = new String[array.length][];
+
+ for (int i = 0; i < array.length; i++) {
+ templates[i] = new String[1];
+ templates[i][0] = array[i];
+ }
+ }
+
+ /**
+ * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
+ *
+ * @param templates
+ * templates that will be used for test, e.g. "red_div"
+ */
+ @BeforeMethod(alwaysRun = true)
+ public void loadPage(Object[] templates) {
+ if (selenium == null) {
+ new SkipException("selenium isn't initialized");
+ }
+ String urlParams = "";
+ if (templates != null && templates.length != 0) {
+ urlParams = "?templates=" + templates[0];
+ }
+ selenium.open(buildUrl(getTestUrl() + urlParams));
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ /**
+ * Invalidates session by clicking on a button on tested page.
+ */
+ public void invalidateSession() {
+ selenium.deleteAllVisibleCookies();
+ }
+
+ /**
+ * Forces the current thread sleep for given time.
+ *
+ * @param millis
+ * number of miliseconds for which the thread will sleep
+ */
+ @Deprecated
+ protected void waitFor(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Factory method for creating instances of class JQueryLocator which locates the element using <a
+ * href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax. It adds "div.content " in front of
+ * each selector.
+ *
+ * @param jquerySelector
+ * the jquery selector
+ * @return the j query locator
+ * @see JQueryLocator
+ */
+ public static JQueryLocator pjq(String jquerySelector) {
+ return new JQueryLocator("div.content " + jquerySelector);
+ }
+
+ /**
+ * A helper method for testing javascripts events. It sets alert('testedevent') to the input field for given event
+ * and fires the event. Then it checks the message in the alert dialog.
+ *
+ * @param event
+ * JavaScript event to be tested
+ * @param element
+ * locator of tested element
+ */
+ protected void testFireEvent(Event event, ElementLocator element) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(element, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
+ /**
+ * Hides header, footer and inputs for attributes.
+ */
+ protected void hideControls() {
+ selenium.getEval(new JavaScript("window.hideControls()"));
+ }
+
+ /**
+ * Shows header, footer and inputs for attributes.
+ */
+ protected void showControls() {
+ selenium.getEval(new JavaScript("window.showControls()"));
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.a4jActionListener;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jActionListener/all.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JActionListenerTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
+ private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
+ private ElementLocator invokeButtonMethod = pjq("input[id$=invokeMethodButton]");
+ private ElementLocator invokeButtonCC = pjq("input[id$=invokeFromCCButton:button]");
+ private JQueryLocator message = pjq("ul[id$=messages] li");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jActionListener/all.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByType(String templates) {
+ final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
+ final String msg = "Implementation of ActionListener created and called: "
+ + "org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
+
+ selenium.click(invokeButtonType);
+ waitGui.until(elementPresent.locator(message));
+ String output1 = selenium.getText(message);
+
+ assertEquals(output1.replaceAll(hashCodeRegExp, ""), msg, "Message after first invocation of listener by type.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ // do the same once again
+
+ selenium.click(invokeButtonType);
+ waitGui.until(elementPresent.locator(message));
+ String output2 = selenium.getText(message);
+
+ assertEquals(output2.replaceAll(hashCodeRegExp, ""), msg, "Message after second invocation of listener by type");
+
+ // check that a new object of ActionListenerImpl was created
+ String hashcode1 = output1.replace(msg, "");
+ String hashcode2 = output2.replace(msg, "");
+ assertFalse(hashcode1.equals(hashcode2), "New object of class ActionListenerImpl should be instantiated.");
+
+ count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByBinding(String templates) {
+ final String msg = "Bound listener called";
+
+ selenium.click(invokeButtonBinding);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener by binding.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethod(String templates) {
+ final String msg = "Method expression listener called";
+
+ selenium.click(invokeButtonMethod);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethodCC(String templates) {
+ final String msg = "Method expression listener called from composite component";
+
+ selenium.click(invokeButtonCC);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method from composite component.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.a4jCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JCommandButtonTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator button = pjq("input[id$=a4jCommandButton]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(button), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ ElementLocator big = pjq("input[name$=styleClassInput][value=big]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.a4jCommandLink;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandLink/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JCommandLinkTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator link = pjq("a[id$=a4jCommandLink]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandLink/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ ElementLocator newLink = pjq("span[id$=a4jCommandLink]");
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(link), link.getAsString()
+ + " should not be on page when the link is disabled");
+ assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
+ + " should be on page when the link is disabled");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator bold = pjq("input[name$=styleClassInput][value=bold]");
+ ElementLocator strike = pjq("input[name$=styleClassInput][value=strike]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = link.getAttribute(new Attribute("class"));
+
+ selenium.click(bold);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
+
+ selenium.click(strike);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = link.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getText(link), value, "Value of the button did not change");
+ }
+
+ private void testFireEvent(Event event) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.fireEvent(eventInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(link, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.a4jLog;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jLog/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JLogTestCase extends AbstractTestappTestCase {
+
+ /**
+ * Enumeration representing all possible levels for a4j:log.
+ */
+ public enum LogLevel {
+ DEBUG, INFO, WARN, ERROR;
+ }
+
+ private ElementLocator input = pjq("input[id$=nameInput]");
+ private ElementLocator submitButton = pjq("input[id$=submitButton]");
+ private ElementLocator output = pjq("span[id$=out]");
+
+ private ElementLocator log = pjq("div.rich-log");
+ private ElementLocator levelSelect = pjq("div.rich-log select");
+ private JQueryLocator logMsg = pjq("div.rich-log div.rich-log-contents div");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmit(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmitUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéôúäň");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello ľščťžýáíéôúäň!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClearButton(String templates) {
+ ElementLocator clearButton = pjq("div.rich-log button");
+
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+
+ // test clear
+ selenium.click(clearButton);
+ count = selenium.getCount(logMsg);
+ assertEquals(count, 0, "There should be no messages in log after clear button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(log), "Log should not be displayed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterDebug(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterInfo(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterWarn(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterError(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterDebug(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterInfo(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterWarn(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterError(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterDebug(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterInfo(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterWarn(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterError(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterDebug(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterInfo(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterWarn(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterError(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.ERROR);
+ }
+
+ private void testLogging(LogLevel logLevel, LogLevel filterLevel) {
+ ElementLocator logButton = pjq("input[id$=" + logLevel.toString().toLowerCase() + "Button]");
+ ElementLocator levelInput = pjq("input[type=radio][value=" + filterLevel.toString().toLowerCase() + "]");
+ ElementLocator msgType = logMsg.getChild(jq("span:eq(0)"));
+ ElementLocator msgContent = logMsg.getChild(jq("span:eq(1)"));
+
+ if (filterLevel != LogLevel.DEBUG) {
+ selenium.click(levelInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ String selectedLevel = selenium.getSelectedLabel(levelSelect);
+ assertEquals(selectedLevel, filterLevel.toString().toLowerCase(), "Log level in select wasn't changed.");
+
+ selenium.typeKeys(input, logLevel.toString());
+ selenium.click(logButton);
+
+ int count = selenium.getCount(logMsg);
+ assertEquals(count, filterLevel.ordinal() <= logLevel.ordinal() ? 1 : 0,
+ "There should be only one message in log.");
+
+ if (count == 0) {
+ return;
+ }
+
+ String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
+ assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
+ output = selenium.getText(msgContent);
+ assertEquals(output, logLevel.toString(), "Message content.");
+
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.a4jOutputPanel;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jOutputPanel/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JOutputPanelTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator increaseCounterButton = pjq("input[id$=button]");
+ private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
+ private ElementLocator outputSpan = pjq("span[id$=outputPanel]");
+ private ElementLocator optionBlue = pjq("input[name$=styleClassInput][value=blue-background]");
+ private ElementLocator optionGray = pjq("input[name$=styleClassInput][value=gray-background]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jOutputPanel/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ /**
+ * Data provider for templates, events and layout of output panel.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined, JavaScript events that are defined for output panel and layout of
+ * panel (block or inline)
+ */
+ @DataProvider(name = "templatesEventsLayouts")
+ private Object[][] getTemplatesEventsLayouts() {
+ final int layoutsCount = 2;
+ // list of templates, e.g. {{"plain"}, {"richDataTable1,redDiv"}}
+ Object[][] templates = getTemplates();
+ // list of events that will be tested
+ Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN, Event.KEYPRESS, Event.KEYUP,
+ Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER, Event.MOUSEUP};
+
+ Object[][] result = new Object[templates.length * events.length * layoutsCount][];
+ int index = 0;
+
+ for (int i = 0; i < templates.length; i++) {
+ for (int j = 0; j < events.length; j++) {
+ for (int k = 0; k < layoutsCount; k++) {
+ index = i * events.length * layoutsCount + j * layoutsCount + k;
+ result[index] = new Object[]{templates[i][0], events[j], k == 0 ? "block" : "inline"};
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Test(dataProvider = "templatesEventsLayouts")
+ public void testEvent(String templates, Event event, String type) {
+ ElementLocator element = null;
+
+ if ("inline".equals(type)) {
+ // for inline layout set background to blue
+ selenium.click(pjq("input[name$=layoutInput][value=inline]"));
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputSpan;
+ } else {
+ // for inline layout set background to gray
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputDiv;
+ }
+
+ testFireEvent(event, element);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClick(String templates) {
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("1"));
+
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAjaxRendered(String templates) {
+ ElementLocator ajaxRenderedCheckbox = pjq("input[id$=ajaxRenderedInput]");
+ ElementLocator reRenderAllImage = jq("div.header img[id$=reRenderAllImage]");
+
+ selenium.click(ajaxRenderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ String output = selenium.getText(outputDiv);
+ assertEquals(output, "0", "Output after two clicks when ajaxRendered is set to false.");
+
+ selenium.click(reRenderAllImage);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDir(String templates) {
+ ElementLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
+ ElementLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
+ ElementLocator optionNone = pjq("input[name$=dirInput][value=]");
+ AttributeLocator attributeDir = outputDiv.getAttribute(new Attribute("dir"));
+
+ // right-to-left
+ selenium.click(optionRtl);
+ selenium.waitForPageToLoad(TIMEOUT);
+ String attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "rtl", "Attribute dir after rtl was set.");
+
+ // left-to-right
+ selenium.click(optionLtr);
+ selenium.waitForPageToLoad(TIMEOUT);
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "ltr", "Attribute dir after ltr was set.");
+
+ // not specified
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeDir)) {
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "", "Attribute dir after none was set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLang(String templates) {
+ ElementLocator langInput = pjq("input[id$=langInput]");
+ AttributeLocator attributeLang = outputDiv.getAttribute(new Attribute("lang"));
+
+ selenium.typeKeys(langInput, "en");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "en", "Lang attribute");
+
+ selenium.typeKeys(langInput, "sk");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "sk", "Lang attribute");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLayout(String templates) {
+ ElementLocator optionBlock = pjq("input[name$=layoutInput][value=block]");
+ ElementLocator optionInline = pjq("input[name$=layoutInput][value=inline]");
+ ElementLocator optionNone = pjq("input[name$=layoutInput][value=none]");
+
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered on the beginning.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered on the beginning.");
+
+ selenium.click(optionInline);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when inline is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when inline is set.");
+
+ selenium.click(optionBlock);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered when block is set.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered when block is set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when none is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when none is set.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Panel should not be rendered.");
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Panel should be rendered.");
+
+ String counter = selenium.getText(outputDiv);
+ assertEquals(counter, "2", "Counter after two clicks on button.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ String style = "background-color: magenta; color: white; font-weight: bold;";
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ AttributeLocator attributeStyle = outputDiv.getAttribute(Attribute.STYLE);
+
+ selenium.typeKeys(styleInput, style);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, style, "Value of attribute style.");
+
+ selenium.typeKeys(styleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeStyle)) {
+ attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator optionNone = pjq("input[name$=styleClassInput][value=]");
+ AttributeLocator attributeClass = outputDiv.getAttribute(Attribute.CLASS);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "blue-background"), "Panel should have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "gray-background"), "Panel should have class gray-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeClass)) {
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testTitle(String templates) {
+ String title = "a4j:outputPanel title";
+ ElementLocator titleInput = pjq("input[id$=titleInput]");
+ AttributeLocator attributeTitle = outputDiv.getAttribute(new Attribute("title"));
+
+ selenium.typeKeys(titleInput, title);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, title, "Value of attribute title.");
+
+ selenium.typeKeys(titleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeTitle)) {
+ attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPoll;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.testng.Assert.*;
+import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
+
+/**
+ * Tests the a4j:poll component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class PollTestCase extends AbstractTestappTestCase {
+
+ private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
+ private static final int[] TEST_INTERVAL_VALUES = new int[]{1000, 5000, 500};
+ private static final int TEST_INTERVAL_ITERATIONS = 5;
+ private static final int MAX_DEVIATION = 100;
+ private static final int MAX_AVERAGE_DEVIATION = 50;
+
+ ElementLocator attributeEnabled = id("form:attributes:enabledInput");
+ ElementLocator attributeInterval = id("form:attributes:intervalInput");
+ JQueryLocator time = pjq("span[id$=time]");
+ AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void clearSession() {
+ invalidateSession();
+ }
+
+ /**
+ * <p>
+ * Test the progress of polling for 3 different values from client side.
+ * </p>
+ *
+ * <p>
+ * It defines the new interval value first for each iteration and then enable polling.
+ * </p>
+ *
+ * <p>
+ * Then, it waits for first poll event (zero iteration).
+ * </p>
+ *
+ * <p>
+ * For 5 following poll events it checks that runtime visible from client (output from JavaScript's new
+ * Date().getTime()) between the events haven't greater deviation from defined interval than defined
+ * {@link #MAX_DEVIATION}.
+ * </p>
+ *
+ * <p>
+ * Test also computes average value of deviation and checks that the average value of all obtained particular
+ * deviations isn't greater than {@link #MAX_AVERAGE_DEVIATION}.
+ * </p>
+ */
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testIntervalFromClientPerspective(String templates) {
+
+ long total = 0;
+ long count = 0;
+ for (int interval : TEST_INTERVAL_VALUES) {
+ selenium.type(attributeInterval, String.valueOf(interval));
+ selenium.waitForPageToLoad();
+
+ selenium.check(attributeEnabled);
+ selenium.fireEvent(attributeEnabled, Event.CHANGE);
+ selenium.waitForPageToLoad();
+
+ selenium.getPageExtensions().install();
+
+ long currentTime = getClientTime();
+
+ for (int i = 0; i <= TEST_INTERVAL_ITERATIONS; i++) {
+ long runtime = System.currentTimeMillis();
+ selenium.getRequestInterceptor().clearRequestTypeDone();
+ selenium.getRequestInterceptor().waitForRequestTypeChange();
+ runtime -= getClientTime();
+ if (i > 0) {
+
+ long deviation = Math.abs(interval - Math.abs(runtime));
+ if (isSeleniumDebug()) {
+ System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
+ }
+ assertTrue(deviation <= MAX_DEVIATION, format(
+ "Particular deviation ({2}) for interval {0} was greater than {1}", interval, MAX_DEVIATION,
+ deviation));
+ total += deviation;
+ count += 1;
+ }
+ currentTime += runtime;
+ }
+
+ selenium.uncheck(attributeEnabled);
+ selenium.fireEvent(attributeEnabled, Event.CHANGE);
+ selenium.waitForPageToLoad();
+ }
+
+ long averageDeviation = total / count;
+
+ if (isSeleniumDebug()) {
+ System.out.println(format("total average deviation: {0}", averageDeviation));
+ }
+
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation ({1}) was greater than given maximum {0}", MAX_AVERAGE_DEVIATION, averageDeviation));
+ }
+
+ /**
+ * Returns the time of poll event (the time when arrived the response from server)
+ * @return the time of poll event (the time when arrived the response from server)
+ */
+ private long getClientTime() {
+ return asLong(selenium.getAttribute(clientTime));
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/AbstractPushTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPush;
+
+import static org.testng.Assert.*;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.SeleniumGetter.*;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.test.selenium.SystemProperties;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.request.RequestType;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * Abstract test case for testing a4j:push component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPushTestCase extends AbstractTestappTestCase {
+
+ private static final int STATUS_CODE_OK = 200;
+
+ protected PushAttributes pushAttributes = new PushAttributes();
+
+ private ElementLocator outputCounter = pjq("span[id$=outputCounter]");
+
+ private HttpClient httpClient;
+ private HttpMethod pushMethod;
+
+ @Override
+ public URL getTestUrl() {
+ URL contextPath = SystemProperties.getContextPath();
+ return buildUrl(contextPath, "faces/components/a4jPush/simple.xhtml");
+ }
+
+ /**
+ * Initializes the HttpClient which triggers events in {@link #generatePushEvent()}.
+ */
+ @BeforeClass
+ public void initializeHttpClient() {
+ httpClient = new HttpClient();
+ URL eventProducerUrl = buildUrl(getTestUrl(), "event-producer.xhtml");
+ pushMethod = new GetMethod(eventProducerUrl.toString());
+ }
+
+ /**
+ * Returns the value of counter as pushed value
+ *
+ * @return the value of counter as pushed value
+ */
+ protected int getCounter() {
+ return getText(outputCounter).asInteger();
+ }
+
+ /**
+ * Push the event specified number times and then waits for observation of event by client.
+ *
+ * @param numberOfPushes
+ * the number of events should be generated
+ */
+ protected void pushAndWait(int numberOfPushes) throws HttpException, IOException {
+ selenium.getPageExtensions().install();
+ selenium.getRequestInterceptor().clearRequestTypeDone();
+
+ for (int i = 0; i < numberOfPushes; i++) {
+ generatePushEvent();
+ }
+
+ selenium.getRequestInterceptor().waitForRequestTypeChange();
+ RequestType requestDone = selenium.getRequestInterceptor().getRequestTypeDone();
+
+ assertEquals(requestDone, RequestType.XHR);
+ }
+
+ /**
+ * <p>
+ * Generates the push event for all registered listeners from a4j:push test Simple page.
+ * </p>
+ *
+ * <p>
+ * Internally use HttpClient to ping URL triggering push event in preRenderView phase.
+ * </p>
+ */
+ private void generatePushEvent() throws HttpException, IOException {
+ httpClient.executeMethod(pushMethod);
+ assertEquals(pushMethod.getStatusCode(), STATUS_CODE_OK);
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/IntervalTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPush;
+
+import static org.jboss.test.selenium.utils.PrimitiveUtils.asLong;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpException;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Tests the interval attribute for a4j:push
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class IntervalTestCase extends AbstractPushTestCase {
+
+ private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
+ private static final int[] INTERVAL_VALUES = new int[]{1000, 5000, 500};
+ private static final long MAX_DEVIATION = 100;
+ private static final long MAX_AVERAGE_DEVIATION = 75;
+ private static final int DEFAULT_COUNTER_STEP = 2;
+ private static final int ITERATION_COUNT = 3;
+ private static final int MULTIPLE_PUSH_COUNT = 5;
+
+ AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
+
+ private long startTime;
+ private int counter;
+ private int counterStep;
+
+ private long deviationTotal = 0;
+ private long deviationCount = 0;
+
+ /**
+ * <p>
+ * For 3 different intervals, test that the interval between push event triggered and event observered by client
+ * haven't greater deviation than the specified interval.
+ * </p>
+ *
+ * <p>
+ * First set the given interval into the interval attribute.
+ * </p>
+ *
+ * <p>
+ * Then push and wait for result of update triggered by observation of push event.
+ * </p>
+ *
+ * <p>
+ * Then repeat push and wait 6 times with 1 event triggered and 5 events triggered in sequence.
+ * </p>
+ */
+ @Test
+ public void testIntervalFromClientPerspective() throws HttpException, IOException {
+ for (int interval : INTERVAL_VALUES) {
+ counterStep = DEFAULT_COUNTER_STEP;
+ pushAttributes.setInterval(interval);
+
+ pushAndWait(1);
+ for (int i = 0; i < ITERATION_COUNT; i++) {
+ startIntervalAndCounter();
+ pushAndWait(1);
+ validateIntervalAndCounter(interval);
+
+ startIntervalAndCounter();
+ pushAndWait(MULTIPLE_PUSH_COUNT);
+ validateIntervalAndCounter(interval);
+ }
+ }
+
+ validateAverageDeviation();
+ }
+
+ /**
+ * Remembers start of the time frame and current value of counter.
+ */
+ private void startIntervalAndCounter() {
+ startTime = getClientTime();
+ counter = getCounter();
+ }
+
+ /**
+ * <p>
+ * Obtains current value of counter and end of the time frame to compute the run time.
+ * </p>
+ *
+ * <p>
+ * Validates that run time haven't greater deviation from given maximum {@link #MAX_DEVIATION}.
+ * </p>
+ *
+ * <p>
+ * Remembers the deviation as part of total deviation for computing average value.
+ * </p>
+ *
+ * <p>
+ * Validates that counter have been increased by right value.
+ * </p>
+ */
+ private void validateIntervalAndCounter(int interval) {
+ long runTime = getClientTime() - startTime;
+ long deviation = Math.abs(interval - runTime);
+ assertTrue(deviation <= MAX_DEVIATION, format("Deviation ({0}) is greater than defined maximum {1}", deviation,
+ MAX_DEVIATION));
+
+ if (seleniumDebug) {
+ System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
+ }
+
+ deviationTotal += deviation;
+ deviationCount += 1;
+
+ int newCounter = getCounter();
+ assertEquals(newCounter, counter + counterStep);
+ counter = newCounter;
+
+ }
+
+ /**
+ * Validates the average deviations from intervals.
+ */
+ private void validateAverageDeviation() {
+ long averageDeviation = deviationTotal / deviationCount;
+ if (seleniumDebug) {
+ System.out.println("averageDeviation: " + averageDeviation);
+ }
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation for all the intervals ({0}) should not be greater than defined maximum {1}",
+ averageDeviation, MAX_AVERAGE_DEVIATION));
+ }
+
+ /**
+ * Returns the time of push event (the time when arrived the response from server)
+ *
+ * @return the time of push event (the time when arrived the response from server)
+ */
+ private long getClientTime() {
+ return asLong(selenium.getAttribute(clientTime));
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/PushAttributes.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/PushAttributes.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/PushAttributes.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/PushAttributes.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPush;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.id;
+import static org.jboss.test.selenium.SeleniumGetter.*;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.ElementLocator;
+
+/**
+ * The control point for setting different attributes for a4j:push test page.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class PushAttributes {
+
+ private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ private ElementLocator attributeInterval = id("form:attributes:intervalInput");
+
+ public void setInterval(long miliseconds) {
+ selenium.type(attributeInterval, String.valueOf(miliseconds));
+ selenium.waitForPageToLoad();
+ }
+
+ public long getInterval() {
+ return getValue(attributeInterval).asLong();
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/SimpleTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jPush;
+
+import static org.testng.Assert.assertNotSame;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpException;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for simple usage of a4j:push component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class SimpleTestCase extends AbstractPushTestCase {
+ private static final long SIMPLE_INTERVAL = 2500;
+
+ /**
+ * <p>
+ * Sets the interval to value {@link #SIMPLE_INTERVAL}.
+ * </p>
+ *
+ * <p>
+ * Then try to generate push event, wait for client observation.
+ * </p>
+ *
+ * <p>
+ * Validates that counter is changed between iterations.
+ * </p>
+ */
+ @Test
+ public void testSimple() throws HttpException, IOException {
+ pushAttributes.setInterval(SIMPLE_INTERVAL);
+
+ int beginCounter = getCounter();
+ pushAndWait(1);
+ int endCounter = getCounter();
+
+ assertNotSame(beginCounter < endCounter, format(
+ "The counter before push is greater {0} or equal the end counter {1}", beginCounter, endCounter));
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.hCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/commandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class HCommandButtonTestCase extends AbstractTestappTestCase {
+
+ private JQueryLocator input = pjq("input[id$=input]");
+ private JQueryLocator button = pjq("input[id$=commandButton]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+ private JQueryLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnblur(String templates) {
+ testFireEvent(Event.BLUR, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnchange(String templates) {
+ testFireEvent(Event.CHANGE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnfocus(String templates) {
+ testFireEvent(Event.FOCUS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+
+ JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
+ JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ JQueryLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ JQueryLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.richExtendedDataTable;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DataScroller {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ JQueryLocator scrollerRoot;
+ JQueryLocator pageNumbers = jq(".rf-ds-dtl");
+ JQueryLocator firstPageButton = jq(".rf-ds-l[id$=ds_f]");
+ JQueryLocator lastPageButton = jq(".rf-ds-r:eq(1)");
+ JQueryLocator lastVisiblePage = jq(".rf-ds-dtl:last");
+ JQueryLocator currentPage = jq(".rf-ds-cur");
+
+ public DataScroller(JQueryLocator scrollerRoot) {
+ this.scrollerRoot = scrollerRoot;
+ }
+
+ public JQueryLocator getRoot() {
+ return scrollerRoot;
+ }
+
+ public void gotoFirstPage() {
+ if (!isFirstPage()) {
+ clickFirstPageButton();
+ }
+ }
+
+ public void gotoLastPage() {
+ if (!isLastPage()) {
+ clickLastPageButton();
+ }
+ }
+
+ public void clickLastPageButton() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastPageButton);
+ guardXhr(selenium).click(locator);
+ }
+
+ public void clickFirstPageButton() {
+ JQueryLocator locator = scrollerRoot.getDescendant(firstPageButton);
+ guardXhr(selenium).click(locator);
+ }
+
+ public int getCountOfVisiblePages() {
+ JQueryLocator locator = scrollerRoot.getDescendant(pageNumbers);
+ return selenium.getCount(locator);
+ }
+
+ public boolean hasPages() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
+ return selenium.isElementPresent(locator);
+ }
+
+ public Integer getLastVisiblePage() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
+ if (!hasPages()) {
+ return null;
+ }
+ return integer(selenium.getText(locator));
+ }
+
+ public int getCurrentPage() {
+ JQueryLocator locator = scrollerRoot.getDescendant(currentPage);
+ if (!hasPages()) {
+ return 1;
+ }
+ return integer(selenium.getText(locator));
+ }
+
+ public boolean isFirstPage() {
+ return getCurrentPage() == 1;
+ }
+
+ public boolean isLastPage() {
+ return getCurrentPage() == getLastVisiblePage();
+ }
+
+ public static int integer(String string) {
+ return Integer.valueOf(string);
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.richExtendedDataTable;
+
+import org.jboss.test.selenium.framework.AjaxSelenium;
+import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DataTable {
+
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+
+ JQueryLocator tableRoot;
+ JQueryLocator tableRows = jq(".rf-dt-c:nth-child(1)");
+
+ public DataTable(JQueryLocator tableRoot) {
+ super();
+ this.tableRoot = tableRoot;
+ }
+
+ public int getCountOfTableRows() {
+ JQueryLocator locator = tableRoot.getDescendant(tableRows);
+ return selenium.getCount(locator);
+ }
+
+ public String getTableText() {
+ return selenium.getText(tableRoot);
+ }
+}
Copied: root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java (from rev 17913, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *******************************************************************************/
+
+package org.richfaces.tests.metamer.ftest.richExtendedDataTable;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.testng.annotations.Test;
+
+/**
+ * Test of DataScroller tied to Extended Data Table
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class ScrollerTestCase extends AbstractTestappTestCase {
+
+ private static final int TOTAL_ROW_COUNT = 50;
+ private static final Integer[] ROW_COUNT_VALUES =
+ new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT};
+
+ DataScroller dataScroller1 = new DataScroller(pjq("span.rf-ds[id$=scroller1]"));
+ DataScroller dataScroller2 = new DataScroller(pjq("span.rf-ds[id$=scroller2]"));
+ DataTable table = new DataTable(pjq("table.rf-dt[id$=richEDT]"));
+ ElementLocator attributeRowsInput = id("form:attributes:rowsInput");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richExtendedDataTable/scroller.xhtml");
+ }
+
+ /**
+ * Tests row count for scroller in footer of the EDT.
+ *
+ * @see {@link #testRowCount(DataScroller)}
+ */
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testRowCountFooterScroller(String templates) {
+ testRowCount(dataScroller2);
+ }
+
+ /**
+ * Tests row count for scroller outside of the EDT.
+ *
+ * @see {@link #testRowCount(DataScroller)}
+ */
+ @Test(dataProvider = "templates")
+ public void testRowCountOutsideTable(String templates) {
+ testRowCount(dataScroller1);
+ }
+
+ /**
+ * <p>
+ * Test the data scroller functionality for different values of row count
+ * </p>
+ *
+ * <p>
+ * If desired, sets the value of 'rows' first for each iteration.
+ * </p>
+ *
+ * <p>
+ * Then goes to first page and verifies that there is valid number of rows.
+ * </p>
+ *
+ * <p>
+ * Verifies that on the first page is less than total number of rows if the scroller has several pages.
+ * </p>
+ *
+ * <p>
+ * If the scroller has pages enabled, goes to last page and verifies that this is valid number of pages visible in
+ * scroller and the number of rows is valid.
+ * </p>
+ *
+ * <p>
+ */
+ private void testRowCount(DataScroller dataScroller) {
+ for (Integer rowsPerPage : ROW_COUNT_VALUES) {
+ if (rowsPerPage != null) {
+ selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
+ selenium.fireEvent(attributeRowsInput, Event.BLUR);
+ selenium.waitForPageToLoad();
+ }
+
+ dataScroller.gotoFirstPage();
+ int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
+ int rowCountActual = table.getCountOfTableRows();
+ assertEquals(rowCountActual, Math.min(TOTAL_ROW_COUNT, rowCountPreset));
+
+ assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
+ if (dataScroller.hasPages()) {
+ dataScroller.gotoLastPage();
+
+ int pagesExpected = pageCountActualExpected(rowCountActual);
+ int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
+
+ if (countOfVisiblePages < pagesExpected) {
+ int lastVisiblePage = dataScroller.getLastVisiblePage();
+ assertEquals(lastVisiblePage, pageCountActualExpected(rowCountActual));
+ } else {
+ assertEquals(countOfVisiblePages, pagesExpected);
+ }
+
+ int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
+ rowCountActual = table.getCountOfTableRows();
+ assertEquals(rowCountActual, rowCountExpected);
+ }
+ }
+ }
+
+ private int pageCountActualExpected(int rowCountActual) {
+ return Double.valueOf(Math.ceil((double) TOTAL_ROW_COUNT / rowCountActual)).intValue();
+ }
+
+ private int rowCountLastPageExpected(int rowCountPreset) {
+ int result = TOTAL_ROW_COUNT % rowCountPreset;
+ return (result == 0) ? rowCountPreset : result;
+ }
+
+}
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,11 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+
<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>
- <groupId>org.richfaces.tests</groupId>
- <artifactId>testapp-tests</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <name>RichFaces 4.0 TestApp: Functional Test</name>
- <packaging>pom</packaging>
<parent>
<artifactId>functional-test-jboss-ci-template</artifactId>
@@ -13,47 +32,84 @@
<version>1.5.0.Final</version>
</parent>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-ftest</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Metamer: RichFaces Testing Application - Functional Test</name>
+ <packaging>pom</packaging>
+
<modules>
- <module>test-source</module>
+ <module>ftest-source</module>
</modules>
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/root/tests/metamer/trunk...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/root/tests/metamer/ftest</developerConnection>
+ <url>http://fisheye.jboss.org/browse/RichFaces/root/tests/metamer/trunk/ftest</url>
+ </scm>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License, Version 2.1</name>
+ <distribution>repo</distribution>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>jboss-qa-snapshots</id>
+ <name>JBoss QA snapshot repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
+ </snapshotRepository>
+ <repository>
+ <id>jboss-qa-releases</id>
+ <name>JBoss QA selease repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
+ </repository>
+ </distributionManagement>
+
+ <developers>
+ <developer>
+ <name>Pavol Pitonak</name>
+ <email>ppitonak(a)redhat.com</email>
+ </developer>
+ <developer>
+ <name>Lukas Fryc</name>
+ <email>lfryc(a)redhat.com</email>
+ </developer>
+ </developers>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>https://jira.jboss.org/jira/browse/RFPL</url>
+ </issueManagement>
+
<properties>
- <context.path>/testapp/</context.path>
+ <context.path>/metamer/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
+ <ftest.source.version>${project.version}</ftest.source.version>
<testng.suite.xml>src/test/resources/testng.xml</testng.suite.xml>
</properties>
- <pluginRepositories>
- <pluginRepository>
- <id>ossrh</id>
- <name>Sonatype OSS Repository</name>
- <url>http://oss.sonatype.org/content/groups/public</url>
- <layout>default</layout>
- </pluginRepository>
- </pluginRepositories>
-
<repositories>
<repository>
- <id>download-java-net-glassfish</id>
- <url>http://download.java.net/maven/glassfish</url>
+ <id>jboss-qa-repository</id>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/groups/public-all</url>
</repository>
- <repository>
- <id>jboss-public-repository-group</id>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
- </repository>
</repositories>
<dependencies>
<dependency>
- <groupId>org.richfaces.examples</groupId>
- <artifactId>testapp</artifactId>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer</artifactId>
<type>${deployable.type}</type>
<version>${deployable.version}</version>
</dependency>
<dependency>
- <groupId>org.richfaces.tests.testapp</groupId>
- <artifactId>test-source</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer-ftest-source</artifactId>
+ <version>${ftest.source.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -85,8 +141,8 @@
<type>installed</type>
<deployables>
<deployable>
- <groupId>org.richfaces.examples</groupId>
- <artifactId>testapp</artifactId>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer</artifactId>
<type>${deployable.type}</type>
<properties>
<context>${context.deploy.path}</context>
@@ -155,8 +211,8 @@
<goal>unpack-dependencies</goal>
</goals>
<configuration>
- <includeGroupIds>org.richfaces.tests.testapp</includeGroupIds>
- <includeArtifactIds>test-source</includeArtifactIds>
+ <includeGroupIds>org.richfaces.tests</includeGroupIds>
+ <includeArtifactIds>metamer-ftest-source</includeArtifactIds>
<includes>**</includes>
<outputDirectory>target/test-classes</outputDirectory>
<overWriteReleases>true</overWriteReleases>
@@ -193,7 +249,7 @@
<configuration>
<tasks>
<copy todir="target/test-classes/">
- <fileset dir="../testapp-tests/test-source/target/classes/">
+ <fileset dir="../metamer-ftest/ftest-source/target/classes/">
<include name="**/*.*" />
</fileset>
</copy>
Modified: root/tests/metamer/trunk/ftest/src/test/resources/testng.xml
===================================================================
--- root/tests/metamer/trunk/ftest/src/test/resources/testng.xml 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/src/test/resources/testng.xml 2010-07-11 00:06:08 UTC (rev 17914)
@@ -4,7 +4,7 @@
<test name="Component Tests">
<parameter name="templates" value="plain richDataTable1,redDiv richDataTable2,redDiv a4jRepeat1 a4jRepeat2 hDataTable1 hDataTable2 uiRepeat1 uiRepeat2"/>
<packages>
- <package name="org.richfaces.tests.testapp" />
+ <package name="org.richfaces.tests.metamer.ftest" />
</packages>
</test>
Deleted: root/tests/metamer/trunk/ftest/test-source/.gitignore
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/.gitignore 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/.gitignore 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,5 +0,0 @@
-/.classpath
-/.project
-/.settings
-/target
-/profiles.xml
Deleted: root/tests/metamer/trunk/ftest/test-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/pom.xml 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/pom.xml 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,39 +0,0 @@
-<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>
- <artifactId>root</artifactId>
- <groupId>org.jboss.test.richfaces-selenium</groupId>
- <version>1.5.0.Final</version>
- </parent>
-
- <groupId>org.richfaces.tests.testapp</groupId>
- <artifactId>test-source</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <name>RichFaces 4.0 TestApp: Functional Test Source</name>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>richfaces-selenium</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,101 +0,0 @@
-package org.jboss.test.selenium;
-
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.jboss.test.selenium.framework.AjaxSelenium;
-import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.utils.PrimitiveUtils;
-import org.jboss.test.selenium.waiting.conversion.Convertor;
-
-public abstract class SeleniumGetter<P> {
- protected AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
- protected P parameter;
-
- public SeleniumGetter(P parameter) {
- this.parameter = parameter;
- }
-
- protected abstract String obtainValue();
-
- public Boolean asBoolean() {
- return PrimitiveUtils.asBoolean(obtainValue());
- }
-
- public Integer asInteger() {
- return PrimitiveUtils.asInteger(obtainValue());
- }
-
- public Long asLong() {
- return PrimitiveUtils.asLong(obtainValue());
- }
-
- public Float asFloat() {
- return PrimitiveUtils.asFloat(obtainValue());
- }
-
- public Double asDouble() {
- return PrimitiveUtils.asDouble(obtainValue());
- }
-
- public <C> C convert(Convertor<String, C> converter) {
- return converter.forwardConversion(obtainValue());
- }
-
- public static ValueGetter getValue(ElementLocator elementLocator) {
- return new ValueGetter(elementLocator);
- }
-
- public static TextGetter getText(ElementLocator elementLocator) {
- return new TextGetter(elementLocator);
- }
-
- public static Evaluator getEval(JavaScript script) {
- return new Evaluator(script);
- }
-
- public static class ValueGetter extends SeleniumGetter<ElementLocator> {
-
- public ValueGetter(ElementLocator parameter) {
- super(parameter);
- }
-
- @Override
- protected String obtainValue() {
- return selenium.getValue(parameter);
- }
-
- }
-
- public static class TextGetter extends SeleniumGetter<ElementLocator> {
-
- public TextGetter(ElementLocator parameter) {
- super(parameter);
- }
-
- @Override
- protected String obtainValue() {
- return selenium.getText(parameter);
- }
- }
-
- public static class Evaluator extends SeleniumGetter<JavaScript> {
-
- public Evaluator(JavaScript parameter) {
- super(parameter);
- }
-
- @Override
- protected String obtainValue() {
- String evaluated = selenium.getEval(parameter);
- evaluated = checkNull(evaluated);
- return evaluated;
- }
- }
-
- private static String checkNull(String evaluatedResult) {
- if ("null".equals(evaluatedResult) || "undefined".equals(evaluatedResult)) {
- return null;
- }
- return evaluatedResult;
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/jboss/test/selenium/javascript/JavaScriptEvaluator.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.selenium.javascript;
-
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.jboss.test.selenium.framework.AjaxSelenium;
-import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.waiting.conversion.Convertor;
-
-import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
-
-/**
- * Simplifies manipulation with results of evaluated JavaScript.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public final class JavaScriptEvaluator {
-
- private static final AjaxSelenium SELENIUM = AjaxSeleniumProxy.getInstance();
-
- private JavaScriptEvaluator() {
- }
-
- /**
- * Returns the evaluated JavaScript result.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result.
- */
- public static String evaluateString(JavaScript script) {
- return checkNull(SELENIUM.getEval(script));
- }
-
- /**
- * Returns the evaluated JavaScript result as Boolean.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result as Boolean.
- */
- public static Boolean evaluateBoolean(JavaScript script) {
- return asBoolean(checkNull(SELENIUM.getEval(script)));
- }
-
- /**
- * Returns the evaluated JavaScript result as Float.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result as Float.
- */
- public static Float evaluateFloat(JavaScript script) {
- return asFloat(checkNull(SELENIUM.getEval(script)));
- }
-
- /**
- * Returns the evaluated JavaScript result as Double.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result as Double.
- */
- public static Double evaluateDouble(JavaScript script) {
- return asDouble(checkNull(SELENIUM.getEval(script)));
- }
-
- /**
- * Returns the evaluated JavaScript result as Long.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result as Long.
- */
- public static Long evaluateLong(JavaScript script) {
- return asLong(checkNull(SELENIUM.getEval(script)));
- }
-
- /**
- * Returns the evaluated JavaScript result as Integer.
- *
- * @param script
- * to evaluate
- * @return the evaluated JavaScript result as Integer.
- */
- public static Integer evaluateInteger(JavaScript script) {
- return asInteger(checkNull(SELENIUM.getEval(script)));
- }
-
- /**
- * Returns the evaluated JavaScript result converted to T by specified converter.
- *
- * @param script
- * the script to evaluate
- * @return the evaluated JavaScript result converted to T by specified converter.
- */
- public static <T> T evaluate(JavaScript script, Convertor<String, T> converter) {
- String result = checkNull(SELENIUM.getEval(script));
- if (result == null) {
- return null;
- }
- return converter.forwardConversion(result);
- }
-
- private static String checkNull(String evaluatedResult) {
- if ("null".equals(evaluatedResult) || "undefined".equals(evaluatedResult)) {
- return null;
- }
- return evaluatedResult;
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.AbstractTestCase;
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.testng.SkipException;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-
-/**
- * Abstract test case used as a basis for majority of test cases.
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public abstract class AbstractTestappTestCase extends AbstractTestCase {
-
- /**
- * timeout in miliseconds
- */
- public static final long TIMEOUT = 5000;
- private String[][] templates;
-
- /**
- * Returns the url to test page to be opened by Selenium
- *
- * @return absolute url to the test page to be opened by Selenium
- */
- public abstract URL getTestUrl();
-
- /**
- * Data provider for templates.
- *
- * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
- * plain template) if nothing is defined
- */
- @DataProvider(name = "templates")
- protected Object[][] getTemplates() {
- if (templates != null && templates.length > 0) {
- return templates;
- }
-
- return new Object[][]{{"plain"}};
- }
-
- /**
- * Loads and parses attribute "templates" from testng.xml.
- *
- * @param urlParams
- */
- @BeforeClass(alwaysRun = true)
- @Parameters({"templates"})
- public void initTemplates(@Optional String urlParams) {
- if (urlParams == null) {
- return;
- }
-
- String[] array = urlParams.split(" ");
- templates = new String[array.length][];
-
- for (int i = 0; i < array.length; i++) {
- templates[i] = new String[1];
- templates[i][0] = array[i];
- }
- }
-
- /**
- * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
- *
- * @param templates
- * templates that will be used for test, e.g. "red_div"
- */
- @BeforeMethod(alwaysRun = true)
- public void loadPage(Object[] templates) {
- if (selenium == null) {
- new SkipException("selenium isn't initialized");
- }
- String urlParams = "";
- if (templates != null && templates.length != 0) {
- urlParams = "?templates=" + templates[0];
- }
- selenium.open(buildUrl(getTestUrl() + urlParams));
- selenium.waitForPageToLoad(TIMEOUT);
- }
-
- /**
- * Invalidates session by clicking on a button on tested page.
- */
- public void invalidateSession() {
- selenium.deleteAllVisibleCookies();
- }
-
- /**
- * Forces the current thread sleep for given time.
- *
- * @param millis
- * number of miliseconds for which the thread will sleep
- */
- @Deprecated
- protected void waitFor(long millis) {
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Factory method for creating instances of class JQueryLocator which locates the element using <a
- * href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax. It adds "div.content " in front of
- * each selector.
- *
- * @param jquerySelector
- * the jquery selector
- * @return the j query locator
- * @see JQueryLocator
- */
- public static JQueryLocator pjq(String jquerySelector) {
- return new JQueryLocator("div.content " + jquerySelector);
- }
-
- /**
- * A helper method for testing javascripts events. It sets alert('testedevent') to the input field for given event
- * and fires the event. Then it checks the message in the alert dialog.
- *
- * @param event
- * JavaScript event to be tested
- * @param element
- * locator of tested element
- */
- protected void testFireEvent(Event event, ElementLocator element) {
- ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
- final String value = "alert('" + event.getEventName() + "')";
-
- selenium.type(eventInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.fireEvent(element, event);
-
- assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
- + " attribute did not change correctly");
- }
-
- /**
- * Hides header, footer and inputs for attributes.
- */
- protected void hideControls() {
- selenium.getEval(new JavaScript("window.hideControls()"));
- }
-
- /**
- * Shows header, footer and inputs for attributes.
- */
- protected void showControls() {
- selenium.getEval(new JavaScript("window.showControls()"));
- }
-
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.a4jActionListener;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jActionListener/all.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JActionListenerTestCase extends AbstractTestappTestCase {
-
- private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
- private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
- private ElementLocator invokeButtonMethod = pjq("input[id$=invokeMethodButton]");
- private ElementLocator invokeButtonCC = pjq("input[id$=invokeFromCCButton:button]");
- private JQueryLocator message = pjq("ul[id$=messages] li");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jActionListener/all.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerByType(String templates) {
- final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
- final String msg = "Implementation of ActionListener created and called: "
- + "org.richfaces.testapp.bean.A4JActionListenerBean$ActionListenerImpl";
-
- selenium.click(invokeButtonType);
- waitGui.until(elementPresent.locator(message));
- String output1 = selenium.getText(message);
-
- assertEquals(output1.replaceAll(hashCodeRegExp, ""), msg, "Message after first invocation of listener by type.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
-
- // do the same once again
-
- selenium.click(invokeButtonType);
- waitGui.until(elementPresent.locator(message));
- String output2 = selenium.getText(message);
-
- assertEquals(output2.replaceAll(hashCodeRegExp, ""), msg, "Message after second invocation of listener by type");
-
- // check that a new object of ActionListenerImpl was created
- String hashcode1 = output1.replace(msg, "");
- String hashcode2 = output2.replace(msg, "");
- assertFalse(hashcode1.equals(hashcode2), "New object of class ActionListenerImpl should be instantiated.");
-
- count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
-
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerByBinding(String templates) {
- final String msg = "Bound listener called";
-
- selenium.click(invokeButtonBinding);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener by binding.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethod(String templates) {
- final String msg = "Method expression listener called";
-
- selenium.click(invokeButtonMethod);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener method.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethodCC(String templates) {
- final String msg = "Method expression listener called from composite component";
-
- selenium.click(invokeButtonCC);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener method from composite component.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.a4jCommandButton;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jCommandButton/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JCommandButtonTestCase extends AbstractTestappTestCase {
-
- private ElementLocator input = pjq("input[id$=input]");
- private ElementLocator button = pjq("input[id$=a4jCommandButton]");
- private ElementLocator output1 = pjq("span[id$=output1]");
- private ElementLocator output2 = pjq("span[id$=output2]");
- private ElementLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jCommandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
- AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String isDisabled = selenium.getAttribute(disabledAttribute);
- assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
- testFireEvent(Event.KEYUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
- ElementLocator renderInput = pjq("input[name$=renderInput]");
-
- selenium.type(renderInput, "output1");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "aaa");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
-
- selenium.type(renderInput, "output2 output3");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "bbb");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output2).text("bbb"));
-
- output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
-
- selenium.click(renderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(button), "Button should not be displayed");
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator wide = pjq("input[name$=styleClassInput][value=wide]");
- ElementLocator big = pjq("input[name$=styleClassInput][value=big]");
- ElementLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
-
- selenium.click(wide);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
-
- selenium.click(big);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- ElementLocator valueInput = pjq("input[id$=valueInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
- }
-
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.a4jCommandLink;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jCommandLink/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JCommandLinkTestCase extends AbstractTestappTestCase {
-
- private ElementLocator input = pjq("input[id$=input]");
- private ElementLocator link = pjq("a[id$=a4jCommandLink]");
- private ElementLocator output1 = pjq("span[id$=output1]");
- private ElementLocator output2 = pjq("span[id$=output2]");
- private ElementLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jCommandLink/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
- ElementLocator newLink = pjq("span[id$=a4jCommandLink]");
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertFalse(selenium.isElementPresent(link), link.getAsString()
- + " should not be on page when the link is disabled");
- assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
- + " should be on page when the link is disabled");
-
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
- testFireEvent(Event.KEYUP, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, link);
- }
-
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
- ElementLocator renderInput = pjq("input[name$=renderInput]");
-
- selenium.type(renderInput, "output1");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "aaa");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
-
- selenium.type(renderInput, "output2 output3");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "bbb");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output2).text("bbb"));
-
- output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
-
- selenium.click(renderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator bold = pjq("input[name$=styleClassInput][value=bold]");
- ElementLocator strike = pjq("input[name$=styleClassInput][value=strike]");
- ElementLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = link.getAttribute(new Attribute("class"));
-
- selenium.click(bold);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
-
- selenium.click(strike);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = link.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- ElementLocator valueInput = pjq("input[id$=valueInput]");
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getText(link), value, "Value of the button did not change");
- }
-
- private void testFireEvent(Event event) {
- ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
- final String value = "alert('" + event.getEventName() + "')";
-
- selenium.type(eventInput, value);
- selenium.fireEvent(eventInput, Event.BLUR);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.fireEvent(link, event);
-
- assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
- + " attribute did not change correctly");
- }
-
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jLog/A4JLogTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.a4jLog;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jLog/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JLogTestCase extends AbstractTestappTestCase {
-
- /**
- * Enumeration representing all possible levels for a4j:log.
- */
- public enum LogLevel {
- DEBUG, INFO, WARN, ERROR;
- }
-
- private ElementLocator input = pjq("input[id$=nameInput]");
- private ElementLocator submitButton = pjq("input[id$=submitButton]");
- private ElementLocator output = pjq("span[id$=out]");
-
- private ElementLocator log = pjq("div.rich-log");
- private ElementLocator levelSelect = pjq("div.rich-log select");
- private JQueryLocator logMsg = pjq("div.rich-log div.rich-log-contents div");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testSubmit(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testSubmitUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéôúäň");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello ľščťžýáíéôúäň!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testClearButton(String templates) {
- ElementLocator clearButton = pjq("div.rich-log button");
-
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
-
- // test clear
- selenium.click(clearButton);
- count = selenium.getCount(logMsg);
- assertEquals(count, 0, "There should be no messages in log after clear button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedInput = pjq("input[id$=renderedInput]");
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertFalse(selenium.isElementPresent(log), "Log should not be displayed.");
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterDebug(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterInfo(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterWarn(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterError(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterDebug(String templates) {
- testLogging(LogLevel.INFO, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterInfo(String templates) {
- testLogging(LogLevel.INFO, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterWarn(String templates) {
- testLogging(LogLevel.INFO, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterError(String templates) {
- testLogging(LogLevel.INFO, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterDebug(String templates) {
- testLogging(LogLevel.WARN, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterInfo(String templates) {
- testLogging(LogLevel.WARN, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterWarn(String templates) {
- testLogging(LogLevel.WARN, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterError(String templates) {
- testLogging(LogLevel.WARN, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterDebug(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterInfo(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterWarn(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterError(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.ERROR);
- }
-
- private void testLogging(LogLevel logLevel, LogLevel filterLevel) {
- ElementLocator logButton = pjq("input[id$=" + logLevel.toString().toLowerCase() + "Button]");
- ElementLocator levelInput = pjq("input[type=radio][value=" + filterLevel.toString().toLowerCase() + "]");
- ElementLocator msgType = logMsg.getChild(jq("span:eq(0)"));
- ElementLocator msgContent = logMsg.getChild(jq("span:eq(1)"));
-
- if (filterLevel != LogLevel.DEBUG) {
- selenium.click(levelInput);
- selenium.waitForPageToLoad(TIMEOUT);
- }
-
- String selectedLevel = selenium.getSelectedLabel(levelSelect);
- assertEquals(selectedLevel, filterLevel.toString().toLowerCase(), "Log level in select wasn't changed.");
-
- selenium.typeKeys(input, logLevel.toString());
- selenium.click(logButton);
-
- int count = selenium.getCount(logMsg);
- assertEquals(count, filterLevel.ordinal() <= logLevel.ordinal() ? 1 : 0,
- "There should be only one message in log.");
-
- if (count == 0) {
- return;
- }
-
- String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
- assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
- output = selenium.getText(msgContent);
- assertEquals(output, logLevel.toString(), "Message content.");
-
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.a4jOutputPanel;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jOutputPanel/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JOutputPanelTestCase extends AbstractTestappTestCase {
-
- private ElementLocator increaseCounterButton = pjq("input[id$=button]");
- private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
- private ElementLocator outputSpan = pjq("span[id$=outputPanel]");
- private ElementLocator optionBlue = pjq("input[name$=styleClassInput][value=blue-background]");
- private ElementLocator optionGray = pjq("input[name$=styleClassInput][value=gray-background]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jOutputPanel/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- /**
- * Data provider for templates, events and layout of output panel.
- *
- * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
- * plain template) if nothing is defined, JavaScript events that are defined for output panel and layout of
- * panel (block or inline)
- */
- @DataProvider(name = "templatesEventsLayouts")
- private Object[][] getTemplatesEventsLayouts() {
- final int layoutsCount = 2;
- // list of templates, e.g. {{"plain"}, {"richDataTable1,redDiv"}}
- Object[][] templates = getTemplates();
- // list of events that will be tested
- Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN, Event.KEYPRESS, Event.KEYUP,
- Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER, Event.MOUSEUP};
-
- Object[][] result = new Object[templates.length * events.length * layoutsCount][];
- int index = 0;
-
- for (int i = 0; i < templates.length; i++) {
- for (int j = 0; j < events.length; j++) {
- for (int k = 0; k < layoutsCount; k++) {
- index = i * events.length * layoutsCount + j * layoutsCount + k;
- result[index] = new Object[]{templates[i][0], events[j], k == 0 ? "block" : "inline"};
- }
- }
- }
-
- return result;
- }
-
- @Test(dataProvider = "templatesEventsLayouts")
- public void testEvent(String templates, Event event, String type) {
- ElementLocator element = null;
-
- if ("inline".equals(type)) {
- // for inline layout set background to blue
- selenium.click(pjq("input[name$=layoutInput][value=inline]"));
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.click(optionBlue);
- selenium.waitForPageToLoad(TIMEOUT);
-
- element = outputSpan;
- } else {
- // for inline layout set background to gray
- selenium.click(optionGray);
- selenium.waitForPageToLoad(TIMEOUT);
-
- element = outputDiv;
- }
-
- testFireEvent(event, element);
- }
-
- @Test(dataProvider = "templates")
- public void testClick(String templates) {
- selenium.click(increaseCounterButton);
- waitGui.until(textEquals.locator(outputDiv).text("1"));
-
- selenium.click(increaseCounterButton);
- waitGui.until(textEquals.locator(outputDiv).text("2"));
- }
-
- @Test(dataProvider = "templates")
- public void testAjaxRendered(String templates) {
- ElementLocator ajaxRenderedCheckbox = pjq("input[id$=ajaxRenderedInput]");
- ElementLocator reRenderAllImage = jq("div.header img[id$=reRenderAllImage]");
-
- selenium.click(ajaxRenderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.click(increaseCounterButton);
- selenium.click(increaseCounterButton);
-
- String output = selenium.getText(outputDiv);
- assertEquals(output, "0", "Output after two clicks when ajaxRendered is set to false.");
-
- selenium.click(reRenderAllImage);
- waitGui.until(textEquals.locator(outputDiv).text("2"));
- }
-
- @Test(dataProvider = "templates")
- public void testDir(String templates) {
- ElementLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
- ElementLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
- ElementLocator optionNone = pjq("input[name$=dirInput][value=]");
- AttributeLocator attributeDir = outputDiv.getAttribute(new Attribute("dir"));
-
- // right-to-left
- selenium.click(optionRtl);
- selenium.waitForPageToLoad(TIMEOUT);
- String attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "rtl", "Attribute dir after rtl was set.");
-
- // left-to-right
- selenium.click(optionLtr);
- selenium.waitForPageToLoad(TIMEOUT);
- attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "ltr", "Attribute dir after ltr was set.");
-
- // not specified
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- if (selenium.isAttributePresent(attributeDir)) {
- attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "", "Attribute dir after none was set.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testLang(String templates) {
- ElementLocator langInput = pjq("input[id$=langInput]");
- AttributeLocator attributeLang = outputDiv.getAttribute(new Attribute("lang"));
-
- selenium.typeKeys(langInput, "en");
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "en", "Lang attribute");
-
- selenium.typeKeys(langInput, "sk");
- selenium.waitForPageToLoad(TIMEOUT);
-
- attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "sk", "Lang attribute");
- }
-
- @Test(dataProvider = "templates")
- public void testLayout(String templates) {
- ElementLocator optionBlock = pjq("input[name$=layoutInput][value=block]");
- ElementLocator optionInline = pjq("input[name$=layoutInput][value=inline]");
- ElementLocator optionNone = pjq("input[name$=layoutInput][value=none]");
-
- assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered on the beginning.");
- assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered on the beginning.");
-
- selenium.click(optionInline);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when inline is set.");
- assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when inline is set.");
-
- selenium.click(optionBlock);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered when block is set.");
- assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered when block is set.");
-
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when none is set.");
- assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when none is set.");
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedInput = pjq("input[id$=renderedInput]");
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Panel should not be rendered.");
-
- selenium.click(increaseCounterButton);
- selenium.click(increaseCounterButton);
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.isElementPresent(outputDiv), "Panel should be rendered.");
-
- String counter = selenium.getText(outputDiv);
- assertEquals(counter, "2", "Counter after two clicks on button.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- String style = "background-color: magenta; color: white; font-weight: bold;";
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- AttributeLocator attributeStyle = outputDiv.getAttribute(Attribute.STYLE);
-
- selenium.typeKeys(styleInput, style);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeStyle);
- assertEquals(attributeValue, style, "Value of attribute style.");
-
- selenium.typeKeys(styleInput, "");
- selenium.waitForPageToLoad(TIMEOUT);
-
- if (selenium.isAttributePresent(attributeStyle)) {
- attributeValue = selenium.getAttribute(attributeStyle);
- assertEquals(attributeValue, "", "Value of attribute style.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator optionNone = pjq("input[name$=styleClassInput][value=]");
- AttributeLocator attributeClass = outputDiv.getAttribute(Attribute.CLASS);
-
- selenium.click(optionBlue);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(outputDiv, "blue-background"), "Panel should have class blue-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
- "Panel should not have class gray-background set.");
-
- selenium.click(optionGray);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(outputDiv, "gray-background"), "Panel should have class gray-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
- "Panel should not have class blue-background set.");
-
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- if (selenium.isAttributePresent(attributeClass)) {
- assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
- "Panel should not have class blue-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
- "Panel should not have class gray-background set.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testTitle(String templates) {
- String title = "a4j:outputPanel title";
- ElementLocator titleInput = pjq("input[id$=titleInput]");
- AttributeLocator attributeTitle = outputDiv.getAttribute(new Attribute("title"));
-
- selenium.typeKeys(titleInput, title);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, title, "Value of attribute title.");
-
- selenium.typeKeys(titleInput, "");
- selenium.waitForPageToLoad(TIMEOUT);
-
- if (selenium.isAttributePresent(attributeTitle)) {
- attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, "", "Value of attribute style.");
- }
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPoll/PollTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.testapp.a4jPoll;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.testng.Assert.*;
-import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
-
-/**
- * Tests the a4j:poll component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class PollTestCase extends AbstractTestappTestCase {
-
- private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
- private static final int[] TEST_INTERVAL_VALUES = new int[]{1000, 5000, 500};
- private static final int TEST_INTERVAL_ITERATIONS = 5;
- private static final int MAX_DEVIATION = 100;
- private static final int MAX_AVERAGE_DEVIATION = 50;
-
- ElementLocator attributeEnabled = id("form:attributes:enabledInput");
- ElementLocator attributeInterval = id("form:attributes:intervalInput");
- JQueryLocator time = pjq("span[id$=time]");
- AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
- }
-
- @AfterMethod(alwaysRun = true)
- public void clearSession() {
- invalidateSession();
- }
-
- /**
- * <p>
- * Test the progress of polling for 3 different values from client side.
- * </p>
- *
- * <p>
- * It defines the new interval value first for each iteration and then enable polling.
- * </p>
- *
- * <p>
- * Then, it waits for first poll event (zero iteration).
- * </p>
- *
- * <p>
- * For 5 following poll events it checks that runtime visible from client (output from JavaScript's new
- * Date().getTime()) between the events haven't greater deviation from defined interval than defined
- * {@link #MAX_DEVIATION}.
- * </p>
- *
- * <p>
- * Test also computes average value of deviation and checks that the average value of all obtained particular
- * deviations isn't greater than {@link #MAX_AVERAGE_DEVIATION}.
- * </p>
- */
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testIntervalFromClientPerspective(String templates) {
-
- long total = 0;
- long count = 0;
- for (int interval : TEST_INTERVAL_VALUES) {
- selenium.type(attributeInterval, String.valueOf(interval));
- selenium.waitForPageToLoad();
-
- selenium.check(attributeEnabled);
- selenium.fireEvent(attributeEnabled, Event.CHANGE);
- selenium.waitForPageToLoad();
-
- selenium.getPageExtensions().install();
-
- long currentTime = getClientTime();
-
- for (int i = 0; i <= TEST_INTERVAL_ITERATIONS; i++) {
- long runtime = System.currentTimeMillis();
- selenium.getRequestInterceptor().clearRequestTypeDone();
- selenium.getRequestInterceptor().waitForRequestTypeChange();
- runtime -= getClientTime();
- if (i > 0) {
-
- long deviation = Math.abs(interval - Math.abs(runtime));
- if (isSeleniumDebug()) {
- System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
- }
- assertTrue(deviation <= MAX_DEVIATION, format(
- "Particular deviation ({2}) for interval {0} was greater than {1}", interval, MAX_DEVIATION,
- deviation));
- total += deviation;
- count += 1;
- }
- currentTime += runtime;
- }
-
- selenium.uncheck(attributeEnabled);
- selenium.fireEvent(attributeEnabled, Event.CHANGE);
- selenium.waitForPageToLoad();
- }
-
- long averageDeviation = total / count;
-
- if (isSeleniumDebug()) {
- System.out.println(format("total average deviation: {0}", averageDeviation));
- }
-
- assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
- "Average deviation ({1}) was greater than given maximum {0}", MAX_AVERAGE_DEVIATION, averageDeviation));
- }
-
- /**
- * Returns the time of poll event (the time when arrived the response from server)
- * @return the time of poll event (the time when arrived the response from server)
- */
- private long getClientTime() {
- return asLong(selenium.getAttribute(clientTime));
- }
-
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/AbstractPushTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/AbstractPushTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/AbstractPushTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.testapp.a4jPush;
-
-import static org.testng.Assert.*;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.jboss.test.selenium.SeleniumGetter.*;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.jboss.test.selenium.SystemProperties;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.request.RequestType;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.BeforeClass;
-
-/**
- * Abstract test case for testing a4j:push component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public abstract class AbstractPushTestCase extends AbstractTestappTestCase {
-
- private static final int STATUS_CODE_OK = 200;
-
- protected PushAttributes pushAttributes = new PushAttributes();
-
- private ElementLocator outputCounter = pjq("span[id$=outputCounter]");
-
- private HttpClient httpClient;
- private HttpMethod pushMethod;
-
- @Override
- public URL getTestUrl() {
- URL contextPath = SystemProperties.getContextPath();
- return buildUrl(contextPath, "faces/components/a4jPush/simple.xhtml");
- }
-
- /**
- * Initializes the HttpClient which triggers events in {@link #generatePushEvent()}.
- */
- @BeforeClass
- public void initializeHttpClient() {
- httpClient = new HttpClient();
- URL eventProducerUrl = buildUrl(getTestUrl(), "event-producer.xhtml");
- pushMethod = new GetMethod(eventProducerUrl.toString());
- }
-
- /**
- * Returns the value of counter as pushed value
- *
- * @return the value of counter as pushed value
- */
- protected int getCounter() {
- return getText(outputCounter).asInteger();
- }
-
- /**
- * Push the event specified number times and then waits for observation of event by client.
- *
- * @param numberOfPushes
- * the number of events should be generated
- */
- protected void pushAndWait(int numberOfPushes) throws HttpException, IOException {
- selenium.getPageExtensions().install();
- selenium.getRequestInterceptor().clearRequestTypeDone();
-
- for (int i = 0; i < numberOfPushes; i++) {
- generatePushEvent();
- }
-
- selenium.getRequestInterceptor().waitForRequestTypeChange();
- RequestType requestDone = selenium.getRequestInterceptor().getRequestTypeDone();
-
- assertEquals(requestDone, RequestType.XHR);
- }
-
- /**
- * <p>
- * Generates the push event for all registered listeners from a4j:push test Simple page.
- * </p>
- *
- * <p>
- * Internally use HttpClient to ping URL triggering push event in preRenderView phase.
- * </p>
- */
- private void generatePushEvent() throws HttpException, IOException {
- httpClient.executeMethod(pushMethod);
- assertEquals(pushMethod.getStatusCode(), STATUS_CODE_OK);
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/IntervalTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/IntervalTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/IntervalTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.testapp.a4jPush;
-
-import static org.jboss.test.selenium.utils.PrimitiveUtils.asLong;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.apache.commons.httpclient.HttpException;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.testng.annotations.Test;
-
-/**
- * Tests the interval attribute for a4j:push
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class IntervalTestCase extends AbstractPushTestCase {
-
- private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
- private static final int[] INTERVAL_VALUES = new int[]{1000, 5000, 500};
- private static final long MAX_DEVIATION = 100;
- private static final long MAX_AVERAGE_DEVIATION = 75;
- private static final int DEFAULT_COUNTER_STEP = 2;
- private static final int ITERATION_COUNT = 3;
- private static final int MULTIPLE_PUSH_COUNT = 5;
-
- AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
-
- private long startTime;
- private int counter;
- private int counterStep;
-
- private long deviationTotal = 0;
- private long deviationCount = 0;
-
- /**
- * <p>
- * For 3 different intervals, test that the interval between push event triggered and event observered by client
- * haven't greater deviation than the specified interval.
- * </p>
- *
- * <p>
- * First set the given interval into the interval attribute.
- * </p>
- *
- * <p>
- * Then push and wait for result of update triggered by observation of push event.
- * </p>
- *
- * <p>
- * Then repeat push and wait 6 times with 1 event triggered and 5 events triggered in sequence.
- * </p>
- */
- @Test
- public void testIntervalFromClientPerspective() throws HttpException, IOException {
- for (int interval : INTERVAL_VALUES) {
- counterStep = DEFAULT_COUNTER_STEP;
- pushAttributes.setInterval(interval);
-
- pushAndWait(1);
- for (int i = 0; i < ITERATION_COUNT; i++) {
- startIntervalAndCounter();
- pushAndWait(1);
- validateIntervalAndCounter(interval);
-
- startIntervalAndCounter();
- pushAndWait(MULTIPLE_PUSH_COUNT);
- validateIntervalAndCounter(interval);
- }
- }
-
- validateAverageDeviation();
- }
-
- /**
- * Remembers start of the time frame and current value of counter.
- */
- private void startIntervalAndCounter() {
- startTime = getClientTime();
- counter = getCounter();
- }
-
- /**
- * <p>
- * Obtains current value of counter and end of the time frame to compute the run time.
- * </p>
- *
- * <p>
- * Validates that run time haven't greater deviation from given maximum {@link #MAX_DEVIATION}.
- * </p>
- *
- * <p>
- * Remembers the deviation as part of total deviation for computing average value.
- * </p>
- *
- * <p>
- * Validates that counter have been increased by right value.
- * </p>
- */
- private void validateIntervalAndCounter(int interval) {
- long runTime = getClientTime() - startTime;
- long deviation = Math.abs(interval - runTime);
- assertTrue(deviation <= MAX_DEVIATION, format("Deviation ({0}) is greater than defined maximum {1}", deviation,
- MAX_DEVIATION));
-
- if (seleniumDebug) {
- System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
- }
-
- deviationTotal += deviation;
- deviationCount += 1;
-
- int newCounter = getCounter();
- assertEquals(newCounter, counter + counterStep);
- counter = newCounter;
-
- }
-
- /**
- * Validates the average deviations from intervals.
- */
- private void validateAverageDeviation() {
- long averageDeviation = deviationTotal / deviationCount;
- if (seleniumDebug) {
- System.out.println("averageDeviation: " + averageDeviation);
- }
- assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
- "Average deviation for all the intervals ({0}) should not be greater than defined maximum {1}",
- averageDeviation, MAX_AVERAGE_DEVIATION));
- }
-
- /**
- * Returns the time of push event (the time when arrived the response from server)
- *
- * @return the time of push event (the time when arrived the response from server)
- */
- private long getClientTime() {
- return asLong(selenium.getAttribute(clientTime));
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/PushAttributes.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/PushAttributes.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/PushAttributes.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.testapp.a4jPush;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.id;
-import static org.jboss.test.selenium.SeleniumGetter.*;
-
-import org.jboss.test.selenium.framework.AjaxSelenium;
-import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.locator.ElementLocator;
-
-/**
- * The control point for setting different attributes for a4j:push test page.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class PushAttributes {
-
- private AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
-
- private ElementLocator attributeInterval = id("form:attributes:intervalInput");
-
- public void setInterval(long miliseconds) {
- selenium.type(attributeInterval, String.valueOf(miliseconds));
- selenium.waitForPageToLoad();
- }
-
- public long getInterval() {
- return getValue(attributeInterval).asLong();
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/SimpleTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/SimpleTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jPush/SimpleTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-package org.richfaces.tests.testapp.a4jPush;
-
-import static org.testng.Assert.assertNotSame;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-
-import java.io.IOException;
-
-import org.apache.commons.httpclient.HttpException;
-import org.testng.annotations.Test;
-
-/**
- * Test case for simple usage of a4j:push component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class SimpleTestCase extends AbstractPushTestCase {
- private static final long SIMPLE_INTERVAL = 2500;
-
- /**
- * <p>
- * Sets the interval to value {@link #SIMPLE_INTERVAL}.
- * </p>
- *
- * <p>
- * Then try to generate push event, wait for client observation.
- * </p>
- *
- * <p>
- * Validates that counter is changed between iterations.
- * </p>
- */
- @Test
- public void testSimple() throws HttpException, IOException {
- pushAttributes.setInterval(SIMPLE_INTERVAL);
-
- int beginCounter = getCounter();
- pushAndWait(1);
- int endCounter = getCounter();
-
- assertNotSame(beginCounter < endCounter, format(
- "The counter before push is greater {0} or equal the end counter {1}", beginCounter, endCounter));
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.hCommandButton;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/commandButton/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class HCommandButtonTestCase extends AbstractTestappTestCase {
-
- private JQueryLocator input = pjq("input[id$=input]");
- private JQueryLocator button = pjq("input[id$=commandButton]");
- private JQueryLocator output1 = pjq("span[id$=output1]");
- private JQueryLocator output2 = pjq("span[id$=output2]");
- private JQueryLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
- AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String isDisabled = selenium.getAttribute(disabledAttribute);
- assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnblur(String templates) {
- testFireEvent(Event.BLUR, button);
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnchange(String templates) {
- testFireEvent(Event.CHANGE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, button);
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnfocus(String templates) {
- testFireEvent(Event.FOCUS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeyup(String templates) {
- testFireEvent(Event.KEYUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
-
- JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
- JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
- JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
-
- selenium.click(wide);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
-
- selenium.click(big);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- JQueryLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- JQueryLocator valueInput = pjq("input[id$=valueInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
- }
-
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.richExtendedDataTable;
-
-import org.jboss.test.selenium.framework.AjaxSelenium;
-import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.locator.JQueryLocator;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class DataScroller {
-
- AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
-
- JQueryLocator scrollerRoot;
- JQueryLocator pageNumbers = jq(".rf-ds-dtl");
- JQueryLocator firstPageButton = jq(".rf-ds-l[id$=ds_f]");
- JQueryLocator lastPageButton = jq(".rf-ds-r:eq(1)");
- JQueryLocator lastVisiblePage = jq(".rf-ds-dtl:last");
- JQueryLocator currentPage = jq(".rf-ds-cur");
-
- public DataScroller(JQueryLocator scrollerRoot) {
- this.scrollerRoot = scrollerRoot;
- }
-
- public JQueryLocator getRoot() {
- return scrollerRoot;
- }
-
- public void gotoFirstPage() {
- if (!isFirstPage()) {
- clickFirstPageButton();
- }
- }
-
- public void gotoLastPage() {
- if (!isLastPage()) {
- clickLastPageButton();
- }
- }
-
- public void clickLastPageButton() {
- JQueryLocator locator = scrollerRoot.getDescendant(lastPageButton);
- guardXhr(selenium).click(locator);
- }
-
- public void clickFirstPageButton() {
- JQueryLocator locator = scrollerRoot.getDescendant(firstPageButton);
- guardXhr(selenium).click(locator);
- }
-
- public int getCountOfVisiblePages() {
- JQueryLocator locator = scrollerRoot.getDescendant(pageNumbers);
- return selenium.getCount(locator);
- }
-
- public boolean hasPages() {
- JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
- return selenium.isElementPresent(locator);
- }
-
- public Integer getLastVisiblePage() {
- JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
- if (!hasPages()) {
- return null;
- }
- return integer(selenium.getText(locator));
- }
-
- public int getCurrentPage() {
- JQueryLocator locator = scrollerRoot.getDescendant(currentPage);
- if (!hasPages()) {
- return 1;
- }
- return integer(selenium.getText(locator));
- }
-
- public boolean isFirstPage() {
- return getCurrentPage() == 1;
- }
-
- public boolean isLastPage() {
- return getCurrentPage() == getLastVisiblePage();
- }
-
- public static int integer(String string) {
- return Integer.valueOf(string);
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.richExtendedDataTable;
-
-import org.jboss.test.selenium.framework.AjaxSelenium;
-import org.jboss.test.selenium.framework.AjaxSeleniumProxy;
-import org.jboss.test.selenium.locator.JQueryLocator;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-
-/**
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class DataTable {
-
- AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
-
- JQueryLocator tableRoot;
- JQueryLocator tableRows = jq(".rf-dt-c:nth-child(1)");
-
- public DataTable(JQueryLocator tableRoot) {
- super();
- this.tableRoot = tableRoot;
- }
-
- public int getCountOfTableRows() {
- JQueryLocator locator = tableRoot.getDescendant(tableRows);
- return selenium.getCount(locator);
- }
-
- public String getTableText() {
- return selenium.getText(tableRoot);
- }
-}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 21:14:22 UTC (rev 17913)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-11 00:06:08 UTC (rev 17914)
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *******************************************************************************/
-
-package org.richfaces.tests.testapp.richExtendedDataTable;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.Test;
-
-/**
- * Test of DataScroller tied to Extended Data Table
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class ScrollerTestCase extends AbstractTestappTestCase {
-
- private static final int TOTAL_ROW_COUNT = 50;
- private static final Integer[] ROW_COUNT_VALUES =
- new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT};
-
- DataScroller dataScroller1 = new DataScroller(pjq("span.rf-ds[id$=scroller1]"));
- DataScroller dataScroller2 = new DataScroller(pjq("span.rf-ds[id$=scroller2]"));
- DataTable table = new DataTable(pjq("table.rf-dt[id$=richEDT]"));
- ElementLocator attributeRowsInput = id("form:attributes:rowsInput");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richExtendedDataTable/scroller.xhtml");
- }
-
- /**
- * Tests row count for scroller in footer of the EDT.
- *
- * @see {@link #testRowCount(DataScroller)}
- */
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testRowCountFooterScroller(String templates) {
- testRowCount(dataScroller2);
- }
-
- /**
- * Tests row count for scroller outside of the EDT.
- *
- * @see {@link #testRowCount(DataScroller)}
- */
- @Test(dataProvider = "templates")
- public void testRowCountOutsideTable(String templates) {
- testRowCount(dataScroller1);
- }
-
- /**
- * <p>
- * Test the data scroller functionality for different values of row count
- * </p>
- *
- * <p>
- * If desired, sets the value of 'rows' first for each iteration.
- * </p>
- *
- * <p>
- * Then goes to first page and verifies that there is valid number of rows.
- * </p>
- *
- * <p>
- * Verifies that on the first page is less than total number of rows if the scroller has several pages.
- * </p>
- *
- * <p>
- * If the scroller has pages enabled, goes to last page and verifies that this is valid number of pages visible in
- * scroller and the number of rows is valid.
- * </p>
- *
- * <p>
- */
- private void testRowCount(DataScroller dataScroller) {
- for (Integer rowsPerPage : ROW_COUNT_VALUES) {
- if (rowsPerPage != null) {
- selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
- selenium.fireEvent(attributeRowsInput, Event.BLUR);
- selenium.waitForPageToLoad();
- }
-
- dataScroller.gotoFirstPage();
- int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
- int rowCountActual = table.getCountOfTableRows();
- assertEquals(rowCountActual, Math.min(TOTAL_ROW_COUNT, rowCountPreset));
-
- assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
- if (dataScroller.hasPages()) {
- dataScroller.gotoLastPage();
-
- int pagesExpected = pageCountActualExpected(rowCountActual);
- int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
-
- if (countOfVisiblePages < pagesExpected) {
- int lastVisiblePage = dataScroller.getLastVisiblePage();
- assertEquals(lastVisiblePage, pageCountActualExpected(rowCountActual));
- } else {
- assertEquals(countOfVisiblePages, pagesExpected);
- }
-
- int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
- rowCountActual = table.getCountOfTableRows();
- assertEquals(rowCountActual, rowCountExpected);
- }
- }
- }
-
- private int pageCountActualExpected(int rowCountActual) {
- return Double.valueOf(Math.ceil((double) TOTAL_ROW_COUNT / rowCountActual)).intValue();
- }
-
- private int rowCountLastPageExpected(int rowCountPreset) {
- int result = TOTAL_ROW_COUNT % rowCountPreset;
- return (result == 0) ? rowCountPreset : result;
- }
-
-}
14 years, 6 months
JBoss Rich Faces SVN: r17913 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:14:22 -0400 (Sat, 10 Jul 2010)
New Revision: 17913
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
exposed ${testng.suite.xml} to project properties
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:14:11 UTC (rev 17912)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:14:22 UTC (rev 17913)
@@ -20,6 +20,7 @@
<properties>
<context.path>/testapp/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
+ <testng.suite.xml>src/test/resources/testng.xml</testng.suite.xml>
</properties>
<pluginRepositories>
@@ -220,7 +221,7 @@
</goals>
<configuration>
<suiteXmlFiles>
- <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
+ <suiteXmlFile>${testng.suite.xml}</suiteXmlFile>
</suiteXmlFiles>
<argLine>-Dtemplates='${templates}'</argLine>
<properties>
14 years, 6 months
JBoss Rich Faces SVN: r17912 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:14:11 -0400 (Sat, 10 Jul 2010)
New Revision: 17912
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
removed the Tomcat6 related modifications for EL 2.2 support (testapp doesn't need EL 2.2 anymore)
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:13:59 UTC (rev 17911)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:14:11 UTC (rev 17912)
@@ -99,93 +99,6 @@
</build>
</profile>
<profile>
- <id>container-tomcat6x-deploy-el2.2-libs</id>
- <activation>
- <property>
- <name>containerId</name>
- <value>tomcat6x</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.savage7.maven.plugins</groupId>
- <artifactId>maven-external-dependency-plugin</artifactId>
- <version>0.2-SNAPSHOT</version>
- <inherited>false</inherited>
- <configuration>
- <stagingDirectory>${project.build.directory}/dependencies/</stagingDirectory>
- <createChecksum>true</createChecksum>
- <skipChecksumVerification>false</skipChecksumVerification>
- <force>false</force>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>jasper</artifactId>
- <version>6.0.26</version>
- <classifier>el-2.2</classifier>
- <packaging>jar</packaging>
- <downloadUrl>http://www.fryc.eu/dependencies/jasper.jar</downloadUrl>
- <checksum>762a42f8d269d128a9262c0654bacc062439c415</checksum>
- </artifactItem>
- </artifactItems>
- </configuration>
- <executions>
- <execution>
- <id>resolve-install-external-dependencies</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>resolve-external</goal>
- <goal>install-external</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>deploy-el-2.2-libs</id>
- <goals>
- <goal>copy</goal>
- </goals>
- <phase>process-test-resources</phase>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>jasper</artifactId>
- <version>6.0.26</version>
- <classifier>el-2.2</classifier>
- <overWrite>true</overWrite>
- <outputDirectory>${container.home}/lib</outputDirectory>
- <destFileName>jasper.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- <overWrite>true</overWrite>
- <outputDirectory>${container.home}/lib</outputDirectory>
- <destFileName>el-api.jar</destFileName>
- </artifactItem>
- <artifactItem>
- <groupId>org.glassfish.web</groupId>
- <artifactId>el-impl</artifactId>
- <version>2.2.0-SNAPSHOT</version>
- <overWrite>true</overWrite>
- <outputDirectory>${container.home}/lib</outputDirectory>
- <destFileName>el-impl.jar</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
<id>clean-tomcat-exploded-war</id>
<activation>
<property>
14 years, 6 months