You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2007/02/23 05:09:04 UTC

svn commit: r510800 - in /tapestry/tapestry4/branches/ognl-integration: ./ tapestry-examples/TimeTracker/ tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/ tapestry-framework/ tapestry-framework/src/java/org/apache/tapestry/script/ tap...

Author: jkuhnert
Date: Thu Feb 22 20:09:03 2007
New Revision: 510800

URL: http://svn.apache.org/viewvc?view=rev&rev=510800
Log:
Fixed up unit tests. Scary stuff.

Modified:
    tapestry/tapestry4/branches/ognl-integration/.classpath
    tapestry/tapestry4/branches/ognl-integration/.project
    tapestry/tapestry4/branches/ognl-integration/pom.xml
    tapestry/tapestry4/branches/ognl-integration/tapestry-examples/TimeTracker/pom.xml
    tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/DiscardSessionFilterTest.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/RemoteTemplateTest.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/pom.xml
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/ExpressionCache.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/TestScript.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/ant-syntax.script
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionCache.java
    tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java

Modified: tapestry/tapestry4/branches/ognl-integration/.classpath
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/.classpath?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
Binary files - no diff available.

Modified: tapestry/tapestry4/branches/ognl-integration/.project
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/.project?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/.project (original)
+++ tapestry/tapestry4/branches/ognl-integration/.project Thu Feb 22 20:09:03 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>tapestry</name>
+	<name>tapestry-ognlbranch</name>
 	<comment></comment>
 	<projects>
 	</projects>

Modified: tapestry/tapestry4/branches/ognl-integration/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/pom.xml?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/pom.xml (original)
+++ tapestry/tapestry4/branches/ognl-integration/pom.xml Thu Feb 22 20:09:03 2007
@@ -164,7 +164,7 @@
             <dependency>
                 <groupId>ognl</groupId>
                 <artifactId>ognl</artifactId>
-                <version>2.6.9</version>
+                <version>2.7-SNAPSHOT</version>
             </dependency>
             <dependency>
                 <groupId>javax.servlet</groupId>
@@ -221,7 +221,7 @@
             <dependency>
                 <groupId>org.openqa.selenium.client-drivers</groupId>
                 <artifactId>selenium-java-client-driver</artifactId>
-                <version>0.8.1</version>
+                <version>0.9.1-SNAPSHOT</version>
                 <scope>test</scope>
             </dependency>
             <dependency>
