You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2006/10/07 07:27:38 UTC

svn commit: r453850 - in /shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock: MockApplication12.java MockELContext.java MockExternalContext12.java

Author: craigmcc
Date: Fri Oct  6 22:27:38 2006
New Revision: 453850

URL: http://svn.apache.org/viewvc?view=rev&rev=453850
Log:
The JSF RI's api classes are missing some @since 1.2 markers on added methods,
so pick those up.  Make MockELContext call through to MockApplication to get
the relevant ELResolver instance for this application.

Modified:
    shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockApplication12.java
    shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockELContext.java
    shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockExternalContext12.java

Modified: shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockApplication12.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockApplication12.java?view=diff&rev=453850&r1=453849&r2=453850
==============================================================================
--- shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockApplication12.java (original)
+++ shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockApplication12.java Fri Oct  6 22:27:38 2006
@@ -23,6 +23,7 @@
 import java.util.ResourceBundle;
 import javax.el.CompositeELResolver;
 import javax.el.ELContextListener;
+import javax.el.ELException;
 import javax.el.ELResolver;
 import javax.el.ExpressionFactory;
 import javax.el.ValueExpression;
@@ -120,6 +121,18 @@
                                        String componentType) {
 
         throw new UnsupportedOperationException();
+
+    }
+
+
+    /** {@inheritDoc} */
+    public Object evaluateExpressionGet(FacesContext context,
+                                        String expression,
+                                        Class expectedType) throws ELException {
+
+        ValueExpression ve = getExpressionFactory().createValueExpression
+          (context.getELContext(), expression, expectedType);
+        return ve.getValue(context.getELContext());
 
     }
 

Modified: shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockELContext.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockELContext.java?view=diff&rev=453850&r1=453849&r2=453850
==============================================================================
--- shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockELContext.java (original)
+++ shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockELContext.java Fri Oct  6 22:27:38 2006
@@ -23,6 +23,7 @@
 import javax.el.ELResolver;
 import javax.el.FunctionMapper;
 import javax.el.VariableMapper;
+import javax.faces.context.FacesContext;
 
 /**
  * <p>Mock implementation of <code>ELContext</code>.</p>
@@ -47,7 +48,6 @@
 
 
     private Map contexts = new HashMap();
-    private ELResolver elResolver; // FIXME - initialize this!
     private FunctionMapper functionMapper = new MockFunctionMapper();
     private Locale locale = Locale.getDefault();
     private boolean propertyResolved;
@@ -72,7 +72,8 @@
 
     /** {@inheritDoc} */
     public ELResolver getELResolver() {
-        return this.elResolver;
+        FacesContext context = FacesContext.getCurrentInstance();
+        return context.getApplication().getELResolver();
     }
 
 

Modified: shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockExternalContext12.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockExternalContext12.java?view=diff&rev=453850&r1=453849&r2=453850
==============================================================================
--- shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockExternalContext12.java (original)
+++ shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockExternalContext12.java Fri Oct  6 22:27:38 2006
@@ -69,6 +69,22 @@
 
 
     /** {@inheritDoc} */
+    public String getResponseCharacterEncoding() {
+
+        return this.response.getCharacterEncoding();
+
+    }
+
+
+    /** {@inheritDoc} */
+    public String getResponseContentType() {
+
+        return this.response.getContentType();
+
+    }
+
+
+    /** {@inheritDoc} */
     public void setRequest(Object request) {
 
         this.request = (HttpServletRequest) request;
@@ -88,6 +104,14 @@
     public void setResponse(Object response) {
 
         this.response = (HttpServletResponse) response;
+
+    }
+
+
+    /** {@inheritDoc} */
+    public void setResponseCharacterEncoding(String encoding) {
+
+        this.response.setCharacterEncoding(encoding);
 
     }