Seam SVN: r10877 - modules/trunk/view.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 20:19:35 -0400 (Mon, 11 May 2009)
New Revision: 10877
Modified:
modules/trunk/view/
Log:
ignores
Property changes on: modules/trunk/view
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
15 years, 6 months
Seam SVN: r10876 - in modules/trunk: view and 7 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 20:19:10 -0400 (Mon, 11 May 2009)
New Revision: 10876
Added:
modules/trunk/view/
modules/trunk/view/pom.xml
modules/trunk/view/src/
modules/trunk/view/src/main/
modules/trunk/view/src/main/java/
modules/trunk/view/src/main/java/org/
modules/trunk/view/src/main/java/org/jboss/
modules/trunk/view/src/main/java/org/jboss/seam/
modules/trunk/view/src/main/java/org/jboss/seam/view/
modules/trunk/view/src/main/java/org/jboss/seam/view/Selector.java
Log:
add view module
Added: modules/trunk/view/pom.xml
===================================================================
--- modules/trunk/view/pom.xml (rev 0)
+++ modules/trunk/view/pom.xml 2009-05-12 00:19:10 UTC (rev 10876)
@@ -0,0 +1,39 @@
+<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>seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-view</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam View Module</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: modules/trunk/view/src/main/java/org/jboss/seam/view/Selector.java
===================================================================
--- modules/trunk/view/src/main/java/org/jboss/seam/view/Selector.java (rev 0)
+++ modules/trunk/view/src/main/java/org/jboss/seam/view/Selector.java 2009-05-12 00:19:10 UTC (rev 10876)
@@ -0,0 +1,138 @@
+package org.jboss.seam.view;
+
+import java.io.Serializable;
+
+import javax.servlet.http.Cookie;
+
+/**
+ * Support for selector objects which remember their selection as a cookie
+ *
+ * @author Gavin King
+ * @author Shane Bryzak
+ */
+public abstract class Selector implements Serializable
+{
+ private static final long serialVersionUID = 8851522639722586279L;
+
+ /**
+ * 1 Year, in seconds
+ */
+ public static final int DEFAULT_MAX_AGE = 31536000;
+
+ /**
+ * Is the cookie enabled
+ */
+ private boolean cookieEnabled;
+
+ /**
+ * The maximum age of the cookie
+ */
+ private int cookieMaxAge = DEFAULT_MAX_AGE;
+
+ /**
+ * The path of the cookie
+ */
+ private String cookiePath= "/";
+
+ /**
+ * Is the cookie enabled?
+ *
+ * @return false by default
+ */
+ public boolean isCookieEnabled()
+ {
+ return cookieEnabled;
+ }
+
+ /**
+ * Sets the enabled status of the cookie
+ *
+ * @param cookieEnabled
+ */
+ public void setCookieEnabled(boolean cookieEnabled)
+ {
+ this.cookieEnabled = cookieEnabled;
+ }
+
+ /**
+ * The max age of the cookie
+ * @return 1 year by default
+ */
+ public int getCookieMaxAge()
+ {
+ return cookieMaxAge;
+ }
+
+ /**
+ * Sets the maximum age of the cookie
+ *
+ * @param cookieMaxAge The maximum age of the cookie, in seconds
+ */
+ public void setCookieMaxAge(int cookieMaxAge)
+ {
+ this.cookieMaxAge = cookieMaxAge;
+ }
+
+ /**
+ * Returns the path of the cookie.
+ *
+ * @return String The cookie path
+ */
+ public String getCookiePath()
+ {
+ return cookiePath;
+ }
+
+ /**
+ * Sets the path of the cookie.
+ *
+ * @param cookiePath The cookie path
+ */
+ public void setCookiePath(String cookiePath)
+ {
+ this.cookiePath = cookiePath;
+ }
+
+ /**
+ * Override to define the cookie name
+ */
+ protected abstract String getCookieName();
+
+ /**
+ * Get the value of the cookie, if this selector is enabled
+ *
+ * @return String The value of the cookie if this selector is enabled, otherwise null.
+ */
+ protected String getCookieValueIfEnabled()
+ {
+ return isCookieEnabled() ? getCookieValue() : null;
+ }
+
+ /**
+ * Returns the Cookie instance.
+ *
+ * @return Cookie The cookie instance.
+ */
+ protected abstract Cookie getCookie();
+
+ /**
+ * Returns the cookie value.
+ *
+ * @return String The current value of the cookie.
+ */
+ protected String getCookieValue()
+ {
+ Cookie cookie = getCookie();
+ return cookie == null ? null : cookie.getValue();
+ }
+
+ /**
+ * Clears the cookie value.
+ */
+ protected abstract void clearCookieValue();
+
+ /**
+ * Sets the cookie value.
+ */
+ protected abstract void setCookieValueIfEnabled(String value);
+}
\ No newline at end of file
15 years, 6 months
Seam SVN: r10875 - modules/trunk/security/src/main/java/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 20:18:36 -0400 (Mon, 11 May 2009)
New Revision: 10875
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
Log:
uncomment enabled property
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java 2009-05-12 00:05:21 UTC (rev 10874)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java 2009-05-12 00:18:36 UTC (rev 10875)
@@ -116,9 +116,9 @@
private TokenSelector tokenSelector;
private TokenStore tokenStore;
-
+ */
private boolean enabled;
-
+/*
private int cookieMaxAge = Selector.DEFAULT_MAX_AGE;
private boolean autoLoggedIn;
@@ -141,7 +141,7 @@
public void setMode(Mode mode)
{
this.mode = mode;
- }
+ }*/
public boolean isEnabled()
{
@@ -154,20 +154,20 @@
{
this.enabled = enabled;
// selector is null during component initialization (setup handled in @Create method)
- if (usernameSelector != null && mode.equals(Mode.usernameOnly))
- {
- usernameSelector.setCookieEnabled(enabled);
- usernameSelector.setDirty();
- }
+// if (usernameSelector != null && mode.equals(Mode.usernameOnly))
+// {
+// usernameSelector.setCookieEnabled(enabled);
+// usernameSelector.setDirty();
+// }
// selector is null during component initialization (setup handled in @Create method)
- else if (tokenSelector != null && mode.equals(Mode.autoLogin))
- {
- tokenSelector.setCookieEnabled(enabled);
- tokenSelector.setDirty();
- }
+// else if (tokenSelector != null && mode.equals(Mode.autoLogin))
+// {
+// tokenSelector.setCookieEnabled(enabled);
+// tokenSelector.setDirty();
+// }
}
}
-
+/*
public int getCookieMaxAge() {
return cookieMaxAge;
}
15 years, 6 months
Seam SVN: r10873 - in examples/trunk/seamspace: war/src/main/webapp and 1 other directory.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 19:57:04 -0400 (Mon, 11 May 2009)
New Revision: 10873
Modified:
examples/trunk/seamspace/ejb-jar/pom.xml
examples/trunk/seamspace/war/src/main/webapp/home.xhtml
examples/trunk/seamspace/war/src/main/webapp/template.xhtml
Log:
fix home page
Modified: examples/trunk/seamspace/ejb-jar/pom.xml
===================================================================
--- examples/trunk/seamspace/ejb-jar/pom.xml 2009-05-11 23:08:36 UTC (rev 10872)
+++ examples/trunk/seamspace/ejb-jar/pom.xml 2009-05-11 23:57:04 UTC (rev 10873)
@@ -99,6 +99,12 @@
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-webbeans-bridge</artifactId> <!-- assumes use of Web Beans RI -->
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>${seam.groupId}</groupId>
Modified: examples/trunk/seamspace/war/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/seamspace/war/src/main/webapp/home.xhtml 2009-05-11 23:08:36 UTC (rev 10872)
+++ examples/trunk/seamspace/war/src/main/webapp/home.xhtml 2009-05-11 23:57:04 UTC (rev 10873)
@@ -53,7 +53,7 @@
<div class="loginRow">
<h:outputLabel for="rememberMe" value="Remember me" styleClass="loginLabel"/>
- <h:selectBooleanCheckbox id="rememberMe" value="#{identity.rememberMe}"/>
+ <h:selectBooleanCheckbox id="rememberMe" value="#{rememberMe.enabled}"/>
</div>
<div class="buttons">
Modified: examples/trunk/seamspace/war/src/main/webapp/template.xhtml
===================================================================
--- examples/trunk/seamspace/war/src/main/webapp/template.xhtml 2009-05-11 23:08:36 UTC (rev 10872)
+++ examples/trunk/seamspace/war/src/main/webapp/template.xhtml 2009-05-11 23:57:04 UTC (rev 10873)
@@ -26,12 +26,12 @@
<h:outputText styleClass="divider" value=" | "/>
</s:fragment>
- <s:fragment rendered="#{s:hasRole('admin')}">
+ <s:fragment rendered="#{identity.hasRole('admin')}">
<s:link id="security" view="/security.xhtml" value="Security" propagation="none"/>
<h:outputText styleClass="divider" value=" | "/>
</s:fragment>
- <s:link id="logout" action="#{identity.logout}" value="Log out" rendered="#{identity.loggedIn}"/>
+ <s:link id="logout" action="#{identity.logout()}" value="Log out" rendered="#{identity.loggedIn}"/>
<h:outputLink id="login" value="home.seam" rendered="#{not identity.loggedIn}">Log in</h:outputLink>
</div>
<br style="clear:both"/>
15 years, 6 months
Seam SVN: r10872 - modules/trunk/drools.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 19:08:36 -0400 (Mon, 11 May 2009)
New Revision: 10872
Modified:
modules/trunk/drools/pom.xml
Log:
clean up pom
Modified: modules/trunk/drools/pom.xml
===================================================================
--- modules/trunk/drools/pom.xml 2009-05-11 22:44:45 UTC (rev 10871)
+++ modules/trunk/drools/pom.xml 2009-05-11 23:08:36 UTC (rev 10872)
@@ -1,14 +1,14 @@
<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>seam-parent</artifactId>
<groupId>org.jboss.seam</groupId>
<version>3.0.0-SNAPSHOT</version>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.seam</groupId>
<artifactId>seam-drools</artifactId>
<packaging>jar</packaging>
<version>3.0.0-SNAPSHOT</version>
@@ -28,15 +28,8 @@
<scope>provided</scope>
</dependency>
- <!--
<dependency>
<groupId>${seam.groupId}</groupId>
- <artifactId>seam-bpm</artifactId>
- </dependency>
- -->
-
- <dependency>
- <groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
@@ -57,13 +50,6 @@
<scope>provided</scope>
</dependency>
- <!--
- <dependency>
- <groupId>org.jbpm</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- </dependency>
- -->
-
</dependencies>
</project>
15 years, 6 months
Seam SVN: r10871 - modules/trunk/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 18:44:45 -0400 (Mon, 11 May 2009)
New Revision: 10871
Modified:
modules/trunk/security/pom.xml
Log:
clean up security pom
Modified: modules/trunk/security/pom.xml
===================================================================
--- modules/trunk/security/pom.xml 2009-05-11 22:38:38 UTC (rev 10870)
+++ modules/trunk/security/pom.xml 2009-05-11 22:44:45 UTC (rev 10871)
@@ -1,14 +1,14 @@
<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>seam-parent</artifactId>
<groupId>org.jboss.seam</groupId>
<version>3.0.0-SNAPSHOT</version>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.seam</groupId>
<artifactId>seam-security</artifactId>
<packaging>jar</packaging>
<version>3.0.0-SNAPSHOT</version>
15 years, 6 months
Seam SVN: r10870 - modules/trunk/webbeans-bridge.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-05-11 18:38:38 -0400 (Mon, 11 May 2009)
New Revision: 10870
Modified:
modules/trunk/webbeans-bridge/pom.xml
Log:
add missing dependency
Modified: modules/trunk/webbeans-bridge/pom.xml
===================================================================
--- modules/trunk/webbeans-bridge/pom.xml 2009-05-11 21:46:44 UTC (rev 10869)
+++ modules/trunk/webbeans-bridge/pom.xml 2009-05-11 22:38:38 UTC (rev 10870)
@@ -51,6 +51,11 @@
<artifactId>webbeans-core</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
</dependencies>
15 years, 6 months
Seam SVN: r10869 - examples/trunk.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 17:46:44 -0400 (Mon, 11 May 2009)
New Revision: 10869
Modified:
examples/trunk/pom.xml
Log:
use jsr-250 if compiling with jdk5
Modified: examples/trunk/pom.xml
===================================================================
--- examples/trunk/pom.xml 2009-05-11 21:46:16 UTC (rev 10868)
+++ examples/trunk/pom.xml 2009-05-11 21:46:44 UTC (rev 10869)
@@ -164,6 +164,24 @@
</plugins>
</pluginManagement>
</build>
+
+ <profiles>
+
+ <profile>
+ <id>jdk5</id>
+ <activation>
+ <jdk>1.5</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ </profiles>
<ciManagement>
<system>Hudson</system>
15 years, 6 months
Seam SVN: r10868 - examples/trunk/servlet-booking.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 17:46:16 -0400 (Mon, 11 May 2009)
New Revision: 10868
Modified:
examples/trunk/servlet-booking/pom.xml
Log:
reorg
add JCDI bridge
update maven-cli-plugin aliases
Modified: examples/trunk/servlet-booking/pom.xml
===================================================================
--- examples/trunk/servlet-booking/pom.xml 2009-05-11 21:44:16 UTC (rev 10867)
+++ examples/trunk/servlet-booking/pom.xml 2009-05-11 21:46:16 UTC (rev 10868)
@@ -13,8 +13,94 @@
<artifactId>seam-servlet-booking</artifactId>
<packaging>war</packaging>
<name>Seam Booking Example (Servlet)</name>
- <description>The Seam booking example for deployment to a servlet container</description>
+ <description>The Seam booking example for deployment to a servlet environment</description>
+ <properties>
+ <jetty.http.port>9090</jetty.http.port>
+ <jetty.stop.port>9091</jetty.stop.port>
+ <jetty.debug.port>9190</jetty.debug.port>
+ <jetty.daemon>true</jetty.daemon>
+ <tomcat.http.port>8080</tomcat.http.port>
+ <embedded-tomcat.http.port>9090</embedded-tomcat.http.port>
+ <embedded-tomcat.debug.port>9190</embedded-tomcat.debug.port>
+ <webapp.directory>src/main/webapp</webapp.directory>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- why is seam-faces forcing this requirement? -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-webbeans-bridge</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-core</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <scope>provided</scope> <!-- assumes the use of Web Beans RI -->
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans.servlet</groupId>
+ <artifactId>webbeans-servlet</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
<build>
<defaultGoal>package</defaultGoal>
<finalName>${project.artifactId}</finalName>
@@ -41,7 +127,7 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <!-- don't stage or package files added to src/main/webapp by war:inplace -->
+ <!-- don't stage or package files added to ${webapp.directory} by war:inplace -->
<warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
</configuration>
</plugin>
@@ -72,6 +158,9 @@
<maxIdleTime>3600000</maxIdleTime>
</connector>
</connectors>
+ <daemon>${jetty.daemon}</daemon>
+ <stopPort>${jetty.stop.port}</stopPort>
+ <stopKey>HASTA_LA_VISTA</stopKey>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/${project.build.finalName}</contextPath>
@@ -83,57 +172,65 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.twdata.maven</groupId>
+ <artifactId>maven-cli-plugin</artifactId>
+ <version>0.6.3.CR3</version>
+ <configuration>
+ <!-- commands are for cli:execute -->
+ <commands>
+ </commands>
+ <prompt>${project.artifactId}</prompt>
+ <!-- userAliases are for cli:execute-phase -->
+ <userAliases>
+ <runjetty>compile org.apache.maven.plugins:maven-war-plugin:inplace org.mortbay.jetty:maven-jetty-plugin:run</runjetty>
+ <stopjetty>org.mortbay.jetty:maven-jetty-plugin:stop -o</stopjetty>
+ <runtomcat>compile org.apache.maven.plugins:maven-war-plugin:inplace org.codehaus.mojo:tomcat-maven-plugin:run</runtomcat>
+ <explode>compile org.apache.maven.plugins:maven-war-plugin:inplace -o</explode>
+ <restart>org.apache.maven.plugins:maven-antrun-plugin:run -Prestart-embedded</restart>
+ <!--<restart>validate -Prestart-embedded -o</restart>-->
+ <profiles>org.apache.maven.plugins:maven-help-plugin:active-profiles -o</profiles>
+ <pom>org.apache.maven.plugins:maven-help-plugin:effective-pom -o</pom>
+ </userAliases>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
- <properties>
- <jetty.http.port>9090</jetty.http.port>
- <jetty.debug.port>9190</jetty.debug.port>
- <tomcat.http.port>8080</tomcat.http.port>
- <embedded-tomcat.http.port>9090</embedded-tomcat.http.port>
- <embedded-tomcat.debug.port>9190</embedded-tomcat.debug.port>
- <webapp.directory>src/main/webapp</webapp.directory>
- </properties>
+ <profiles>
+ <profile>
+ <id>restart-embedded</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <configuration>
+ <tasks>
+ <touch file="${webapp.directory}/WEB-INF/web.xml"/>
+ </tasks>
+ </configuration>
+ <!-- Hooking an execution to a phase is more correct, but slower -->
+ <!--
+ <executions>
+ <execution>
+ <id>touch-web-inf</id>
+ <phase>validate</phase>
+ <configuration>
+ <tasks>
+ <touch file="${webapp.directory}/WEB-INF/web.xml"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ -->
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
- <dependencies>
-
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- <classifier>jdk15</classifier>
- </dependency>
-
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>2.0.0-PR2_1</version>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <scope>runtime</scope>
- <version>2.0.0-PR2_1</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans.servlet</groupId>
- <artifactId>webbeans-servlet</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- </dependencies>
-
</project>
15 years, 6 months
Seam SVN: r10867 - in examples/trunk/servlet-permalink/src: test and 8 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-05-11 17:44:16 -0400 (Mon, 11 May 2009)
New Revision: 10867
Added:
examples/trunk/servlet-permalink/src/test/
examples/trunk/servlet-permalink/src/test/java/
examples/trunk/servlet-permalink/src/test/java/org/
examples/trunk/servlet-permalink/src/test/java/org/jboss/
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToCategoryPage.java
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToHomePage.java
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/AbstractScenario.java
examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/FacesTesterHolder.java
examples/trunk/servlet-permalink/src/test/resources/
examples/trunk/servlet-permalink/src/test/resources/unit-test-suite.xml
Log:
experimental use of facestester
Added: examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToCategoryPage.java
===================================================================
--- examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToCategoryPage.java (rev 0)
+++ examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToCategoryPage.java 2009-05-11 21:44:16 UTC (rev 10867)
@@ -0,0 +1,37 @@
+package org.jboss.seam.examples.permalink;
+
+import static org.testng.Assert.*;
+
+import java.util.List;
+
+import org.jboss.seam.test.AbstractScenario;
+import org.testng.annotations.Test;
+
+/**
+ * @author Dan Allen
+ */
+public class WhenNavigatingToCategoryPage extends AbstractScenario
+{
+ private static final String CATEGORY_PAGE = "/category.xhtml";
+
+ @Test(groups = {"integration", "scenario"})
+ public void shouldSetCategoryFromViewParameter() throws Exception
+ {
+ tester.requestPage(CATEGORY_PAGE + "?name=General");
+ String category = getValue("blog.category", String.class);
+ assertEquals(category, "General");
+ }
+
+ @Test(groups = {"integration", "scenario"})
+ public void shouldDisplayEntriesInCategory() throws Exception
+ {
+ tester.requestPage(CATEGORY_PAGE + "?name=JSF 2");
+ List<BlogEntry> entriesForPage = getValue("blog.entriesForPage", List.class);
+ assertNotNull(entriesForPage);
+ assertEquals(entriesForPage.size(), 3);
+ for (BlogEntry entry : entriesForPage)
+ {
+ assertEquals(entry.getCategory(), "JSF 2");
+ }
+ }
+}
Added: examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToHomePage.java
===================================================================
--- examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToHomePage.java (rev 0)
+++ examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/examples/permalink/WhenNavigatingToHomePage.java 2009-05-11 21:44:16 UTC (rev 10867)
@@ -0,0 +1,55 @@
+package org.jboss.seam.examples.permalink;
+
+import static org.testng.Assert.*;
+
+import com.steeplesoft.jsf.facestester.FacesComponent;
+import com.steeplesoft.jsf.facestester.FacesPage;
+import java.util.List;
+import javax.faces.component.UICommand;
+
+import org.jboss.seam.test.AbstractScenario;
+import org.testng.annotations.Test;
+
+/**
+ * @author Dan Allen
+ */
+public class WhenNavigatingToHomePage extends AbstractScenario
+{
+ private static final String HOME_PAGE = "/home.xhtml";
+
+ @Test(groups = {"integration", "scenario"})
+ public void shouldLoadBlogEntries() throws Exception
+ {
+ tester.requestPage(HOME_PAGE);
+ List<BlogEntry> entriesForPage = getValue("blog.entriesForPage", List.class);
+ assertNotNull(entriesForPage);
+ assertEquals(entriesForPage.size(), 3);
+ }
+
+ @Test(groups = {"integration", "scenario"})
+ public void shouldHaveLinksDisabledToFirstAndPreviousPage() throws Exception
+ {
+ FacesPage homePage = tester.requestPage(HOME_PAGE);
+ FacesComponent first = homePage.getComponentWithId("first");
+ assertEquals(first.getValueAsString(), "First Page");
+ assertTrue(Boolean.valueOf(String.valueOf(first.getWrappedComponent().getAttributes().get("disabled"))));
+ FacesComponent previous = homePage.getComponentWithId("previous");
+ assertEquals(previous.getValueAsString(), "Newer Entries");
+ assertTrue(Boolean.valueOf(String.valueOf(previous.getWrappedComponent().getAttributes().get("disabled"))));
+ }
+
+ @Test
+ public void shouldDisplaySearchForm() throws Exception
+ {
+ FacesPage homePage = tester.requestPage(HOME_PAGE);
+ FacesComponent searchForm = homePage.getComponentWithId("search");
+ assertTrue(searchForm.isRendered());
+ FacesComponent queryInput = homePage.getComponentWithId("search:q");
+ assertEquals(queryInput.getWrappedComponent().getClientId(), "q", "The prependId attribute on form should be false and the parent id not prepended to the child id");
+ assertEquals(queryInput.getValueAsString(), null);
+ FacesComponent searchButton = homePage.getComponentWithId("search:s");
+ assertEquals(searchButton.getWrappedComponent().getClientId(), "s", "The prependId attribute on form should be false and the parent id not prepended to the child id");
+ assertTrue(searchButton.getWrappedComponent() instanceof UICommand);
+ assertEquals(((UICommand) searchButton.getWrappedComponent()).getActionExpression().getExpressionString(), "#{blog.search}");
+ }
+}
Added: examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/AbstractScenario.java
===================================================================
--- examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/AbstractScenario.java (rev 0)
+++ examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/AbstractScenario.java 2009-05-11 21:44:16 UTC (rev 10867)
@@ -0,0 +1,78 @@
+package org.jboss.seam.test;
+
+import com.steeplesoft.jsf.facestester.FacesTester;
+import javax.el.ELContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import org.jboss.webbeans.context.RequestContext;
+import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.environment.servlet.Listener;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+
+/**
+ * A base class for scenarios that execute JSF pages
+ * in a JCDI environment.
+ *
+ * TODO move me to a Seam module (perhaps the test module)
+ *
+ * @author Dan Allen
+ */
+public class AbstractScenario
+{
+ protected FacesTester tester;
+
+ protected Listener wbListener;
+
+ @AfterClass(alwaysRun = true)
+ public void afterClass() throws Exception
+ {
+ ServletContext sc = (ServletContext) tester.getFacesContext().getExternalContext().getContext();
+ wbListener.contextDestroyed(new ServletContextEvent(sc));
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void afterMethod()
+ {
+ SessionContext.instance().destroy();
+ SessionContext.instance().setActive(false);
+ RequestContext.instance().destroy();
+ RequestContext.instance().setActive(false);
+ }
+
+ @BeforeClass
+ public void beforeClass() throws Exception
+ {
+ tester = FacesTesterHolder.instance();
+ ServletContext sc = (ServletContext) tester.getFacesContext().getExternalContext().getContext();
+ wbListener = new Listener();
+ wbListener.contextInitialized(new ServletContextEvent(sc));
+ }
+
+ @BeforeMethod
+ public void beforeMethod()
+ {
+ BeanStore reqBS = new ConcurrentHashMapBeanStore();
+ RequestContext.instance().setBeanStore(reqBS);
+ RequestContext.instance().setActive(true);
+ BeanStore sessBS = new ConcurrentHashMapBeanStore();
+ SessionContext.instance().setBeanStore(sessBS);
+ SessionContext.instance().setActive(true);
+ }
+
+ protected <T> T getValue(String expression, Class<T> expectedClass)
+ {
+ if (!expression.startsWith("#{"))
+ {
+ expression = "#{" + expression + "}";
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ return (T) context.getApplication().getExpressionFactory().createValueExpression(elContext, expression, expectedClass).getValue(elContext);
+ }
+}
Added: examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/FacesTesterHolder.java
===================================================================
--- examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/FacesTesterHolder.java (rev 0)
+++ examples/trunk/servlet-permalink/src/test/java/org/jboss/seam/test/FacesTesterHolder.java 2009-05-11 21:44:16 UTC (rev 10867)
@@ -0,0 +1,21 @@
+package org.jboss.seam.test;
+
+import com.steeplesoft.jsf.facestester.FacesTester;
+
+/**
+ * @author Dan Allen
+ */
+public class FacesTesterHolder
+{
+ private static FacesTester tester;
+
+ public static synchronized FacesTester instance()
+ {
+ if (tester == null)
+ {
+ tester = new FacesTester();
+ }
+
+ return tester;
+ }
+}
Added: examples/trunk/servlet-permalink/src/test/resources/unit-test-suite.xml
===================================================================
--- examples/trunk/servlet-permalink/src/test/resources/unit-test-suite.xml (rev 0)
+++ examples/trunk/servlet-permalink/src/test/resources/unit-test-suite.xml 2009-05-11 21:44:16 UTC (rev 10867)
@@ -0,0 +1,8 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="Permalink Servlet Example Unit Tests" verbose="1">
+ <test name="Permalink Servlet Example Unit Tests">
+ <packages>
+ <package name="org.jboss.seam.examples.permalink"/>
+ </packages>
+ </test>
+</suite>
15 years, 6 months