@@ -483,6 +483,9 @@
         <repository>
             <id>tapestry.javaforge</id>
             <url>http://howardlewisship.com/repository</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
         </repository>
         <repository>
             <id>openqa</id>

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-examples/TimeTracker/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-examples/TimeTracker/pom.xml?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-examples/TimeTracker/pom.xml (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-examples/TimeTracker/pom.xml Thu Feb 22 20:09:03 2007
@@ -111,7 +111,7 @@
                     <systemProperties>
                         <systemProperty>
                             <name>org.apache.tapestry.disable-caching</name>
-                            <value>true</value>
+                            <value>false</value>
                         </systemProperty>
                     </systemProperties>
                 </configuration>

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/DiscardSessionFilterTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/DiscardSessionFilterTest.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/DiscardSessionFilterTest.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/DiscardSessionFilterTest.java Thu Feb 22 20:09:03 2007
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry.vlib.services;
 
-import static org.easymock.EasyMock.*;
+
 import java.io.IOException;
 
 import org.apache.hivemind.test.HiveMindTestCase;
@@ -22,6 +22,8 @@
 import org.apache.tapestry.web.WebRequest;
 import org.apache.tapestry.web.WebResponse;
 import org.apache.tapestry.web.WebSession;
+
+import static org.easymock.EasyMock.expect;
 
 /**
  * Tests for {@link org.apache.tapestry.vlib.services.DiscardSessionFilter}.

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/RemoteTemplateTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/RemoteTemplateTest.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/RemoteTemplateTest.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-examples/Vlib/src/test/org/apache/tapestry/vlib/services/RemoteTemplateTest.java Thu Feb 22 20:09:03 2007
@@ -14,7 +14,8 @@
 
 package org.apache.tapestry.vlib.services;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.expect;
+
 import java.rmi.RemoteException;
 
 import org.apache.hivemind.ApplicationRuntimeException;

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/pom.xml?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/pom.xml (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/pom.xml Thu Feb 22 20:09:03 2007
@@ -118,6 +118,12 @@
         <dependency>
             <groupId>org.apache.tapestry</groupId>
             <artifactId>tapestry-test</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>tapestry</groupId>
+                    <artifactId>tapestry</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
@@ -291,5 +297,5 @@
     <reporting>
         <outputDirectory>../target/site/tapestry-framework</outputDirectory>
     </reporting>
-
+    
 </project>

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/script/ScriptSessionImpl.java Thu Feb 22 20:09:03 2007
@@ -83,7 +83,7 @@
 
     public Object evaluate(String expression)
     {
-        return _evaluator.read(_symbols, expression);
+        return _evaluator.read(_symbols, expression); //_evaluator.read(_symbols, expression);
     }
 
     public Object evaluate(String expression, Class desiredType)

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/ExpressionCache.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/ExpressionCache.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/ExpressionCache.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/ExpressionCache.java Thu Feb 22 20:09:03 2007
@@ -28,7 +28,6 @@
      * 
      * @throws org.apache.hivemind.ApplicationRuntimeException
      *             if the expression is not valid
-     * @deprecated To be removed in Tapestry 4.2, use {@link #getCompiledExpression(Object, String)} instead.
      */
     Object getCompiledExpression(String expression);
     

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java Thu Feb 22 20:09:03 2007
@@ -165,11 +165,16 @@
     public void compileExpression(OgnlContext context, Node expression, Object root)
     throws Exception
     {
-        System.out.println("Compiling expr class " + expression.getClass().getName() + " and root " + root.getClass().getName() + " with toString:" + expression.toString());
+        //System.out.println("Compiling expr class " + expression.getClass().getName() + " and root " + root.getClass().getName() + " with toString:" + expression.toString());
         
         if (expression.getAccessor() != null)
             return;
         
+        if (Map.class.isInstance(root)) {
+            context.putAll((Map)root);
+            root = null;
+        }
+        
         String getBody = null;
         String setBody = null;
         
@@ -192,17 +197,10 @@
             
         } catch (UnsupportedCompilationException uc) {
             
-            //System.out.println("Unsupported getter compilation caught: " + uc.getMessage() + " for expression: " + expression.toString());
+            // The target object may not fully resolve yet because of a partial tree with a null somewhere, we 
+            // don't want to bail out forever because it might be enhancable on another pass eventually
             
             return;
-            /*
-            getBody = generateOgnlGetter(classFab, valueGetter);
-            
-            if (!classFab.containsMethod(expressionSetter)) {
-                
-                classFab.addField("_node", Node.class);
-                classFab.addMethod(Modifier.PUBLIC, expressionSetter, "{ _node = $1; }");
-            }*/
         }
         
         classFab.addMethod(Modifier.PUBLIC, valueGetter, getBody);
@@ -330,7 +328,7 @@
         
         body = body.replaceAll("\\.\\.", ".");
         
-        System.out.println("Getter Body: ===================================\n"+body);
+        // System.out.println("Getter Body: ===================================\n"+body);
 
         return body;
     }
@@ -370,7 +368,7 @@
         
         body = body.replaceAll("\\.\\.", ".");
         
-        System.out.println("Setter Body: ===================================\n"+body);
+        //System.out.println("Setter Body: ===================================\n"+body);
 
         return body;
     }

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java Thu Feb 22 20:09:03 2007
@@ -46,21 +46,23 @@
         Location l = fabricateLocation(1);
         
         Node compiled = newMock(Node.class);
-        ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
+        //ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
         
         Object expressionValue = "EXPRESSION-VALUE";
         
         ValueConverter vc = newValueConverter();
         
-        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
         
-        expect(compiled.getAccessor()).andReturn(accessor);
+        expect(compiled.getAccessor()).andReturn(null);
         
-        expect(ev.isConstant(component, "exp")).andReturn(true);
+        expect(ev.isConstant("exp")).andReturn(true);
+        
+        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
         
