You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2007/04/20 03:57:18 UTC

svn commit: r530609 - in /tapestry/tapestry4/trunk: pom.xml tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java

Author: jkuhnert
Date: Thu Apr 19 18:57:17 2007
New Revision: 530609

URL: http://svn.apache.org/viewvc?view=rev&rev=530609
Log:
Cleaned up expression compiler slightly and updated unit test now that it passes ognl.

Modified:
    tapestry/tapestry4/trunk/pom.xml
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java

Modified: tapestry/tapestry4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?view=diff&rev=530609&r1=530608&r2=530609
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Thu Apr 19 18:57:17 2007
@@ -279,7 +279,7 @@
                                 <value>en_US</value>
                             </property>
                         </systemProperties>
-                        <parallel>true</parallel>
+                        <parallel>tests</parallel>
                         <threadCount>4</threadCount>
                         <excludedGroups>integration</excludedGroups>
                     </configuration>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java?view=diff&rev=530609&r1=530608&r2=530609
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java Thu Apr 19 18:57:17 2007
@@ -31,7 +31,6 @@
 /**
  * Adds to default ognl compiler class pools.
  *
- * @author jkuhnert
  */
 public class HiveMindExpressionCompiler extends ExpressionCompiler implements OgnlExpressionCompiler {
     private static final Log _log = LogFactory.getLog(HiveMindExpressionCompiler.class);
@@ -42,7 +41,7 @@
     {
         _classFactory = classfactory;
     }
-    
+
     public String getClassName(Class clazz)
     {
         if (IRender.class.isAssignableFrom(clazz) || Modifier.isPublic(clazz.getModifiers()))
@@ -268,7 +267,7 @@
         context.setRoot(root);
         context.setCurrentObject(root);
         context.remove(PRE_CAST);
-
+        
         try {
 
             getterCode = expression.toGetSourceString(context, root);
@@ -289,7 +288,7 @@
             post = post + ")";
         }
 
-        String rootExpr = !getterCode.equals("null") ? getRootExpression(expression, root, false) : "";
+        String rootExpr = !getterCode.equals("null") ? getRootExpression(expression, root, context) : "";
 
         String noRoot = (String) context.remove("_noRoot");
         if (noRoot != null)
@@ -376,7 +375,7 @@
         if (root == null)
             throw new UnsupportedCompilationException("Can't compile setters with a null root object.");
 
-        String pre = getRootExpression(expression, root, false);
+        String pre = getRootExpression(expression, root, context);
 
         String noRoot = (String) context.remove("_noRoot");
         if (noRoot != null)
@@ -395,9 +394,6 @@
                + setterCode + ";}";
 
         body = body.replaceAll("\\.\\.", ".");
-
-        if (body.indexOf("$3") < 0)
-            body = null;
 
         if (_log.isDebugEnabled())
             _log.debug("Setter Body: ===================================\n" + body);

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java?view=diff&rev=530609&r1=530608&r2=530609
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java Thu Apr 19 18:57:17 2007
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.services.impl;
 
-import ognl.OgnlContext;
 import ognl.TypeConverter;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.tapestry.BaseComponentTestCase;
@@ -22,10 +21,9 @@
 import org.apache.tapestry.enhance.ClassFactoryImpl;
 import org.apache.tapestry.services.ExpressionEvaluator;
 import org.apache.tapestry.spec.IApplicationSpecification;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
 import org.testng.annotations.Test;
 
-import java.lang.reflect.Member;
 import java.util.Collections;
 import java.util.Date;
 
@@ -208,8 +206,6 @@
         Fixture f = new Fixture();
 
         Date d = new Date();
-
-        expect(tc.convertValue(isA(OgnlContext.class), eq(f), isA(Member.class), eq("value"), eq(d), eq(String.class))).andReturn(d.toString());
 
         // Training