Seam SVN: r9688 - trunk/examples/spring/resources/META-INF.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 17:41:36 -0500 (Mon, 01 Dec 2008)
New Revision: 9688
Modified:
trunk/examples/spring/resources/META-INF/persistence.xml
Log:
note about vendor-specific JDBC connection properties
Modified: trunk/examples/spring/resources/META-INF/persistence.xml
===================================================================
--- trunk/examples/spring/resources/META-INF/persistence.xml 2008-12-01 22:39:38 UTC (rev 9687)
+++ trunk/examples/spring/resources/META-INF/persistence.xml 2008-12-01 22:41:36 UTC (rev 9688)
@@ -11,11 +11,15 @@
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/><!--
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+
+ <!-- Enable these vendor-specific properties to setup JDBC connection here rather than in Spring configuration -->
+ <!--
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:defaultDB"/>
- --></properties>
+ -->
+ </properties>
</persistence-unit>
</persistence>
16 years
Seam SVN: r9687 - trunk/examples/spring/resources/META-INF.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 17:39:38 -0500 (Mon, 01 Dec 2008)
New Revision: 9687
Modified:
trunk/examples/spring/resources/META-INF/persistence.xml
Log:
whitespace
Modified: trunk/examples/spring/resources/META-INF/persistence.xml
===================================================================
--- trunk/examples/spring/resources/META-INF/persistence.xml 2008-12-01 22:04:14 UTC (rev 9686)
+++ trunk/examples/spring/resources/META-INF/persistence.xml 2008-12-01 22:39:38 UTC (rev 9687)
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
- version="1.0">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
<persistence-unit name="bookingDatabase" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/><!--
- <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
- <property name="hibernate.connection.username" value="sa"/>
- <property name="hibernate.connection.password" value=""/>
- <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:defaultDB"/>
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/><!--
+ <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
+ <property name="hibernate.connection.username" value="sa"/>
+ <property name="hibernate.connection.password" value=""/>
+ <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:defaultDB"/>
--></properties>
</persistence-unit>
</persistence>
16 years
Seam SVN: r9686 - in trunk/seam-gen: icefaces/build-scripts and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 17:04:14 -0500 (Mon, 01 Dec 2008)
New Revision: 9686
Modified:
trunk/seam-gen/build-scripts/build-war.xml
trunk/seam-gen/build-scripts/build.xml
trunk/seam-gen/icefaces/build-scripts/build-war.xml
trunk/seam-gen/icefaces/build-scripts/build.xml
Log:
JBSEAM-3751
also add the stage target to icefaces EAR/WAR builds and RichFaces WAR builds
fix some whitespace
Modified: trunk/seam-gen/build-scripts/build-war.xml
===================================================================
--- trunk/seam-gen/build-scripts/build-war.xml 2008-12-01 21:49:27 UTC (rev 9685)
+++ trunk/seam-gen/build-scripts/build-war.xml 2008-12-01 22:04:14 UTC (rev 9686)
@@ -28,6 +28,12 @@
<property name="javac.debug" value="true" />
<property name="javac.deprecation" value="false" />
<property name="debug" value="false" />
+
+ <!--Properties for validating configuration files -->
+ <property name="validate.resources.dir" value="${basedir}/exploded-archives"/>
+ <property name="schema.dir" value="${basedir}/exploded-archives/schemas"/>
+ <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
+ <property name="schema.version" value="@schemaVersion@"/>
<fileset id="lib" dir="${lib.dir}">
<include name="*.jar" />
@@ -237,8 +243,10 @@
</copy>
</target>
+
+ <target name="stage" depends="war"/>
- <target name="archive" depends="war"
+ <target name="archive" depends="stage"
description="Package the WAR archive">
<jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
</target>
@@ -252,7 +260,7 @@
</copy>
</target>
- <target name="explode" depends="war,datasource"
+ <target name="explode" depends="stage,datasource"
description="Deploy the exploded archive">
<fail unless="jboss.home">jboss.home not set</fail>
@@ -426,5 +434,16 @@
</javadoc>
</target>
+
+ <target name="validate" depends="stage" description="Validate the XML configuration files">
+ <mkdir dir="${schema.dir}"/>
+ <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
+ <patternset>
+ <include name="org/jboss/seam/*.xsd"/>
+ <include name="org/jboss/seam/*.dtd"/>
+ </patternset>
+ </unjar>
+ <ant antfile="validate.xml" target="validateConfiguration"/>
+ </target>
</project>
Modified: trunk/seam-gen/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/build-scripts/build.xml 2008-12-01 21:49:27 UTC (rev 9685)
+++ trunk/seam-gen/build-scripts/build.xml 2008-12-01 22:04:14 UTC (rev 9686)
@@ -107,9 +107,9 @@
<target name="groovy.copy" if="groovy.dynamic">
<copy todir="${jar.dir}">
- <fileset dir="${src.action.dir}">
- <include name="**/*.groovy"/>
- </fileset>
+ <fileset dir="${src.action.dir}">
+ <include name="**/*.groovy"/>
+ </fileset>
</copy>
</target>
@@ -433,7 +433,10 @@
</javadoc>
</target>
- <target name="validateConfiguration" depends="stage" description="Validate the xml configuration files">
+ <!-- deprecated -->
+ <target name="validateConfiguration" depends="validate"/>
+
+ <target name="validate" depends="stage" description="Validate the XML configuration files">
<mkdir dir="${schema.dir}"/>
<unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
<patternset>
Modified: trunk/seam-gen/icefaces/build-scripts/build-war.xml
===================================================================
--- trunk/seam-gen/icefaces/build-scripts/build-war.xml 2008-12-01 21:49:27 UTC (rev 9685)
+++ trunk/seam-gen/icefaces/build-scripts/build-war.xml 2008-12-01 22:04:14 UTC (rev 9686)
@@ -28,6 +28,12 @@
<property name="javac.debug" value="true" />
<property name="javac.deprecation" value="false" />
<property name="debug" value="false" />
+
+ <!--Properties for validating configuration files -->
+ <property name="validate.resources.dir" value="${basedir}/exploded-archives"/>
+ <property name="schema.dir" value="${basedir}/exploded-archives/schemas"/>
+ <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
+ <property name="schema.version" value="@schemaVersion@"/>
<fileset id="lib" dir="${lib.dir}">
<include name="*.jar" />
@@ -226,8 +232,10 @@
</copy>
</target>
+
+ <target name="stage" depends="war"/>
- <target name="archive" depends="war"
+ <target name="archive" depends="stage"
description="Package the WAR archive">
<jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
</target>
@@ -241,7 +249,7 @@
</copy>
</target>
- <target name="explode" depends="war,datasource"
+ <target name="explode" depends="stage,datasource"
description="Deploy the exploded archive">
<fail unless="jboss.home">jboss.home not set</fail>
@@ -415,6 +423,17 @@
</javadoc>
</target>
+
+ <target name="validate" depends="stage" description="Validate the XML configuration files">
+ <mkdir dir="${schema.dir}"/>
+ <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
+ <patternset>
+ <include name="org/jboss/seam/*.xsd"/>
+ <include name="org/jboss/seam/*.dtd"/>
+ </patternset>
+ </unjar>
+ <ant antfile="validate.xml" target="validateConfiguration"/>
+ </target>
<target name="freshen" description="grab fresh icefaces jars">
<copy todir="${lib.dir}">
Modified: trunk/seam-gen/icefaces/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/icefaces/build-scripts/build.xml 2008-12-01 21:49:27 UTC (rev 9685)
+++ trunk/seam-gen/icefaces/build-scripts/build.xml 2008-12-01 22:04:14 UTC (rev 9686)
@@ -16,8 +16,8 @@
<property name="lib.dir" value="lib"/>
<property name="endorsed.dir" value="${lib.dir}/endorsed"/>
<property name="ear.dir" value="exploded-archives/${project.name}.ear"/>
- <property name="jar.dir" value="exploded-archives/${project.name}.jar"/>
- <property name="war.dir" value="exploded-archives/${project.name}.war"/>
+ <property name="jar.dir" value="${ear.dir}/${project.name}.jar"/>
+ <property name="war.dir" value="${ear.dir}/${project.name}.war"/>
<property name="test.dir" value="test-build"/>
<property name="bootstrap.dir" value="${basedir}/bootstrap"/>
<property name="jboss.domain" value="default"/>
@@ -185,12 +185,12 @@
<include name="classes/**/*.class"/>
</fileset>
</copy>
- <copy todir="${war.dir}/WEB-INF/lib">
- <fileset dir="${lib.dir}">
- <includesfile name="deployed-jars-war.list"/>
- <exclude name="jboss-seam-gen.jar"/>
- </fileset>
- </copy>
+ <copy todir="${war.dir}/WEB-INF/lib">
+ <fileset dir="${lib.dir}">
+ <includesfile name="deployed-jars-war.list"/>
+ <exclude name="jboss-seam-gen.jar"/>
+ </fileset>
+ </copy>
<copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${basedir}/resources">
<include name="messages*.properties"/>
@@ -224,12 +224,17 @@
</copy>
</target>
- <target name="archive" depends="jar,war,ear"
+ <target name="stage" depends="jar,war,ear"/>
+
+ <target name="archive" depends="stage"
description="Package the archives">
<jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/>
<jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
<jar jarfile="${dist.dir}/${project.name}.ear">
- <fileset dir="${ear.dir}"/>
+ <fileset dir="${ear.dir}">
+ <exclude name="${project.name}.jar/**"/>
+ <exclude name="${project.name}.war/**"/>
+ </fileset>
<fileset dir="${dist.dir}">
<include name="${project.name}.jar"/>
<include name="${project.name}.war"/>
@@ -246,19 +251,10 @@
</copy>
</target>
- <target name="explode" depends="jar,war,ear,datasource"
- description="Deploy the exploded archive">
+ <target name="explode" depends="stage,datasource"
+ description="Deploy the exploded archive">
<fail unless="jboss.home">jboss.home not set</fail>
- <mkdir dir="${jar.deploy.dir}"/>
- <mkdir dir="${war.deploy.dir}"/>
-
- <copy todir="${jar.deploy.dir}">
- <fileset dir="${jar.dir}"/>
- </copy>
- <copy todir="${war.deploy.dir}">
- <fileset dir="${war.dir}"/>
- </copy>
<copy todir="${ear.deploy.dir}">
<fileset dir="${ear.dir}"/>
</copy>
@@ -323,16 +319,16 @@
</target>
<target name="compiletest" depends="groovy.compiletest" unless="eclipse.running" description="Compile the Java source code for the tests">
- <mkdir dir="${test.dir}"/>
- <javac classpathref="build.classpath"
- destdir="${test.dir}"
- debug="${javac.debug}"
- deprecation="${javac.deprecation}"
- nowarn="on">
- <src path="${src.action.dir}"/>
- <src path="${src.model.dir}"/>
- <src path="${src.test.dir}"/>
- </javac>
+ <mkdir dir="${test.dir}"/>
+ <javac classpathref="build.classpath"
+ destdir="${test.dir}"
+ debug="${javac.debug}"
+ deprecation="${javac.deprecation}"
+ nowarn="on">
+ <src path="${src.action.dir}"/>
+ <src path="${src.model.dir}"/>
+ <src path="${src.test.dir}"/>
+ </javac>
</target>
<target name="groovy.compiletest" if="groovy.test.present" description="Compile the Groovy source code for the tests">
@@ -427,7 +423,10 @@
</javadoc>
</target>
- <target name="validateConfiguration" depends="war,ear,jar" description="Validate the xml configuration files">
+ <!-- deprecated -->
+ <target name="validateConfiguration" depends="validate"/>
+
+ <target name="validate" depends="stage" description="Validate the XML configuration files">
<mkdir dir="${schema.dir}"/>
<unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
<patternset>
16 years
Seam SVN: r9685 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 16:49:27 -0500 (Mon, 01 Dec 2008)
New Revision: 9685
Modified:
trunk/src/main/org/jboss/seam/pages-2.1.xsd
Log:
if-outcome can be a string or a value expression
Modified: trunk/src/main/org/jboss/seam/pages-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-12-01 21:41:20 UTC (rev 9684)
+++ trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-12-01 21:49:27 UTC (rev 9685)
@@ -245,7 +245,7 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.rule">
- <xs:attribute name="if-outcome" type="pages:value-expression" />
+ <xs:attribute name="if-outcome" type="pages:outcome-expression" />
<xs:attribute name="if" type="pages:boolean-value-expression" />
</xs:attributeGroup>
@@ -490,6 +490,10 @@
<xs:union memberTypes="pages:view-id pages:value-expression"></xs:union>
</xs:simpleType>
+ <xs:simpleType name="outcome-expression">
+ <xs:union memberTypes="pages:outcome pages:value-expression"></xs:union>
+ </xs:simpleType>
+
<xs:simpleType name="from-action-expression">
<xs:union memberTypes="pages:outcome pages:method-expression"></xs:union>
</xs:simpleType>
16 years
Seam SVN: r9684 - in trunk/src: main/org/jboss/seam/init and 3 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 16:41:20 -0500 (Mon, 01 Dec 2008)
New Revision: 9684
Added:
trunk/src/test/unit/org/jboss/seam/test/unit/ExpressionsTest.java
Modified:
trunk/src/main/org/jboss/seam/faces/FacesExpressions.java
trunk/src/main/org/jboss/seam/init/Initialization.java
trunk/src/main/org/jboss/seam/mock/MockExternalContext.java
trunk/src/main/org/jboss/seam/navigation/Param.java
trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
Log:
JBSEAM-3674
Modified: trunk/src/main/org/jboss/seam/faces/FacesExpressions.java
===================================================================
--- trunk/src/main/org/jboss/seam/faces/FacesExpressions.java 2008-12-01 21:40:20 UTC (rev 9683)
+++ trunk/src/main/org/jboss/seam/faces/FacesExpressions.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -33,15 +33,13 @@
@Override
public ELContext getELContext()
{
- FacesContext facesContext = FacesContext.getCurrentInstance();
- return facesContext == null || FacesLifecycle.getPhaseId() == null
- ? super.getELContext() : facesContext.getELContext();
+ return isFacesContextActive() ? FacesContext.getCurrentInstance().getELContext() : super.getELContext();
}
@Override
protected boolean isFacesContextActive()
{
- return FacesContext.getCurrentInstance()==null;
+ return FacesContext.getCurrentInstance() != null && FacesLifecycle.getPhaseId() != null;
}
}
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-12-01 21:40:20 UTC (rev 9683)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -45,6 +45,7 @@
import org.jboss.seam.bpm.Jbpm;
import org.jboss.seam.contexts.Context;
import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Init;
@@ -758,7 +759,6 @@
boolean changed = new TimestampCheckForwardingDeploymentStrategy()
{
-
@Override
protected DeploymentStrategy delegate()
{
@@ -806,7 +806,6 @@
final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
changed = new TimestampCheckForwardingDeploymentStrategy()
{
-
@Override
protected DeploymentStrategy delegate()
{
@@ -822,7 +821,10 @@
log.info("redeploying page descriptors...");
Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
if (pages != null) {
- pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
+ // application context is needed for creating expressions
+ Lifecycle.mockApplication();
+ pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
+ Lifecycle.unmockApplication();
}
ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
Modified: trunk/src/main/org/jboss/seam/mock/MockExternalContext.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/MockExternalContext.java 2008-12-01 21:40:20 UTC (rev 9683)
+++ trunk/src/main/org/jboss/seam/mock/MockExternalContext.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -80,6 +80,11 @@
this.request = request;
this.response = response;
}
+
+ public MockExternalContext(HttpServletRequest request)
+ {
+ this.request = request;
+ }
@Override
public void dispatch(String url) throws IOException
Modified: trunk/src/main/org/jboss/seam/navigation/Param.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Param.java 2008-12-01 21:40:20 UTC (rev 9683)
+++ trunk/src/main/org/jboss/seam/navigation/Param.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -63,6 +63,10 @@
else
{
Class<?> type = valueExpression.getType();
+ if (type==null)
+ {
+ return null;
+ }
return FacesContext.getCurrentInstance().getApplication().createConverter(type);
}
}
Added: trunk/src/test/unit/org/jboss/seam/test/unit/ExpressionsTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/ExpressionsTest.java (rev 0)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/ExpressionsTest.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -0,0 +1,132 @@
+package org.jboss.seam.test.unit;
+
+import static org.testng.Assert.assertEquals;
+
+import java.beans.FeatureDescriptor;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import javax.el.PropertyNotFoundException;
+import javax.faces.application.Application;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.contexts.FacesLifecycle;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.faces.FacesExpressions;
+import org.jboss.seam.mock.MockApplication;
+import org.jboss.seam.mock.MockExternalContext;
+import org.jboss.seam.mock.MockFacesContext;
+import org.jboss.seam.mock.MockHttpServletRequest;
+import org.jboss.seam.mock.MockHttpSession;
+import org.testng.annotations.Test;
+
+public class ExpressionsTest
+{
+ /**
+ * Validate that FacesExpressions reports that the FacesContext is activate and
+ * returns the Faces-aware EL context so that a Faces-specific expression can
+ * be resolved through Seam's built-in expression resolver.
+ * @jira JBSEAM-3674
+ */
+ @Test
+ public void testExpressionResolvedInFacesELContext()
+ {
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("foo", "bar");
+ FacesContext facesContext = setupFacesContextToAccessRequestParams(params);
+ String expr = "#{param.foo}";
+
+ // the control
+ assertEquals(facesContext.getApplication().evaluateExpressionGet(facesContext, expr, Object.class), "bar");
+
+ // the test
+ FacesLifecycle.setPhaseId(PhaseId.INVOKE_APPLICATION);
+ Expressions expressions = new FacesExpressions();
+ assert expressions.getELContext().getContext(FacesContext.class) != null;
+ assertEquals(expressions.createValueExpression(expr).getValue(), "bar");
+ }
+
+ protected FacesContext setupFacesContextToAccessRequestParams(Map<String, String> params)
+ {
+ MockHttpServletRequest request = new MockHttpServletRequest(new MockHttpSession());
+ if (params != null)
+ {
+ for (Map.Entry<String, String> param : params.entrySet())
+ {
+ request.getParameterMap().put(param.getKey(), new String[] { param.getValue() });
+ }
+ }
+ ExternalContext extContext = new MockExternalContext(request);
+ Application application = new MockApplication();
+ application.addELResolver(new ImplicitObjectELResolver());
+ FacesContext facesCtx = new MockFacesContext(extContext, application).setCurrent();
+ assert FacesContext.getCurrentInstance() != null;
+ return facesCtx;
+ }
+
+ /**
+ * This resolver resolves select implicit objects that are available to the EL during a Faces request.
+ * It must be implemented here since it is part of the JSF RI, not the API.
+ */
+ class ImplicitObjectELResolver extends ELResolver
+ {
+ private final String PARAM = "param";
+
+ private final String[] IMPLICIT_OBJECT_NAMES = new String[] { PARAM };
+
+ @Override
+ public Class<?> getCommonPropertyType(ELContext ctx, Object base)
+ {
+ return null;
+ }
+
+ @Override
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext ctx, Object base)
+ {
+ return null;
+ }
+
+ @Override
+ public Class<?> getType(ELContext ctx, Object base, Object prop)
+ {
+ return null;
+ }
+
+ @Override
+ public Object getValue(ELContext elCtx, Object base, Object prop)
+ {
+ if (base != null) return null;
+
+ if (prop == null) throw new PropertyNotFoundException("No such property " + prop);
+
+ int idx = Arrays.binarySearch(IMPLICIT_OBJECT_NAMES, prop);
+ if (idx < 0) return null;
+
+ FacesContext facesCtx = (FacesContext) elCtx.getContext(FacesContext.class);
+ ExternalContext extCtx = facesCtx.getExternalContext();
+
+ if (prop.equals(PARAM))
+ {
+ elCtx.setPropertyResolved(true);
+ return extCtx.getRequestParameterMap();
+ }
+
+ throw new IllegalStateException("Programming error: list of possible conditions is incomplete");
+ }
+
+ @Override
+ public boolean isReadOnly(ELContext ctx, Object base, Object prop)
+ {
+ return true;
+ }
+
+ @Override
+ public void setValue(ELContext ctx, Object base, Object prop, Object value) {}
+ }
+}
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java 2008-12-01 21:40:20 UTC (rev 9683)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java 2008-12-01 21:41:20 UTC (rev 9684)
@@ -1,17 +1,28 @@
package org.jboss.seam.test.unit;
+import java.util.HashMap;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.IntegerConverter;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
+import org.jboss.seam.contexts.Lifecycle;
+import org.jboss.seam.core.Expressions;
+import org.jboss.seam.jsf.SeamApplication;
import org.jboss.seam.mock.MockApplication;
import org.jboss.seam.mock.MockExternalContext;
import org.jboss.seam.mock.MockFacesContext;
import org.jboss.seam.navigation.Param;
import org.testng.annotations.Test;
+/**
+ * Verifies that page parameters are setup properly and report the correct information
+ * about validators and converters.
+ *
+ * @author Dan Allen
+ */
public class PageParamTest
{
@Test
@@ -19,31 +30,51 @@
{
String converterId = "javax.faces.Integer";
String converterClass = "javax.faces.convert.IntegerConverter";
- MockFacesContext facesContext = new MockFacesContext(new MockExternalContext(), new MockApplication());
- facesContext.setCurrent();
+ setupMockFacesContextWithSeamApplication();
Param param = new Param("param");
param.setConverterId(converterId);
assert param.getConverter() instanceof IntegerConverter : "expecting: " + converterClass + "; got: " + param.getConverter();
}
+ /**
+ * Verify that converter is null when the parameter value is a value expression and
+ * we are operating outside of a FacesContext.
+ * @jira JBSEAM-3674
+ */
@Test
+ public void testConverterIsNullForNonFacesValueExpression()
+ {
+ setupMockFacesContextWithSeamApplication();
+ Param param = new Param("param");
+ param.setValueExpression(Expressions.instance().createValueExpression("#{variable}"));
+ Lifecycle.beginApplication(new HashMap<String, Object>());
+ Lifecycle.mockApplication();
+ assert param.getConverter() == null;
+ Lifecycle.endApplication();
+ }
+
+ @Test
public void testGetValidatorById() throws ClassNotFoundException
{
String validatorId = "TestValidator";
String validatorClass= "org.jboss.seam.test.unit.PageParamTest$TestValidator";
- MockFacesContext facesContext = new MockFacesContext(new MockExternalContext(), new MockApplication());
- facesContext.setCurrent();
+ FacesContext facesContext = setupMockFacesContextWithSeamApplication();
facesContext.getApplication().addValidator(validatorId, validatorClass);
Param param = new Param("param");
param.setValidatorId(validatorId);
assert param.getValidator() instanceof TestValidator : "expecting: " + validatorClass + "; got: " + param.getValidator();
}
+ protected FacesContext setupMockFacesContextWithSeamApplication()
+ {
+ // MockApplication is wrapped with SeamApplication to validate the behavior Seam introduces
+ return new MockFacesContext(new MockExternalContext(), new SeamApplication(new MockApplication())).setCurrent();
+ }
+
public static class TestValidator implements Validator
{
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
}
-
}
}
16 years
Seam SVN: r9683 - trunk/src/main/org/jboss/seam/core.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 16:40:20 -0500 (Mon, 01 Dec 2008)
New Revision: 9683
Modified:
trunk/src/main/org/jboss/seam/core/Expressions.java
Log:
names of variables were backwards
Modified: trunk/src/main/org/jboss/seam/core/Expressions.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Expressions.java 2008-12-01 21:39:44 UTC (rev 9682)
+++ trunk/src/main/org/jboss/seam/core/Expressions.java 2008-12-01 21:40:20 UTC (rev 9683)
@@ -86,19 +86,19 @@
{
if ( isFacesContextActive() )
{
- if (seamValueExpression==null)
+ if (facesValueExpression==null)
{
- seamValueExpression = createExpression();
+ facesValueExpression = createExpression();
}
- return seamValueExpression;
+ return facesValueExpression;
}
else
{
- if (facesValueExpression==null)
+ if (seamValueExpression==null)
{
- facesValueExpression = createExpression();
+ seamValueExpression = createExpression();
}
- return facesValueExpression;
+ return seamValueExpression;
}
}
@@ -124,6 +124,7 @@
public Class<T> getType()
{
+ // QUESTION shouldn't we use the type provided in the constructor?
return (Class<T>) toUnifiedValueExpression().getType( getELContext() );
}
@@ -148,19 +149,19 @@
{
if ( isFacesContextActive() )
{
- if (seamMethodExpression==null)
+ if (facesMethodExpression==null)
{
- seamMethodExpression = createExpression();
+ facesMethodExpression = createExpression();
}
- return seamMethodExpression;
+ return facesMethodExpression;
}
else
{
- if (facesMethodExpression==null)
+ if (seamMethodExpression==null)
{
- facesMethodExpression = createExpression();
+ seamMethodExpression = createExpression();
}
- return facesMethodExpression;
+ return seamMethodExpression;
}
}
16 years
Seam SVN: r9682 - trunk/src/main/org/jboss/seam/contexts.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 16:39:44 -0500 (Mon, 01 Dec 2008)
New Revision: 9682
Modified:
trunk/src/main/org/jboss/seam/contexts/Lifecycle.java
Log:
better log message
Modified: trunk/src/main/org/jboss/seam/contexts/Lifecycle.java
===================================================================
--- trunk/src/main/org/jboss/seam/contexts/Lifecycle.java 2008-12-01 15:58:54 UTC (rev 9681)
+++ trunk/src/main/org/jboss/seam/contexts/Lifecycle.java 2008-12-01 21:39:44 UTC (rev 9682)
@@ -49,8 +49,8 @@
public static void endApplication()
{
- log.debug("Undeploying, destroying application context");
-
+ log.debug("Shutting down application and destroying contexts");
+
Context tempApplicationContext = new ApplicationContext( getApplication() );
Contexts.applicationContext.set(tempApplicationContext);
Contexts.destroy(tempApplicationContext);
16 years
Seam SVN: r9681 - trunk.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 10:58:54 -0500 (Mon, 01 Dec 2008)
New Revision: 9681
Modified:
trunk/build.xml
Log:
report current Ant version (this Ant version enforcement is a nightmare)
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-12-01 15:54:00 UTC (rev 9680)
+++ trunk/build.xml 2008-12-01 15:58:54 UTC (rev 9681)
@@ -6,7 +6,7 @@
<contains string="${ant.version}" substring="1.7.0"/>
</condition>
- <fail unless="compatible.ant">You must use Ant 1.7.0 to build Seam. Ant 1.7.1 has known bugs.</fail>
+ <fail unless="compatible.ant">You are using ${ant.version}. You must use Ant 1.7.0 to build Seam. Ant 1.7.1 has known bugs.</fail>
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="JBoss Seam" />
@@ -536,7 +536,7 @@
<ant dir="examples/messages" target="validateConfiguration" inheritall="false" />
<ant dir="examples/nestedbooking" target="validateConfiguration" inheritall="false" />
<ant dir="examples/numberguess" target="validateConfiguration" inheritall="false" />
- <ant dir="examples/quartz" target="validateConfiguration" inheritall="false" />
+ <!--<ant dir="examples/quartz" target="validateConfiguration" inheritall="false" />-->
<ant dir="examples/registration" target="validateConfiguration" inheritall="false" />
<ant dir="examples/remoting/chatroom" target="validateConfiguration" inheritall="false" />
<ant dir="examples/remoting/gwt" target="validateConfiguration" inheritall="false" />
@@ -545,7 +545,7 @@
<ant dir="examples/rss" target="validateConfiguration" inheritall="false" />
<ant dir="examples/seambay" target="validateConfiguration" inheritall="false" />
<ant dir="examples/seamdiscs" target="validateConfiguration" inheritall="false" />
- <ant dir="examples/seampay" target="validateConfiguration" inheritall="false" />
+ <!--<ant dir="examples/seampay" target="validateConfiguration" inheritall="false" />-->
<ant dir="examples/seamspace" target="validateConfiguration" inheritall="false" />
<ant dir="examples/todo" target="validateConfiguration" inheritall="false" />
<ant dir="examples/ui" target="validateConfiguration" inheritall="false" />
16 years
Seam SVN: r9680 - trunk/src/main/org/jboss/seam.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 10:54:00 -0500 (Mon, 01 Dec 2008)
New Revision: 9680
Modified:
trunk/src/main/org/jboss/seam/pages-2.1.xsd
Log:
oops, view-id should be value-expression, not method-expression
also, tighten value-expression and have restriction use boolean-value-expression
Modified: trunk/src/main/org/jboss/seam/pages-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-12-01 15:11:20 UTC (rev 9679)
+++ trunk/src/main/org/jboss/seam/pages-2.1.xsd 2008-12-01 15:54:00 UTC (rev 9680)
@@ -183,7 +183,7 @@
<xs:attribute name="execute" use="required" type="pages:method-expression" />
</xs:attributeGroup>
- <xs:element name="restrict" type="pages:value-expression">
+ <xs:element name="restrict" type="pages:boolean-value-expression">
<xs:annotation>
<xs:documentation>Security restrictions</xs:documentation>
</xs:annotation>
@@ -487,7 +487,7 @@
</xs:simpleType>
<xs:simpleType name="view-id-expression">
- <xs:union memberTypes="pages:view-id pages:method-expression"></xs:union>
+ <xs:union memberTypes="pages:view-id pages:value-expression"></xs:union>
</xs:simpleType>
<xs:simpleType name="from-action-expression">
@@ -620,7 +620,9 @@
</xs:simpleType>
<xs:simpleType name="value-expression">
- <xs:restriction base="xs:token"/>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="#\{.*\}"/>
+ </xs:restriction>
</xs:simpleType>
<xs:simpleType name="boolean-value-expression">
16 years
Seam SVN: r9679 - trunk/build.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-12-01 10:11:20 -0500 (Mon, 01 Dec 2008)
New Revision: 9679
Modified:
trunk/build/root.pom.xml
Log:
set commons-logging version to 1.1.1 which eliminates unnecessary dependencies/exclusions (no code change from 1.1)
Modified: trunk/build/root.pom.xml
===================================================================
--- trunk/build/root.pom.xml 2008-12-01 06:09:22 UTC (rev 9678)
+++ trunk/build/root.pom.xml 2008-12-01 15:11:20 UTC (rev 9679)
@@ -449,25 +449,7 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>logkit</groupId>
- <artifactId>logkit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
+ <version>1.1.1</version>
</dependency>
<dependency>
16 years