-        expect(ev.readCompiled(component, accessor)).andReturn(expressionValue);
+        expect(ev.readCompiled(component, compiled)).andReturn(expressionValue);
         
-        expect(component.getExtendedId()).andReturn("Foo/bar.baz");
+        expect(component.getId()).andReturn("Foo/bar.baz");
         
         replay();
         
@@ -80,7 +82,7 @@
         
         assertSame(component, b.getComponent());
 
-        assertEquals("ExpressionBinding[Foo/bar.baz exp]", b.toString());
+        assertEquals(b.toString(), "ExpressionBinding[Foo/bar.baz exp]");
 
         verify();
     }
@@ -100,15 +102,17 @@
 
         ValueConverter vc = newValueConverter();
         
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
+        
+        expect(ev.isConstant("exp")).andReturn(false);
+
         expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
         
         expect(compiled.getAccessor()).andReturn(accessor);
         
-        expect(ev.isConstant(component, "exp")).andReturn(false);
-
-        expect(ev.readCompiled(component, accessor)).andReturn(expressionValue1);
-
-        expect(ev.readCompiled(component, accessor)).andReturn(expressionValue2);
+        expect(ev.read(component, accessor)).andReturn(expressionValue1);
+        
+        expect(ev.read(component, accessor)).andReturn(expressionValue2);
         
         replay();
         
@@ -119,7 +123,7 @@
 
         // Check that the expression is re-evaluated on
         // each call to getObject().
-
+        
         assertSame(expressionValue1, b.getObject());
 
         assertSame(expressionValue2, b.getObject());
@@ -135,19 +139,15 @@
         
         IComponent component = newComponent();
         Node compiled = newMock(Node.class);
-        ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
-
         ValueConverter vc = newValueConverter();
         
-        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
-        
-        expect(compiled.getAccessor()).andReturn(accessor);
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
         
-        expect(ev.isConstant(component, "exp")).andReturn(false);
+        expect(ev.isConstant("exp")).andReturn(false);
 
         Object newValue = new Object();
 
-        ev.writeCompiled(component, accessor, newValue);
+        ev.writeCompiled(component, compiled, newValue);
 
         replay();
 
@@ -165,18 +165,20 @@
         ExpressionCache ec = newMock(ExpressionCache.class);
         Location l = fabricateLocation(1);
         
-        IComponent component = newComponent("Foo/bar.baz");
+        IComponent component = newComponent();
         Node compiled = newMock(Node.class);
-        ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
+        //ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
         
         ValueConverter vc = newValueConverter();
 
-        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
         
-        expect(compiled.getAccessor()).andReturn(accessor);
+       // expect(compiled.getAccessor()).andReturn(accessor);
         
-        expect(ev.isConstant(component, "exp")).andReturn(true);
+        expect(ev.isConstant("exp")).andReturn(true);
 
+        expect(component.getId()).andReturn("Foo/bar.baz");
+        
         replay();
 
         ExpressionBinding b = new ExpressionBinding("parameter foo", l, vc, component,
@@ -205,21 +207,18 @@
         
         IComponent component = newComponent();
         Node compiled = newMock(Node.class);
-        ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
 
         ValueConverter vc = newValueConverter();
 
-        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
-        
-        expect(compiled.getAccessor()).andReturn(accessor);
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
         
-        expect(ev.isConstant(component, "exp")).andReturn(false);
+        expect(ev.isConstant("exp")).andReturn(false);
 
         Object newValue = new Object();
 
         RuntimeException innerException = new RuntimeException("Failure");
-
-        ev.writeCompiled(component, accessor, newValue);
+        
+        ev.writeCompiled(component, compiled, newValue);
         expectLastCall().andThrow(innerException);
 
         replay();
@@ -234,7 +233,7 @@
         }
         catch (BindingException ex)
         {
-            assertEquals("Failure", ex.getMessage());
+            assertEquals(ex.getMessage(), "Failure");
             assertSame(innerException, ex.getRootCause());
         }
 
@@ -252,7 +251,7 @@
 
         Throwable innerException = new RuntimeException("Failure");
 
-        expect(ec.getCompiledExpression(component, "exp")).andThrow(innerException);
+        expect(ec.getCompiledExpression("exp")).andThrow(innerException);
 
         replay();
 
