You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2008/11/05 20:02:11 UTC

svn commit: r711661 - in /myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator: ./ baseval/ crossval/ mock/

Author: gpetracek
Date: Wed Nov  5 11:02:10 2008
New Revision: 711661

URL: http://svn.apache.org/viewvc?rev=711661&view=rev
Log:
tests for the el-resolver approach

Added:
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplication.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplicationFactory.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockExpressionFactory.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockValueExpression.java
Modified:
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/AbstractExValViewControllerTestCase.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/baseval/BaseValTestCase.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/crossval/CrossValTestCase.java

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/AbstractExValViewControllerTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/AbstractExValViewControllerTestCase.java?rev=711661&r1=711660&r2=711661&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/AbstractExValViewControllerTestCase.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/AbstractExValViewControllerTestCase.java Wed Nov  5 11:02:10 2008
@@ -37,6 +37,7 @@
 import org.apache.myfaces.extensions.validator.core.renderkit.DefaultRenderKitWrapperFactory;
 import org.apache.myfaces.extensions.validator.crossval.CrossValidationPhaseListener;
 import org.apache.myfaces.extensions.validator.util.TestUtils;
+import org.apache.myfaces.extensions.validator.mock.ExtValMockApplicationFactory;
 import org.apache.myfaces.shared_impl.config.MyfacesConfig;
 import org.apache.shale.test.mock.MockApplication;
 import org.apache.shale.test.mock.MockExternalContext;
@@ -51,6 +52,7 @@
 import org.apache.shale.test.mock.MockResponseWriter;
 import org.apache.shale.test.mock.MockServletConfig;
 import org.apache.shale.test.mock.MockServletContext;
+import org.apache.shale.test.el.MockExpressionFactory;
 
 /**
  * Abstract Shale Test base class, which sets up the JSF environment.  If the test
@@ -71,6 +73,7 @@
     protected MockHttpServletResponse response;
     protected MockServletContext servletContext;
     protected MockHttpSession session;
+    protected MockExpressionFactory expressionFactory;
     private ClassLoader threadContextClassLoader;
         
     /** Response Writer */
@@ -96,6 +99,7 @@
         response = null;
         servletContext = null;
         session = null;
+        expressionFactory = null;
         threadContextClassLoader = null;
     }
 
@@ -112,8 +116,8 @@
         threadContextClassLoader = Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0], getClass().getClassLoader()));
         servletContext = new MockServletContext();
-        //workaround for testing
-        servletContext.addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_EL_RESOLVER", "true");
+        //for testing the fallback
+        //servletContext.addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_EL_RESOLVER", "true");
         config = new MockServletConfig(servletContext);
         session = new MockHttpSession();
         session.setServletContext(servletContext);
@@ -121,7 +125,7 @@
         request.setServletContext(servletContext);
         response = new MockHttpServletResponse();
         FactoryFinder.releaseFactories();
-        FactoryFinder.setFactory("javax.faces.application.ApplicationFactory", "org.apache.shale.test.mock.MockApplicationFactory");
+        FactoryFinder.setFactory("javax.faces.application.ApplicationFactory", ExtValMockApplicationFactory.class.getName());
         FactoryFinder.setFactory("javax.faces.context.FacesContextFactory", "org.apache.shale.test.mock.MockFacesContextFactory");
         FactoryFinder.setFactory("javax.faces.lifecycle.LifecycleFactory", "org.apache.shale.test.mock.MockLifecycleFactory");
         FactoryFinder.setFactory("javax.faces.render.RenderKitFactory", "org.apache.shale.test.mock.MockRenderKitFactory");
@@ -152,6 +156,7 @@
         TestUtils.addDefaultRenderers(facesContext);
         TestUtils.addDefaultValidators(facesContext);
                 
+        expressionFactory = (MockExpressionFactory)application.getExpressionFactory();
         new PropertyValidationModuleStartupListener().init();
     }
 
@@ -174,6 +179,7 @@
         session = null;
         FactoryFinder.releaseFactories();
         Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+        expressionFactory = null;
         threadContextClassLoader = null;
     }
     
@@ -221,7 +227,6 @@
         assertNotNull("ID is not null", id);
         assertTrue("Response Complete", facesContext.getResponseComplete());
         String output = writer.getWriter().toString();
-//        System.out.println("Output = '" + output + "'");
         assertNotNull("Has output", output);
         assertTrue("Contains id '" + id + "'", output.indexOf(id) != -1);
     }

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/baseval/BaseValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/baseval/BaseValTestCase.java?rev=711661&r1=711660&r2=711661&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/baseval/BaseValTestCase.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/baseval/BaseValTestCase.java Wed Nov  5 11:02:10 2008
@@ -83,6 +83,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.name}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.name}", Object.class));
 
         inputComponent.setSubmittedValue("");
 
