myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r513971 - in /myfaces/core/branches/jsf12/impl/src: main/java/org/apache/myfaces/application/ApplicationImpl.java test/java/org/apache/myfaces/application/ApplicationImplTest.java
Date Fri, 02 Mar 2007 21:41:14 GMT
Author: mbr
Date: Fri Mar  2 13:41:12 2007
New Revision: 513971

URL: http://svn.apache.org/viewvc?view=rev&rev=513971
Log:
Application.createComponent must set the component instance

Modified:
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
    myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java?view=diff&rev=513971&r1=513970&r2=513971
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
(original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/application/ApplicationImpl.java
Fri Mar  2 13:41:12 2007
@@ -296,7 +296,7 @@
             else
             {
                 createdComponent = createComponent(componentType);
-                componentExpression.setValue(elContext, retVal);
+                componentExpression.setValue(elContext, createdComponent);
             }
         }
         catch (Exception e)

Modified: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java?view=diff&rev=513971&r1=513970&r2=513971
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
(original)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/application/ApplicationImplTest.java
Fri Mar  2 13:41:12 2007
@@ -19,21 +19,29 @@
 package org.apache.myfaces.application;
 
 import static org.apache.myfaces.test.AssertThrowables.assertThrowable;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.classextension.EasyMock.createMock;
+import static org.easymock.classextension.EasyMock.replay;
 
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.test.TestRunnable;
-import org.apache.shale.test.mock.MockFacesContext;
+import java.util.ListResourceBundle;
+import java.util.Locale;
+import java.util.ResourceBundle;
 
+import javax.el.ELContext;
+import javax.el.ValueExpression;
 import javax.faces.FacesException;
+import javax.faces.component.UIOutput;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 
-import java.util.ListResourceBundle;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
 import junit.framework.TestCase;
 
+import org.apache.myfaces.config.RuntimeConfig;
+import org.apache.myfaces.test.TestRunnable;
+import org.apache.shale.test.mock.MockFacesContext;
+
 /**
  * @author Mathias Broekelmann (latest modification by $Author$)
  * @version $Revision$ $Date$
@@ -118,6 +126,20 @@
         context.setViewRoot(viewRoot);
         viewRoot.setLocale(locale);
         assertGetResourceBundleWithLocale(locale);
+    }
+
+    public void testCreateComponentCallSetValueOnExpressionIfValueNull() throws Exception
+    {
+        ValueExpression expr = createMock(ValueExpression.class);
+        FacesContext context = createMock(FacesContext.class);
+        ELContext elcontext = createMock(ELContext.class);
+        expect(context.getELContext()).andReturn(elcontext);
+        expect(expr.getValue(elcontext)).andReturn(null);
+        expr.setValue(eq(elcontext), isA(UIOutput.class));
+        app.addComponent("testComponent", UIOutput.class.getName());
+        replay(context);
+        replay(expr);
+        assertTrue(UIOutput.class.isAssignableFrom(app.createComponent(expr, context, "testComponent").getClass()));
     }
 
     private void assertGetResourceBundleWithLocale(final Locale expectedLocale)



Mime
View raw message