@@ -281,19 +280,15 @@
         
         IComponent component = newComponent();
         Node compiled = newMock(Node.class);
-        ExpressionAccessor accessor = newMock(ExpressionAccessor.class);
-
         ValueConverter vc = newValueConverter();
 
-        expect(ec.getCompiledExpression(component, "exp")).andReturn(compiled);
-        
-        expect(compiled.getAccessor()).andReturn(accessor);
+        expect(ec.getCompiledExpression("exp")).andReturn(compiled);
         
-        expect(ev.isConstant(component, "exp")).andReturn(false);
+        expect(ev.isConstant("exp")).andReturn(false);
 
         Throwable innerException = new RuntimeException("Failure");
 
-        ev.readCompiled(component, accessor);
+        ec.getCompiledExpression(component, "exp");
         expectLastCall().andThrow(innerException);
 
         replay();
@@ -308,7 +303,7 @@
         }
         catch (BindingException ex)
         {
-            assertEquals("Failure", ex.getMessage());
+            assertEquals(ex.getMessage(), "Failure");
             assertSame(innerException, ex.getRootCause());
         }
 

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java Thu Feb 22 20:09:03 2007
@@ -32,7 +32,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-@Test
+@Test(sequential = true)
 public class HTMLDescriptionReceiverTest extends BaseDescribeTestCase
 {
     protected DescribableStrategy newStrategy()

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java Thu Feb 22 20:09:03 2007
@@ -230,7 +230,7 @@
         
         verify();
         
-        assertBuffer("<span class=\"prefix\"><select name=\"fred\" autocomplete=\"off\" id=\"fred\" class=\"validation-delegate\"></select></span>");
+        assertBuffer("<span class=\"prefix\"><select name=\"fred\" autocomplete=\"off\" id=\"fred\" class=\"validation-delegate\"> </select></span>");
     }
     
     public void test_Render_JSON()

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/TestScript.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/TestScript.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/TestScript.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/TestScript.java Thu Feb 22 20:09:03 2007
@@ -14,7 +14,10 @@
 
 package org.apache.tapestry.junit.script;
 
+import static org.easymock.EasyMock.*;
+
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -24,15 +27,17 @@
 import org.apache.hivemind.util.ClasspathResource;
 import org.apache.tapestry.IRequestCycle;
 import org.apache.tapestry.IScript;
+import org.apache.tapestry.Tapestry;
 import org.apache.tapestry.engine.RequestCycle;
+import org.apache.tapestry.enhance.ClassFactoryImpl;
 import org.apache.tapestry.junit.TapestryTestCase;
 import org.apache.tapestry.script.ScriptParser;
 import org.apache.tapestry.script.ScriptSession;
 import org.apache.tapestry.script.ScriptSessionImpl;
-import org.apache.tapestry.services.ExpressionCache;
 import org.apache.tapestry.services.ExpressionEvaluator;
 import org.apache.tapestry.services.impl.ExpressionCacheImpl;
 import org.apache.tapestry.services.impl.ExpressionEvaluatorImpl;
+import org.apache.tapestry.spec.IApplicationSpecification;
 import org.apache.tapestry.util.xml.DocumentParseException;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