@@ -96,6 +98,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.name1}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.name1}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("12345");
@@ -111,6 +115,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.name1}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.name1}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("1d3");
@@ -126,6 +132,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.name1}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.name1}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("x");
@@ -141,6 +149,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.patternName}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.patternName}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("Peter1");
@@ -156,6 +166,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.patternName}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.patternName}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("Peter");
@@ -170,7 +182,9 @@
     public void testDoubleValueFail() throws Exception
     {
         inputComponent.setValueBinding("value", application
-                .createValueBinding("#{testBean.doubleValue1}"));
+                .createValueBinding("#{}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.doubleValue1}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("-301");
@@ -186,6 +200,8 @@
     {
         inputComponent.setValueBinding("value", application
                 .createValueBinding("#{testBean.doubleValue1}"));
+        inputComponent.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.doubleValue1}", Object.class));
 
         //decode
         inputComponent.setSubmittedValue("200");

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/crossval/CrossValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/crossval/CrossValTestCase.java?rev=711661&r1=711660&r2=711661&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/crossval/CrossValTestCase.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/crossval/CrossValTestCase.java Wed Nov  5 11:02:10 2008
@@ -56,6 +56,7 @@
         super.setUp();
         CrossValTestBean bean = new CrossValTestBean();
         application.createValueBinding("#{testBean}");
+        expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean}", Object.class);
         facesContext.getExternalContext().getRequestMap().put("testBean",bean);
         
         rootComponent = new UIViewRoot();
@@ -80,9 +81,13 @@
     {
         inputComponent1.setValueBinding("value", 
                 application.createValueBinding("#{testBean.property1}"));
-        inputComponent2.setValueBinding("value", 
+        inputComponent1.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.property1}", Object.class));
+        inputComponent2.setValueBinding("value",
                 application.createValueBinding("#{testBean.property2}"));
-        
+        inputComponent2.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.property2}", Object.class));
+
         //decode
         inputComponent1.setSubmittedValue("1d3");
         inputComponent2.setSubmittedValue("1d3");
@@ -101,9 +106,13 @@
     {
         inputComponent1.setValueBinding("value", 
                 application.createValueBinding("#{testBean.property1}"));
-        inputComponent2.setValueBinding("value", 
+        inputComponent1.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.property1}", Object.class));
+        inputComponent2.setValueBinding("value",
                 application.createValueBinding("#{testBean.property2}"));
-        
+        inputComponent2.setValueExpression("value",
+            expressionFactory.createValueExpression(facesContext.getELContext(), "#{testBean.property2}", Object.class));
+
         //decode
         inputComponent1.setSubmittedValue("1d3");
         inputComponent2.setSubmittedValue("1d4");

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplication.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplication.java?rev=711661&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplication.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplication.java Wed Nov  5 11:02:10 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.mock;
+
+import org.apache.shale.test.mock.MockApplication;
+
+import javax.el.ELContextListener;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.faces.application.Application;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockApplication extends MockApplication
+{
+    private Application wrapped;
+
+    public ExtValMockApplication()
+    {
+        super();
+    }
+
+    public ExtValMockApplication(Application application)
+    {
+        super();
+        this.wrapped = application;
+    }
+
+    @Override
+    public ELContextListener[] getELContextListeners()
+    {
+        return new ELContextListener[0];
+    }
+
+    @Override
+    public ELResolver getELResolver()
+    {
+        return this.wrapped.getELResolver();
+    }
+
+    @Override
+    public ExpressionFactory getExpressionFactory()
+    {
+        return new ExtValMockExpressionFactory();
+    }
+}

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplicationFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplicationFactory.java?rev=711661&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplicationFactory.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockApplicationFactory.java Wed Nov  5 11:02:10 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.mock;
+
+import org.apache.shale.test.mock.MockApplicationFactory;
+
+import javax.faces.application.Application;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockApplicationFactory extends MockApplicationFactory
+{
+    @Override
+    public Application getApplication()
+    {
+        return new ExtValMockApplication(super.getApplication());
+    }
+}

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockExpressionFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockExpressionFactory.java?rev=711661&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockExpressionFactory.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockExpressionFactory.java Wed Nov  5 11:02:10 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.mock;
+
+import org.apache.shale.test.el.MockExpressionFactory;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ExtValMockExpressionFactory extends MockExpressionFactory
+{
+    @Override
+    public ValueExpression createValueExpression(ELContext context, String expression, Class expectedType)
+    {
+        return new ExtValMockValueExpression(expression, expectedType);
+    }
+}

Added: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockValueExpression.java?rev=711661&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockValueExpression.java (added)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/mock/ExtValMockValueExpression.java Wed Nov  5 11:02:10 2008
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.mock;
+
+import org.apache.myfaces.extensions.validator.core.el.ExtValELResolver;
+import org.apache.shale.test.el.MockValueExpression;
+
+import javax.el.ELContext;
+import javax.el.ELResolver;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Gerhard Petracek
+ */
+//TODO improve
+public class ExtValMockValueExpression extends MockValueExpression
+{
+    private String[] elements = null;
+    private String expression = null;
+
+    public ExtValMockValueExpression(String expression, Class expectedType)
+    {
+        super(expression, expectedType);
+
+        if (expression == null)
+        {
+            throw new NullPointerException("Expression string cannot be null");
+        }
+
+        this.expression = expression;
+        parse();
+    }
+
+    @Override
+    public Object getValue(ELContext context)
+    {
+        ELResolver resolver = context.getELResolver();
+
+        if (resolver instanceof ExtValELResolver)
+        {
+            return getBase(context, resolver);
+        }
+
+        return super.getValue(context);
+    }
+
+    @Override
+    public void setValue(ELContext context, Object value)
+    {
+        if (context.getELResolver() instanceof ExtValELResolver)
+        {
+            context.getELResolver().setValue(context, getValue(context), elements[elements.length - 1], null);
+        }
+        else
+        {
+            Object base = getBase(context, context.getELResolver());
+            String setter = "set" + createPropertyString();
+
+            try
+            {
+                Method setterMethod = base.getClass().getDeclaredMethod(setter, value != null ? value.getClass() : Object.class);
+                setterMethod.invoke(base, value);
+            }
+            catch (Throwable e)
+            {
+                throw new IllegalStateException();
+            }
+        }
+    }
+
+    @Override
+    public Class getType(ELContext context)
+    {
+        if (context == null)
+        {
+            throw new NullPointerException();
+        }
+
+        Object base = getBase(context, context.getELResolver());
+
+        if (base == null)
+        {
+            return null;
+        }
+        else
+        {
+            String getter = "get" + createPropertyString();
+
+            try
+            {
+                Method getterMethod = base.getClass().getDeclaredMethod(getter);
+                return getterMethod.getReturnType();
+            }
+            catch (NoSuchMethodException e)
+            {
+                throw new IllegalStateException();
+            }
+        }
+    }
+
+    private void parse()
+    {
+
+        if (isLiteralText())
+        {
+            elements = new String[0];
+            return;
+        }
+
+        if (expression.startsWith("${") || expression.startsWith("#{"))
+        {
+            if (expression.endsWith("}"))
+            {
+                List names = new ArrayList();
+                StringBuffer expr = new StringBuffer(expression.substring(2, expression.length() - 1).replaceAll(" ", ""));
+                boolean isBlockOn = false;
+                for (int i = expr.length() - 1; i > -1; i--)
+                {
+                    if (expr.charAt(i) == ' ')
+                    {
+                        expr.deleteCharAt(i);
+                    }
+                    else if (expr.charAt(i) == ']')
+                    {
+                        expr.deleteCharAt(i);
+                    }
+                    else if (expr.charAt(i) == '[')
+                    {
+                        expr.deleteCharAt(i);
+                    }
+                    else if (expr.charAt(i) == '\'')
+                    {
+                        if (!isBlockOn)
+                        {
+                            expr.deleteCharAt(i);
+                        }
+                        else
+                        {
+                            names.add(0, expr.substring(i + 1));
+                            expr.delete(i, expr.length());
+                        }
+                        isBlockOn = !isBlockOn;
+                    }
+                    else if (expr.charAt(i) == '.' && !isBlockOn)
+                    {
+                        names.add(0, expr.substring(i + 1));
+                        expr.delete(i, expr.length());
+                    }
+                }
+                if (expr.length() > 0)
+                {
+                    names.add(0, expr.toString());
+                }
+
+                elements = (String[]) names.toArray(new String[names.size()]);
+            }
+            else
+            {
+                throw new IllegalArgumentException(expression);
+            }
+        }
+        else
+        {
+            throw new IllegalArgumentException(expression);
+        }
+
+    }
+
+    public Object getBase(ELContext context, ELResolver resolver)
+    {
+        Object base = null;
+        for (int i = 0; i < elements.length - 1; i++)
+        {
+            base = resolver.getValue(context, base, elements[i]);
+        }
+        return base;
+    }
+
+    private String createPropertyString()
+    {
+        String property = elements[elements.length - 1];
+        return property.substring(0, 1).toUpperCase() + property.substring(1, property.length());
+    }
+}