Author: stan.silvert(a)jboss.com
Date: 2008-11-23 20:43:08 -0500 (Sun, 23 Nov 2008)
New Revision: 58
Added:
trunk/jsfunit/
trunk/jsfunit/pom.xml
trunk/jsfunit/src/
trunk/jsfunit/src/main/
trunk/jsfunit/src/main/webapp/
trunk/jsfunit/src/main/webapp/META-INF/
trunk/jsfunit/src/main/webapp/META-INF/jboss-structure.xml
trunk/jsfunit/src/main/webapp/WEB-INF/
trunk/jsfunit/src/main/webapp/WEB-INF/web.xml
trunk/jsfunit/src/test/
trunk/jsfunit/src/test/java/
trunk/jsfunit/src/test/java/org/
trunk/jsfunit/src/test/java/org/jboss/
trunk/jsfunit/src/test/java/org/jboss/jopr/
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/HelloJoprTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JoprLoginStrategy.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/SimpleConfirmHandler.java
trunk/jsfunit/testdata/
trunk/jsfunit/testdata/war/
trunk/jsfunit/testdata/war/hellothere.war
Modified:
trunk/core/
trunk/core/src/main/webapp/include/resourceNavigation.xhtml
trunk/core/src/main/webapp/login.xhtml
trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml
trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
trunk/jbas4/
trunk/jbas5/
trunk/pom.xml
Log:
JBAS-6200 Integration test framework for admin-console with AS4 and AS5
Property changes on: trunk/core
___________________________________________________________________
Name: svn:ignore
+ target
Modified: trunk/core/src/main/webapp/include/resourceNavigation.xhtml
===================================================================
--- trunk/core/src/main/webapp/include/resourceNavigation.xhtml 2008-11-21 17:51:29 UTC
(rev 57)
+++ trunk/core/src/main/webapp/include/resourceNavigation.xhtml 2008-11-24 01:43:08 UTC
(rev 58)
@@ -34,9 +34,10 @@
<body>
<ui:composition>
<div id="sidebar-left">
- <h:form rendered="#{s:hasRole('JBossAdmin')}">
+ <h:form id="navTreeForm"
rendered="#{s:hasRole('JBossAdmin')}">
<rich:tree switchType="ajax"
+ id="navTree"
value="#{rootNode}"
var="item"
nodeFace="#{item.class.name}"
@@ -50,10 +51,12 @@
style="width: 300px;">
<!-- NODE: resourceInstance summary home node -->
<rich:treeNode
type="org.jboss.on.embedded.ui.nav.PlatformResourceTreeNode"
+ id="homeNode"
icon="/images/iconHome#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif"
iconLeaf="/images/iconLeaf#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif">
<!--a-->
<s:link view="/secure/summary.xhtml"
propagation="end"
+ id="homeLink"
styleClass="#{navigationAction.getAvailableStatus(item.resource).equals('DOWN')
? 'rich-tree-node-unavailable' : ''}
#{navigationAction.equalsSelectedNode(item) ? 'rich-tree-node-selected' :
'' }">
#{item.name}
<!--
@@ -65,10 +68,12 @@
</rich:treeNode>
<!-- NODE: resourceInstanceSummary node or leaf-->
<rich:treeNode
type="org.jboss.on.embedded.ui.nav.ResourceTreeNode"
+ id="instanceNodeOrLeaf"
iconLeaf="/images/iconLeaf#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif"
icon="/images/iconLeaf#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif">
<!--b-->
<s:link view="/secure/summary.xhtml"
propagation="end"
+ id="instanceNodeOrLeafLink"
styleClass="#{navigationAction.getAvailableStatus(item.resource).equals('DOWN')
? 'rich-tree-node-unavailable' : ''}
#{navigationAction.equalsSelectedNode(item) ? 'rich-tree-node-selected' :
'' }">
#{item.name}
<f:param name="path"
value="#{item.path}"/>
@@ -76,10 +81,12 @@
</rich:treeNode>
<!-- NODE: resourceInstanceSummary leaf -->
<rich:treeNode
type="org.jboss.on.embedded.ui.nav.SingletonResourceTypeTreeNode"
+ id="instanceLeaf"
iconLeaf="/images/iconLeaf#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif"
icon="/images/iconLeaf#{navigationAction.getAvailableStatus(item.resource).equals('UNKNOWN')
? 'Unkn' :
navigationAction.getAvailableStatus(item.resource).equals('DOWN') ? 'Disa'
: 'Norm'}.gif">
<!--c-->
<s:link view="/secure/summary.xhtml"
propagation="end"
+ id="instanceLeafLink"
styleClass="#{navigationAction.getAvailableStatus(item.resource).equals('DOWN')
? 'rich-tree-node-unavailable' : ''}
#{navigationAction.equalsSelectedNode(item) ? 'rich-tree-node-selected' :
'' }">
#{item.name}
<f:param name="path"
value="#{item.path}"/>
@@ -87,10 +94,12 @@
</rich:treeNode>
<!-- NODE: resourceTypeSummary -->
<rich:treeNode
type="org.jboss.on.embedded.ui.nav.NonSingletonResourceTypeTreeNode"
+ id="typeSummary"
iconLeaf="/images/iconFolderNorm.gif"
icon="/images/iconFolderNorm.gif">
<!--d-->
<s:link view="/secure/summary.xhtml"
propagation="end"
+ id="typeSummaryLink"
styleClass="#{navigationAction.equalsSelectedNode(item)
? 'rich-tree-node-selected' : 'false_D'}">
#{item.name}
<f:param name="path"
value="#{item.path}"/>
@@ -98,10 +107,12 @@
</rich:treeNode>
<!-- NODE: categorySummary or repeatNav -->
<rich:treeNode
type="org.jboss.on.embedded.ui.nav.SubCategoryTreeNode"
+ id="categorySummary"
iconLeaf="/images/iconFolderNorm.gif"
icon="/images/iconFolderNorm.gif">
<!--e-->
<s:link view="/secure/summary.xhtml"
propagation="end"
+ id="categorySummaryLink"
styleClass="#{navigationAction.equalsSelectedNode(item)
? 'rich-tree-node-selected' : 'false_E'}">
#{item.name}
<f:param name="path"
value="#{item.path}"/>
Modified: trunk/core/src/main/webapp/login.xhtml
===================================================================
--- trunk/core/src/main/webapp/login.xhtml 2008-11-21 17:51:29 UTC (rev 57)
+++ trunk/core/src/main/webapp/login.xhtml 2008-11-24 01:43:08 UTC (rev 58)
@@ -54,7 +54,7 @@
<h:inputText id="name"
value="#{identity.username}"/></div>
<div style="padding-top: 10px;"><h:outputLabel
for="password"
value="#{messages['security.password']}"/><br/>
<h:inputSecret id="password"
value="#{identity.password}"/></div>
- <div style="padding-top: 10px;"><h:commandButton
value="#{messages['security.login']}"
+ <div style="padding-top: 10px;"><h:commandButton
value="#{messages['security.login']}" id="submit"
action="#{identity.login()}" styleClass="buttonmed"/>
</div>
</h:form>
Modified: trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml 2008-11-21 17:51:29 UTC
(rev 57)
+++ trunk/core/src/main/webapp/secure/resourceContentCreate.xhtml 2008-11-24 01:43:08 UTC
(rev 58)
@@ -39,7 +39,7 @@
#{messages['content.resourceInstance.create']}
</div>
<hr/>
- <h:form enctype="multipart/form-data">
+ <h:form id="createContentForm"
enctype="multipart/form-data">
<h:panelGrid styleClass="formstyle">
<s:fileUpload id="file"
data="#{createContentBackedResourceAction.file}"
@@ -54,9 +54,11 @@
rendered="#{configurationDefinition ne
null}"/>
<h:panelGrid columns="2"
cellspacing="9">
<h:commandButton
value="#{messages['resource.add.button.continue']}"
+ id="addButton"
action="#{createContentBackedResourceAction.createContentBackedResource()}"
styleClass="buttonmed"/>
<s:button
value="#{messages['resource.add.button.cancel']}"
+ id="cancelButton"
view="/secure/summary.xhtml"
propagation="end"
styleClass="buttonmed"/>
Modified: trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2008-11-21 17:51:29 UTC
(rev 57)
+++ trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2008-11-24 01:43:08 UTC
(rev 58)
@@ -51,21 +51,23 @@
#{resourceType.description}
</div>
<div class="actionHeader">
- <h:form rendered="#{resourceType.creatable}"
style="text-align: right;">
+ <h:form id="actionHeaderForm"
rendered="#{resourceType.creatable}" style="text-align: right;">
<s:button rendered="#{resourceType.creationDataType ne
'CONTENT'}"
+ id="addNewNotContent"
action="#{templateDropDownPopulator.getTemplateDropDownEntriesByResourceType()}"
value="#{messages['summary.resourceType.addNew']}"
styleClass="buttonmed">
<f:param name="selectedResourceTypeName"
value="#{resourceType.name}"/>
</s:button>
<s:button rendered="#{resourceType.creationDataType eq
'CONTENT'}"
+ id="addNewContent"
action="#{createContentBackedResourceAction.init()}"
value="#{messages['summary.resourceType.addNew']}"
styleClass="buttonmed"/>
</h:form>
<h:outputLabel rendered="#{!resourceType.creatable}"
value="#{messages['resourcetype.no.action']}"/>
</div>
- <h:form>
+ <h:form id="resourceSummaryForm">
<!-- TODO: need to add checkboxes and addNew / Delete actions
-->
<rich:dataTable
id="dataTable"
@@ -90,7 +92,7 @@
</f:facet>
<rich:column>
<!-- TODO: style should be either link-avilable or
link-unavailable -->
- <s:link
+ <s:link id="resourceName"
value="#{resourceItem.name}"
view="/secure/summary.xhtml"
styleClass="link-available">
@@ -100,11 +102,12 @@
</rich:column>
<!-- TODO: need to figure out what other columns to add that
are specific to this resourceType -->
<rich:column>
- <h:outputText
value="#{resourceItem.availability}"/>
+ <h:outputText id="availability"
value="#{resourceItem.availability}"/>
</rich:column>
<rich:column>
<ui:param name="confirmDeleteMessage"
value="#{messages['summary.resourceType.confirmDelete']}"/>
- <s:button
action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
+ <s:button id="removeButton"
+
action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
onclick="if
(!confirm('#{confirmDeleteMessage}')) return false"
rendered="#{resourceItem.resource.resourceType.deletable}"
styleClass="buttonsmall">
Property changes on: trunk/jbas4
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/jbas5
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: trunk/jsfunit
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml (rev 0)
+++ trunk/jsfunit/pom.xml 2008-11-24 01:43:08 UTC (rev 58)
@@ -0,0 +1,266 @@
+<?xml version="1.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>
+ <groupId>org.jboss.jopr</groupId>
+ <artifactId>jopr-embedded-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.jopr</groupId>
+ <artifactId>jopr-embedded-jsfunit</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>JSFUnit Tests for Embedded Admin Console</name>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>codehaus snapshot repository</id>
+ <
url>http://snapshots.repository.codehaus.org/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jsfunit</groupId>
+ <artifactId>jboss-jsfunit-core</artifactId>
+ <version>1.0.0.GA-SNAPSHOT</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jsfunit</groupId>
+ <artifactId>jboss-jsfunit-richfaces</artifactId>
+ <version>1.0.0.GA-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-j2se</artifactId>
+ <version>5.0.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <scope>provided</scope>
+ <version>2.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <scope>provided</scope>
+ <version>2.8.1</version>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>jboss4.2</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jopr</groupId>
+ <artifactId>jopr-embedded-jbas4</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss42x</containerId>
+ <home>${JBOSS_HOME}</home>
+ <log>${basedir}/target/jboss4.2.logs/cargo.log</log>
+ <timeout>300000</timeout> <!-- 5 minutes -->
+ <systemProperties>
+ <!-- snoops request and response from client side
+ result is in server.log
+
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
+
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
+ </systemProperties>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <systemProperties>
+ <property>
+ <name>cactus.contextURL</name>
+
<value>http://localhost:8080/${project.build.finalName}</value>
+ </property>
+ <property>
+ <name>cactus.servletRedirectorName</name>
+ <value>ServletRedirector.jsfunit</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jboss5x</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jopr</groupId>
+ <artifactId>jopr-embedded-jbas5</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss5x</containerId>
+ <home>${JBOSS_HOME}</home>
+ <log>${basedir}/target/jboss5.x.logs/cargo.log</log>
+ <timeout>300000</timeout> <!-- 5 minutes -->
+ <systemProperties>
+
<jboss.server.log.threshold>INFO</jboss.server.log.threshold>
+ <!-- Snoops request and response from client side. Result
is in server.log
+
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
+
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
+ </systemProperties>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <systemProperties>
+ <property>
+ <name>cactus.contextURL</name>
+
<value>http://localhost:8080/${project.build.finalName}</value>
+ </property>
+ <property>
+ <name>cactus.servletRedirectorName</name>
+ <value>ServletRedirector.jsfunit</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <build>
+ <sourceDirectory>src/test/java</sourceDirectory>
+ <testSourceDirectory>src/test/java</testSourceDirectory>
+ <finalName>admin-console-jsfunit</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <useCache>false</useCache>
+ <archive>
+ <manifest>
+
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+
<dependentWarIncludes>**,**/jboss-structure.xml</dependentWarIncludes>
+ </configuration>
+ </plugin>
+ <!-- Only run the tests if you set one of the profiles above -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/jsfunit/src/main/webapp/META-INF/jboss-structure.xml
===================================================================
--- trunk/jsfunit/src/main/webapp/META-INF/jboss-structure.xml
(rev 0)
+++ trunk/jsfunit/src/main/webapp/META-INF/jboss-structure.xml 2008-11-24 01:43:08 UTC
(rev 58)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Fix for EMBJOPR-21: ignore the EJB3 related metadata -->
+<structure>
+ <context>
+ <path name=""/>
+ <metaDataPath>
+ <path name="WEB-INF"/>
+ </metaDataPath>
+ <classpath>
+ <path name="WEB-INF/classes"/>
+ <path name="WEB-INF/lib" suffixes=".jar"/>
+ </classpath>
+ </context>
+</structure>
Added: trunk/jsfunit/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/jsfunit/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/jsfunit/src/main/webapp/WEB-INF/web.xml 2008-11-24 01:43:08 UTC (rev 58)
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Embedded Jopr Project
+ ~ Copyright (C) 2006-2008 Red Hat, Inc.
+ ~ All rights reserved.
+ ~
+ ~ This program 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 program 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 program; if not, write to the Free Software
+ ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ -->
+<web-app version="2.5"
+
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <!-- RichFaces -->
+
+ <!-- From Seam docs: If RichFaces is used in your project, Seam will install
+ the RichFaces Ajax filter for you, making sure to install it before all
+ other built-in filters. You don't need to install the RichFaces Ajax
+ filter in web.xml yourself. -->
+
+ <context-param>
+ <param-name>org.richfaces.SKIN</param-name>
+ <param-value>jboss-console</param-value>
+ </context-param>
+
+ <!-- JSFUnit -->
+ <filter>
+ <filter-name>JSFUnitFilter</filter-name>
+ <filter-class>org.jboss.jsfunit.framework.JSFUnitFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JSFUnitFilter</filter-name>
+ <servlet-name>ServletTestRunner</servlet-name>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>JSFUnitFilter</filter-name>
+ <servlet-name>ServletRedirector</servlet-name>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>ServletRedirector</servlet-name>
+
<servlet-class>org.jboss.jsfunit.framework.JSFUnitServletRedirector</servlet-class>
+ </servlet>
+
+ <servlet>
+ <servlet-name>ServletTestRunner</servlet-name>
+
<servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ServletRedirector</servlet-name>
+ <url-pattern>/ServletRedirector.jsfunit</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ServletTestRunner</servlet-name>
+ <url-pattern>/ServletTestRunner</url-pattern>
+ </servlet-mapping>
+
+
+ <!-- Seam -->
+
+ <listener>
+ <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
+ </listener>
+
+
+
+
+ <!-- From Seam docs: The Seam master filter must be the first filter specified
+ in web.xml. This ensures it is run first. -->
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <!-- JSF -->
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/navigation.xml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <!-- JSF RI -->
+
+ <listener>
+
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+
+ <!-- Facelets -->
+
+ <!-- load our Facelets taglibs (value must be semicolon-delimited) -->
+ <context-param>
+ <param-name>facelets.LIBRARIES</param-name>
+ <param-value>/WEB-INF/on.component.taglib.xml</param-value>
+ </context-param>
+
+ <!-- enable special debug output for development -->
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!--<security-constraint>-->
+ <!--<web-resource-collection>-->
+ <!--<web-resource-name>HtmlAdaptor</web-resource-name>-->
+ <!--<description> An example security config that only allows users
with-->
+ <!--the role JBossAdmin to access the embedded console web-->
+ <!--application </description>-->
+ <!--<url-pattern>/*</url-pattern>-->
+ <!--<http-method>GET</http-method>-->
+ <!--<http-method>POST</http-method>-->
+ <!--</web-resource-collection>-->
+ <!--<auth-constraint>-->
+ <!--<role-name>JBossAdmin</role-name>-->
+ <!--</auth-constraint>-->
+ <!--</security-constraint>-->
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>JBoss embedded Console</realm-name>
+ </login-config>
+ <security-role>
+ <role-name>JBossAdmin</role-name>
+ </security-role>
+
+
+</web-app>
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/HelloJoprTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/HelloJoprTest.java
(rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/HelloJoprTest.java 2008-11-24
01:43:08 UTC (rev 58)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlFileInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.servlet.http.HttpServletRequest;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.cactus.ServletTestCase;
+import org.jboss.jsfunit.framework.WebClientSpec;
+import org.jboss.jsfunit.jsfsession.JSFClientSession;
+import org.jboss.jsfunit.jsfsession.JSFServerSession;
+import org.jboss.jsfunit.jsfsession.JSFSession;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * Sample for testing Embedded Jopr. Here I present a fairly complex test
+ * case to show some of the things that JSFUnit can do.
+ *
+ * @author Stan Silvert
+ */
+public class HelloJoprTest extends ServletTestCase
+{
+ private boolean isJBoss4;
+
+ private JSFClientSession client;
+ private JSFServerSession server;
+
+ /**
+ * Start a JSFUnit session by logging in to the main page. Note that
+ * because setUp() is called before each test, a new HttpSession will be
+ * created each time a test is run.
+ */
+ public void setUp() throws IOException
+ {
+ isJBoss4 = Package.getPackage("org.jboss.system.server")
+ .getImplementationVersion()
+ .startsWith("4");
+
+ // Initial JSF request
+ WebClientSpec wcSpec = new WebClientSpec("/");
+
+ // This is temporary because embedded Jopr can't find /js/rhq.js
+ wcSpec.getWebClient().setThrowExceptionOnFailingStatusCode(false);
+
+ // Always press OK for confirm dialogs
+ wcSpec.getWebClient().setConfirmHandler(new SimpleConfirmHandler(true));
+
+ wcSpec.setInitialRequestStrategy(new JoprLoginStrategy()); // logs in
+
+ JSFSession jsfSession = new JSFSession(wcSpec);
+ this.client = jsfSession.getJSFClientSession();
+ this.server = jsfSession.getJSFServerSession();
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( HelloJoprTest.class );
+ }
+
+ public void testDeployWAR() throws IOException
+ {
+ // click the nave tree
+ HtmlAnchor warLink = getNavTreeLink("Web Application (WAR)");
+ warLink.click();
+
+ // click on the "Add new resource" button
+ client.click("actionHeaderForm:addNewContent"); // 404 if
setThrowExceptionOnFailingStatusCode(true) above
+
+ // upload hellothere.war
+ HtmlFileInput fileInput =
(HtmlFileInput)client.getElement("createContentForm:file");
+ fileInput.setContentType("application/war");
+ fileInput.setValueAttribute(System.getProperty("jsfunit.testdata") +
"/war/hellothere.war");
+ client.click("createContentForm:addButton");
+
+ // assert that the success message appeared on the client side
+ assertTrue(client.getPageAsText().contains("hellothere.war created
successfully"));
+
+ // assert text and sevrity level for FacesMessage on server side
+ assertTrue(server.getFacesMessages().hasNext());
+ FacesMessage successMessage = server.getFacesMessages().next();
+ assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
+ assertTrue(successMessage.getDetail().contains("hellothere.war created
successfully"));
+
+ // Use JMX to assert that the WAR really did deploy successfully
+ assertTrue(isWarDeployed("hellothere.war"));
+
+ // use HtmlUnit to test the newly deployed war in a new WebClient session
+ // note that I have full access to the FacesContext and the previous request
+ HttpServletRequest request =
(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = request.getLocalPort();
+ WebClient webClient = new WebClient();
+ HtmlPage page = (HtmlPage)webClient.getPage("http://localhost:" + port +
"/hellothere/hello.jsp");
+ assertTrue(page.asText().contains("HELLO WORLD"));
+
+ // Undeploy the WAR
+ HtmlButtonInput deleteButton = getDeleteButton("hellothere.war");
+ deleteButton.click();
+
+ // This assert doesn't work. jopr does remove the WAR, but for some
+ // reason, JBoss doesn't undeploy the MBeans
+ //assertFalse(isWarDeployed("hellothere.war"));
+ }
+
+ private boolean isWarDeployed(String warName)
+ {
+ if (isJBoss4)
+ {
+ return checkWarDeployment_4_2(warName);
+ }
+ else
+ {
+ return checkWarDeployment_5_0(warName);
+ }
+ }
+
+ // Query the MBean server to find if WAR is deployed
+ private boolean checkWarDeployment_4_2(String warName)
+ {
+ try {
+ MBeanServer jmxServer = MBeanServerLocator.locateJBoss();
+ ObjectName objName = new ObjectName("jboss.web.deployment:war=" +
warName + ",*");
+ Set mBeans = jmxServer.queryNames(objName, null);
+ if (mBeans.size() != 1) return false;
+ ObjectName deploymentMBean = (ObjectName)mBeans.iterator().next();
+ String state = (String)jmxServer.getAttribute(deploymentMBean,
"StateString");
+ return "Started".equals(state);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Query the MBean server to find if WAR is deployed
+ private boolean checkWarDeployment_5_0(String warName)
+ {
+ if (warName.endsWith(".war"))
+ {
+ warName = warName.substring(0, warName.lastIndexOf(".war"));
+ }
+ else
+ {
+ warName = warName.substring(0, warName.lastIndexOf(".WAR"));
+ }
+
+ try {
+ MBeanServer jmxServer = MBeanServerLocator.locateJBoss();
+ ObjectName objName = new
ObjectName("jboss.deployment:id=\"jboss.web.deployment:war=/" + warName +
"\",*");
+ Set mBeans = jmxServer.queryNames(objName, null);
+ if (mBeans.size() != 1) return false;
+ ObjectName deploymentMBean = (ObjectName)mBeans.iterator().next();
+
+ // returns org.jboss.deployers.spi.DeploymentState
+ Object state = jmxServer.getAttribute(deploymentMBean, "State");
+ return "DEPLOYED".equals(state.toString());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // need a standard JSFUnit API to replace this code
+ private HtmlAnchor getNavTreeLink(String linkLabel)
+ {
+ return getLinkInsideForm("navTreeForm", linkLabel);
+ }
+
+ private HtmlButtonInput getDeleteButton(String resourceName)
+ {
+ HtmlAnchor link = getLinkInsideForm("resourceSummaryForm",
resourceName);
+ // The id will look like "resourceSummaryForm:dataTable:2:resourceName"
+ // I need the row number. (2 in the above example)
+ String id = link.getIdAttribute();
+ String[] idElements = id.split(":");
+ String row = idElements[idElements.length - 2];
+ return (HtmlButtonInput)client.getElement(row + ":removeButton");
+ }
+
+ // finds a <a> tag inside a form that has a particular label
+ private HtmlAnchor getLinkInsideForm(String formId, String linkLabel)
+ {
+ HtmlForm form = (HtmlForm)client.getElement(formId);
+ List links = form.getByXPath(".//a"); // get all <a> tags inside
form
+
+ for (Iterator i = links.iterator(); i.hasNext();)
+ {
+ HtmlAnchor link = (HtmlAnchor)i.next();
+ String linkText = link.getTextContent();
+ if (linkText.contains(linkLabel)) return link;
+ }
+
+ throw new IllegalStateException("Nav Tree link for '" + linkLabel +
"' not found.");
+ }
+
+}
\ No newline at end of file
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JoprLoginStrategy.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JoprLoginStrategy.java
(rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JoprLoginStrategy.java 2008-11-24
01:43:08 UTC (rev 58)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit;
+
+import org.jboss.jsfunit.framework.FormAuthenticationStrategy;
+
+/**
+ * This automatically logs in to the app when the challenge form is presented.
+ *
+ * @author Stan Silvert
+ */
+public class JoprLoginStrategy extends FormAuthenticationStrategy
+{
+
+ /**
+ * Create a new JoprLoginStrategy with default username/password.
+ */
+ public JoprLoginStrategy()
+ {
+ this("admin", "admin");
+ }
+
+ /**
+ * Create a new JoprLoginStrategy.
+ *
+ * @param userName The user name.
+ * @param password The password.
+ */
+ public JoprLoginStrategy(String userName, String password)
+ {
+ super(userName, password, "login_form:submit",
"login_form:name", "login_form:password");
+ }
+
+}
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/SimpleConfirmHandler.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/SimpleConfirmHandler.java
(rev 0)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/SimpleConfirmHandler.java 2008-11-24
01:43:08 UTC (rev 58)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit;
+
+import com.gargoylesoftware.htmlunit.ConfirmHandler;
+import com.gargoylesoftware.htmlunit.Page;
+
+/**
+ * Simple ConfirmHandler to always reply with OK or Cancel for window.confirm()
+ * dialogs.
+ *
+ * @author Stan Silvert
+ */
+public class SimpleConfirmHandler implements ConfirmHandler
+{
+
+ private boolean cannedResponse;
+
+ /**
+ * Create a new SimpleConfirmHandler.
+ *
+ * @param cannedResponse <code>true</code> to always click OK,
<code>false</code>
+ * to always click Cancel.
+ */
+ public SimpleConfirmHandler(boolean cannedResponse)
+ {
+ this.cannedResponse = cannedResponse;
+ }
+
+ public boolean handleConfirm(Page page, String message) {
+ return cannedResponse;
+ }
+
+}
\ No newline at end of file
Added: trunk/jsfunit/testdata/war/hellothere.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-11-21 17:51:29 UTC (rev 57)
+++ trunk/pom.xml 2008-11-24 01:43:08 UTC (rev 58)
@@ -103,6 +103,7 @@
<module>core</module>
<module>jbas4</module>
<module>jbas5</module>
+ <module>jsfunit</module>
</modules>
<repositories>