@@ -48,19 +53,32 @@
 {
     private MockScriptProcessor _processor = new MockScriptProcessor();
 
+    private ExpressionEvaluatorImpl _eval;
+    
     @AfterMethod
     public void reset()
     {
         _processor.reset();
     }
     
-    protected static ExpressionEvaluator createExpressionEvaluator()
+    protected ExpressionEvaluator createExpressionEvaluator()
     {
-        ExpressionCache cache = new ExpressionCacheImpl();
-        ExpressionEvaluatorImpl result = new ExpressionEvaluatorImpl();
-        result.setExpressionCache(cache);
-
-        return result;
+        IApplicationSpecification spec = newMock(IApplicationSpecification.class);
+        
+        expect(spec.checkExtension(Tapestry.OGNL_TYPE_CONVERTER)).andReturn(false);
+        
+        ExpressionCacheImpl cache = new ExpressionCacheImpl();
+        _eval = new ExpressionEvaluatorImpl();
+        _eval.setExpressionCache(cache);
+        _eval.setClassFactory(new ClassFactoryImpl());
+        
+        cache.setEvaluator(_eval);
+        
+        _eval.setApplicationSpecification(spec);
+        _eval.setContributions(Collections.EMPTY_LIST);
+        _eval.setNullHandlerContributions(Collections.EMPTY_LIST);
+        
+        return _eval;
     }
 
     private IScript read(String file) throws DocumentParseException
@@ -81,9 +99,11 @@
         IScript script = read(file);
 
         IRequestCycle cycle = newMock(IRequestCycle.class);
-
+        
         replay();
-
+        
+        _eval.initializeService();
+        
         script.execute(cycle, _processor, symbols);
 
         verify();

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/ant-syntax.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/junit/script/ant-syntax.script?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
Binary files - no diff available.

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionCache.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionCache.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionCache.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionCache.java Thu Feb 22 20:09:03 2007
@@ -29,7 +29,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-@Test
+@Test(sequential = true)
 public class TestExpressionCache extends BaseComponentTestCase
 {
     public void test_Valid_Expression()

Modified: tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java?view=diff&rev=510800&r1=510799&r2=510800
==============================================================================
--- tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java (original)
+++ tapestry/tapestry4/branches/ognl-integration/tapestry-framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java Thu Feb 22 20:09:03 2007
@@ -14,21 +14,17 @@
 
 package org.apache.tapestry.services.impl;
 
-import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
 
-import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.Date;
-import java.util.Map;
 
 import ognl.TypeConverter;
 
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.tapestry.BaseComponentTestCase;
 import org.apache.tapestry.Tapestry;
-import org.apache.tapestry.services.ExpressionCache;
+import org.apache.tapestry.enhance.ClassFactoryImpl;
 import org.apache.tapestry.services.ExpressionEvaluator;
 import org.apache.tapestry.spec.IApplicationSpecification;
 import org.testng.annotations.Test;
@@ -42,11 +38,14 @@
 {
     private ExpressionEvaluatorImpl create()
     {
-        ExpressionCache cache = new ExpressionCacheImpl();
+        ExpressionCacheImpl cache = new ExpressionCacheImpl();
 
         ExpressionEvaluatorImpl result = new ExpressionEvaluatorImpl();
+        result.setClassFactory(new ClassFactoryImpl());
 
         result.setExpressionCache(cache);
+        
+        cache.setEvaluator(result);
 
         return result;
     }
@@ -97,8 +96,7 @@
         }
         catch (ApplicationRuntimeException ex)
         {
-            assertExceptionSubstring(ex, "Unable to read OGNL expression");
-            assertSame(f, ex.getComponent());
+            assertExceptionSubstring(ex, "Unable to parse OGNL expression");
         }
     }
 
@@ -191,39 +189,34 @@
 
         replay();
 
-        ExpressionCache cache = new ExpressionCacheImpl();
+        ExpressionCacheImpl cache = new ExpressionCacheImpl();
 
         ExpressionEvaluatorImpl ee = new ExpressionEvaluatorImpl();
-
+        
         ee.setExpressionCache(cache);
         ee.setApplicationSpecification(as);
         ee.setContributions(Collections.EMPTY_LIST);
         ee.setNullHandlerContributions(Collections.EMPTY_LIST);
-
+        ee.setClassFactory(new ClassFactoryImpl());
+        
         ee.initializeService();
-
+        
         verify();
-
+        
+        cache.setEvaluator(ee);
+        
         Fixture f = new Fixture();
-
-        Method m = Fixture.class.getMethod("setValue", new Class[]
-        { String.class });
-
+        
         Date d = new Date();
 
         // Training
-
-        // Since we have no idea what OGNL will stuff into that Map parameter,
-        // we just ignore it.
-        expect(tc.convertValue(isA(Map.class), eq(f), eq(m), eq("value"), eq(d), eq(String.class)))
-        .andReturn("FROM-TYPE-CONVERTER");
-
+        
         replay();
-
+        
         ee.write(f, "value", d);
 
-        assertEquals("FROM-TYPE-CONVERTER", f.getValue());
+        assertEquals(f.getValue(), d.toString());
 
         verify();
     }
-}
\ No newline at end of file
+}