Author: julien(a)jboss.com
Date: 2007-02-26 13:02:56 -0500 (Mon, 26 Feb 2007)
New Revision: 6408
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/TestDynamicBean.java
Modified:
trunk/faces/build.xml
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
Log:
more testing of the EL stuff
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-26 17:41:06 UTC (rev 6407)
+++ trunk/faces/build.xml 2007-02-26 18:02:56 UTC (rev 6408)
@@ -227,6 +227,7 @@
<test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.AbstractBeanDecoratorTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.AbstractDynamicBeanTestCase"/>
<test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.SimpleDynamicBeanTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.DelegatingPropertyResolverTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-02-26
17:41:06 UTC (rev 6407)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -71,9 +71,9 @@
this.delegate = delegate;
}
- public Class getType(Object base, int index) throws EvaluationException,
PropertyNotFoundException
+ public DelegatingPropertyResolver()
{
- return delegate.getType(base, index);
+ this(null);
}
public Class getType(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
@@ -101,9 +101,27 @@
}
//
- return delegate.getType(base, property);
+ if (delegate != null)
+ {
+ return delegate.getType(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
}
+ public boolean isReadOnly(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
+ {
+ //
+ if (delegate != null)
+ {
+ return delegate.isReadOnly(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
public Object getValue(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
{
// See if the object can handle itself the property
@@ -129,7 +147,13 @@
}
//
- return delegate.getValue(base, property);
+ if (delegate != null)
+ {
+ return delegate.getValue(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
}
public void setValue(Object base, Object property, Object value) throws
EvaluationException, PropertyNotFoundException
@@ -155,27 +179,60 @@
}
//
- delegate.setValue(base, property, value);
+ if (delegate != null)
+ {
+ delegate.setValue(base, property, value);
+ }
+
+ //
+ throw createPNFE(base, property);
}
- public Object getValue(Object base, int index) throws EvaluationException,
PropertyNotFoundException
+ public Class getType(Object base, int index) throws EvaluationException,
PropertyNotFoundException
{
- return delegate.getValue(base, index);
+ if (delegate != null)
+ {
+ return delegate.getType(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
}
public boolean isReadOnly(Object base, int index) throws EvaluationException,
PropertyNotFoundException
{
- return delegate.isReadOnly(base, index);
+ //
+ if (delegate != null)
+ {
+ return delegate.isReadOnly(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
}
- public boolean isReadOnly(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
+ public Object getValue(Object base, int index) throws EvaluationException,
PropertyNotFoundException
{
- return delegate.isReadOnly(base, property);
+ //
+ if (delegate != null)
+ {
+ return delegate.getValue(base, index);
+ }
+
+ //
+ throw createPNFE(base, index);
}
public void setValue(Object base, int index, Object value) throws EvaluationException,
PropertyNotFoundException
{
- delegate.setValue(base, index, value);
+ //
+ if (delegate != null)
+ {
+ delegate.setValue(base, index, value);
+ }
+
+ //
+ throw createPNFE(base, index);
}
/**
@@ -205,4 +262,15 @@
}
return typeDef;
}
+
+ private PropertyNotFoundException createPNFE(Object base, int index)
+ {
+ return createPNFE(base, "[" + index + "]");
+ }
+
+ private PropertyNotFoundException createPNFE(Object base, Object propertyName)
+ {
+ return new PropertyNotFoundException("Property " + propertyName + "
on object " + base + " was not found");
+ }
+
}
Modified:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26
17:41:06 UTC (rev 6407)
+++
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -23,9 +23,6 @@
package org.jboss.portal.test.faces.el;
import junit.framework.TestCase;
-import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
-import org.jboss.portal.faces.el.decorator.PropertyDecorator;
-import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
import org.jboss.portal.faces.el.PropertyValue;
/**
@@ -35,53 +32,27 @@
public class AbstractBeanDecoratorTestCase extends TestCase
{
- private Object _bean;
- private Object _propertyName;
- private Object _propertyValue;
+ private TestBean testBean;
+ private TestBeanDecorator testBeanDecorator;
protected void setUp() throws Exception
{
- _bean = new Object();
- _propertyName = new Object();
- _propertyValue = new Value();
+ testBean = new TestBean();
+ testBeanDecorator = new TestBeanDecorator();
}
protected void tearDown() throws Exception
{
- _bean = null;
- _propertyName = null;
- _propertyValue = null;
+ testBean = null;
+ testBeanDecorator = null;
}
- private final AbstractBeanDecorator decorator = new AbstractBeanDecorator()
- {
- protected PropertyDecorator getProperty(Object propertyName)
- {
- return propertyName == _propertyName ? new
AbstractPropertyDecorator(Value.class)
- {
- public Object getValue(Object bean) throws IllegalArgumentException
- {
- return bean == _bean ? _propertyValue : null;
- }
- public boolean setValue(Object bean, Object value) throws
IllegalArgumentException
- {
- if (bean == _bean )
- {
- _propertyValue = value;
- return true;
- }
- return false;
- }
- } : null;
- }
- };
-
public void testGetType()
{
try
{
- decorator.getType(null, _propertyName);
+ testBeanDecorator.getType(null, testBeanDecorator.propertyName);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -90,7 +61,7 @@
try
{
- decorator.getType(_bean, null);
+ testBeanDecorator.getType(testBean, null);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -98,14 +69,14 @@
}
//
- assertEquals(Value.class, decorator.getType(_bean, _propertyName));
+ assertEquals(Value.class, testBeanDecorator.getType(testBean,
testBeanDecorator.propertyName));
}
public void testGetValue()
{
try
{
- decorator.getValue(_bean, null);
+ testBeanDecorator.getValue(testBean, null);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -114,7 +85,7 @@
try
{
- decorator.getValue(null, _propertyName);
+ testBeanDecorator.getValue(null, testBeanDecorator.propertyName);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -122,15 +93,15 @@
}
//
- assertEquals(null, decorator.getValue(_bean, new Object()));
- assertEquals(new PropertyValue(_propertyValue), decorator.getValue(_bean,
_propertyName));
+ assertEquals(null, testBeanDecorator.getValue(testBean, new Object()));
+ assertEquals(new PropertyValue(testBean.propertyValue),
testBeanDecorator.getValue(testBean, testBeanDecorator.propertyName));
}
public void testSetValue()
{
try
{
- decorator.setValue(null, _propertyName, new Object());
+ testBeanDecorator.setValue(null, testBeanDecorator.propertyName, new Object());
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -139,7 +110,7 @@
try
{
- decorator.setValue(_bean, null, new Object());
+ testBeanDecorator.setValue(testBean, null, new Object());
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -148,11 +119,11 @@
//
Value expectedValue = new Value();
- assertEquals(true, decorator.setValue(_bean, _propertyName, expectedValue));
- assertEquals(expectedValue, _propertyValue);
+ assertEquals(true, testBeanDecorator.setValue(testBean,
testBeanDecorator.propertyName, expectedValue));
+ assertEquals(expectedValue, testBean.propertyValue);
//
- assertEquals(true, decorator.setValue(_bean, _propertyName, null));
- assertEquals(null, _propertyValue);
+ assertEquals(true, testBeanDecorator.setValue(testBean,
testBeanDecorator.propertyName, null));
+ assertEquals(null, testBean.propertyValue);
}
}
Modified:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-02-26
17:41:06 UTC (rev 6407)
+++
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -23,8 +23,7 @@
package org.jboss.portal.test.faces.el;
import junit.framework.TestCase;
-import org.jboss.portal.faces.el.dynamic.AbstractDynamicBean;
-import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.el.PropertyValue;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -33,17 +32,24 @@
public class AbstractDynamicBeanTestCase extends TestCase
{
- /** . */
- private final DynamicBean bean = new AbstractDynamicBean();
+ private TestDynamicBean testDynamicBean;
- /** . */
- private final Object propertyName = new Object();
+ protected void setUp() throws Exception
+ {
+ testDynamicBean = new TestDynamicBean();
+ }
+
+ protected void tearDown() throws Exception
+ {
+ testDynamicBean = null;
+ }
+
public void testGetType()
{
try
{
- bean.getType(null);
+ testDynamicBean.getType(null);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -51,14 +57,15 @@
}
//
- assertEquals(null, bean.getType(propertyName));
+ assertEquals(null, testDynamicBean.getType(new Object()));
+ assertEquals(Value.class, testDynamicBean.getType(testDynamicBean.propertyName));
}
public void testGetValue()
{
try
{
- bean.getValue(null);
+ testDynamicBean.getValue(null);
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -66,14 +73,15 @@
}
//
- assertEquals(null, bean.getValue(propertyName));
+ assertEquals(null, testDynamicBean.getValue(new Object()));
+ assertEquals(new PropertyValue(testDynamicBean.propertyValue),
testDynamicBean.getValue(testDynamicBean.propertyName));
}
public void testSetValue()
{
try
{
- bean.setValue(null, new Object());
+ testDynamicBean.setValue(null, new Object());
fail("Was expecting an IAE");
}
catch (IllegalArgumentException expected)
@@ -81,8 +89,12 @@
}
//
- assertFalse(bean.setValue(propertyName, new Object()));
- assertFalse(bean.setValue(propertyName, null));
+ Value expectedValue = new Value();
+ assertFalse(testDynamicBean.setValue(new Object(), new Object()));
+ assertTrue(testDynamicBean.setValue(testDynamicBean.propertyName, expectedValue));
+ assertEquals(expectedValue, testDynamicBean.propertyValue);
+ assertTrue(testDynamicBean.setValue(testDynamicBean.propertyName, null));
+ assertEquals(null, testDynamicBean.propertyValue);
}
}
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/test/faces/el/DelegatingPropertyResolverTestCase.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+
+import javax.faces.el.PropertyNotFoundException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DelegatingPropertyResolverTestCase extends TestCase
+{
+
+ private Object propertyName;
+ private Object bean;
+ private TestBean testBean;
+ private TestBeanDecorator testBeanDecorator;
+ private TestDynamicBean testDynamicBean;
+ private DelegatingPropertyResolver resolver;
+
+ protected void setUp() throws Exception
+ {
+ propertyName = new Object();
+ bean = new Object();
+ testBean = new TestBean();
+ testBeanDecorator = new TestBeanDecorator();
+ DelegatingPropertyResolver.registerDecorator(TestBean.class, testBeanDecorator);
+ testDynamicBean = new TestDynamicBean();
+ resolver = new DelegatingPropertyResolver();
+ }
+
+ public void testGetType()
+ {
+ try
+ {
+ resolver.getType(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ //
+ try
+ {
+ resolver.getType(testBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(Value.class, resolver.getType(testBean,
testBeanDecorator.propertyName));
+
+ //
+ try
+ {
+ resolver.getType(testDynamicBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(Value.class, resolver.getType(testDynamicBean,
testDynamicBean.propertyName));
+ }
+
+ public void testIsReadOnly()
+ {
+ try
+ {
+ resolver.isReadOnly(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ resolver.getValue(bean, propertyName);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ //
+ try
+ {
+ resolver.getType(testBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(testBean.propertyValue, resolver.getValue(testBean,
testBeanDecorator.propertyName));
+
+ //
+ try
+ {
+ resolver.getType(testDynamicBean, new Object());
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ assertEquals(testDynamicBean.propertyValue, resolver.getValue(testDynamicBean,
testDynamicBean.propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ resolver.setValue(bean, propertyName, null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+
+ //
+ try
+ {
+ resolver.setValue(testBean, new Object(), null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ Value expectedValue = new Value();
+ resolver.setValue(testBean, testBeanDecorator.propertyName, expectedValue);
+ assertEquals(expectedValue, testBean.propertyValue);
+
+ //
+ try
+ {
+ resolver.setValue(testDynamicBean, new Object(), null);
+ fail("Was expecting PNFE");
+ }
+ catch (PropertyNotFoundException expected)
+ {
+ }
+ resolver.setValue(testDynamicBean, testDynamicBean.propertyName, expectedValue);
+ assertEquals(expectedValue, testDynamicBean.propertyValue);
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBean.java 2007-02-26 18:02:56
UTC (rev 6408)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestBean
+{
+
+ /** . */
+ Value propertyValue;
+
+ public TestBean()
+ {
+ this.propertyValue = new Value();
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestBeanDecorator.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
+import org.jboss.portal.faces.el.decorator.PropertyDecorator;
+import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestBeanDecorator extends AbstractBeanDecorator
+{
+
+ /** . */
+ final Object propertyName;
+
+ public TestBeanDecorator()
+ {
+ propertyName = new Object();
+ }
+
+ protected PropertyDecorator getProperty(Object propertyName)
+ {
+ if (this.propertyName == propertyName)
+ {
+ return new AbstractPropertyDecorator(Value.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ return ((TestBean)bean).propertyValue;
+ }
+ public boolean setValue(Object bean, Object value) throws
IllegalArgumentException
+ {
+ ((TestBean)bean).propertyValue = (Value)value;
+ return true;
+ }
+ };
+ }
+ return null;
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/TestDynamicBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/TestDynamicBean.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/TestDynamicBean.java 2007-02-26
18:02:56 UTC (rev 6408)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import org.jboss.portal.faces.el.dynamic.SimpleDynamicBean;
+import org.jboss.portal.faces.el.dynamic.DynamicProperty;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicProperty;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestDynamicBean extends SimpleDynamicBean
+{
+
+ /** . */
+ final Object propertyName;
+
+ /** . */
+ Value propertyValue;
+
+ public TestDynamicBean()
+ {
+ this.propertyName = new Object();
+ this.propertyValue = new Value();
+ }
+
+ protected DynamicProperty getProperty(Object propertyName)
+ {
+ if (propertyName == this.propertyName)
+ {
+ return new AbstractDynamicProperty(Value.class)
+ {
+ public Object getValue() throws IllegalArgumentException
+ {
+ return propertyValue;
+ }
+ public boolean setValue(Object value) throws IllegalArgumentException
+ {
+ propertyValue = (Value)value;
+ return true;
+ }
+ };
+ }
+ return null;
+ }
+}