myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1099119 - in /myfaces/core/trunk: api/src/main/java/javax/faces/view/facelets/ impl/src/main/java/org/apache/myfaces/config/ impl/src/main/java/org/apache/myfaces/view/facelets/ impl/src/main/java/org/apache/myfaces/view/facelets/impl/ imp...
Date Tue, 03 May 2011 16:44:33 GMT
Author: lu4242
Date: Tue May  3 16:44:32 2011
New Revision: 1099119

URL: http://svn.apache.org/viewvc?rev=1099119&view=rev
Log:
MYFACES-3089 Implement FaceletCacheFactory and FaceletCache methods

Added:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java
      - copied, changed from r1098603, myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCacheFactoryImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
Removed:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCacheFactoryImpl.java
Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FaceletCache.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ApplicationImplJsfTest.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ViewHandlerImplTest.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FaceletCache.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FaceletCache.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FaceletCache.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FaceletCache.java Tue May
 3 16:44:32 2011
@@ -29,6 +29,9 @@ import java.net.URL;
  */
 public abstract class FaceletCache<V>
 {
+    private FaceletCache.MemberFactory<V> _faceletFactory;
+    private FaceletCache.MemberFactory<V> _viewMetadataFaceletFactory;
+    
     public abstract V getFacelet(URL url) throws IOException;
     
     public abstract boolean isFaceletCached(URL url);
@@ -39,19 +42,26 @@ public abstract class FaceletCache<V>
     
     protected void setMemberFactories(FaceletCache.MemberFactory<V> faceletFactory,
FaceletCache.MemberFactory<V> viewMetadataFaceletFactory)
     {
-        //TODO: Write content
+        if (faceletFactory == null)
+        {
+            throw new NullPointerException("faceletFactory is null");
+        }
+        if  (viewMetadataFaceletFactory == null)
+        {
+            throw new NullPointerException("viewMetadataFaceletFactory is null");
+        }
+        _faceletFactory = faceletFactory;
+        _viewMetadataFaceletFactory = viewMetadataFaceletFactory;
     }
 
     protected FaceletCache.MemberFactory<V> getMemberFactory()
     {
-        //TODO: Write content
-        return null;
+        return _faceletFactory;
     }
     
     protected FaceletCache.MemberFactory<V> getMetadataMemberFactory()
     {
-        //TODO: Write content
-        return null;
+        return _viewMetadataFaceletFactory;
     }
     
     public static interface MemberFactory<V>

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
Tue May  3 16:44:32 2011
@@ -57,7 +57,7 @@ import org.apache.myfaces.spi.FacesConfi
 import org.apache.myfaces.util.ContainerUtils;
 import org.apache.myfaces.util.ExternalSpecifications;
 import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
-import org.apache.myfaces.view.facelets.FaceletCacheFactoryImpl;
+import org.apache.myfaces.view.facelets.impl.FaceletCacheFactoryImpl;
 import org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
 import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
 import org.apache.myfaces.webapp.ManagedBeanDestroyerListener;

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
Tue May  3 16:44:32 2011
@@ -18,19 +18,10 @@
  */
 package org.apache.myfaces.view.facelets.impl;
 
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
-import org.apache.myfaces.view.facelets.compiler.Compiler;
-import org.apache.myfaces.view.facelets.util.ParameterCheck;
-
-import javax.el.ELException;
-import javax.faces.FacesException;
-import javax.faces.view.facelets.FaceletException;
-import javax.faces.view.facelets.FaceletHandler;
-import javax.faces.view.facelets.ResourceResolver;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.HashMap;
@@ -39,6 +30,20 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.regex.Pattern;
 
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.view.facelets.FaceletCache;
+import javax.faces.view.facelets.FaceletCacheFactory;
+import javax.faces.view.facelets.FaceletException;
+import javax.faces.view.facelets.FaceletHandler;
+import javax.faces.view.facelets.ResourceResolver;
+
+import org.apache.myfaces.view.facelets.Facelet;
+import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.view.facelets.compiler.Compiler;
+import org.apache.myfaces.view.facelets.util.ParameterCheck;
+
 /**
  * Default FaceletFactory implementation.
  * 
@@ -56,10 +61,10 @@ public final class DefaultFaceletFactory
     private URL _baseUrl;
 
     private Compiler _compiler;
-
-    private Map<String, DefaultFacelet> _facelets;
     
-    private Map<String, DefaultFacelet> _viewMetadataFacelets;
+    //private Map<String, DefaultFacelet> _facelets;
+    
+    //private Map<String, DefaultFacelet> _viewMetadataFacelets;
     
     private Map<String, DefaultFacelet> _compositeComponentMetadataFacelets;
 
@@ -68,7 +73,9 @@ public final class DefaultFaceletFactory
     private Map<String, URL> _relativeLocations;
 
     private javax.faces.view.facelets.ResourceResolver _resolver;
-
+    
+    private FaceletCache<Facelet> _faceletCache;
+    
     public DefaultFaceletFactory(Compiler compiler, ResourceResolver resolver) throws IOException
     {
         this(compiler, resolver, -1);
@@ -81,9 +88,9 @@ public final class DefaultFaceletFactory
 
         _compiler = compiler;
 
-        _facelets = new HashMap<String, DefaultFacelet>();
+        //_facelets = new HashMap<String, DefaultFacelet>();
         
-        _viewMetadataFacelets = new HashMap<String, DefaultFacelet>();
+        //_viewMetadataFacelets = new HashMap<String, DefaultFacelet>();
         
         _compositeComponentMetadataFacelets = new HashMap<String, DefaultFacelet>();
 
@@ -94,6 +101,41 @@ public final class DefaultFaceletFactory
         _baseUrl = resolver.resolveUrl("/");
 
         _refreshPeriod = refreshPeriod < 0 ? INFINITE_DELAY : refreshPeriod * 1000;
+        
+        // facelet cache. Lookup here, because after all this is a "part" of the facelet
factory implementation.
+        FaceletCacheFactory cacheFactory = (FaceletCacheFactory) FactoryFinder.getFactory(FactoryFinder.FACELET_CACHE_FACTORY);
+        _faceletCache = (FaceletCache<Facelet>) cacheFactory.getFaceletCache();
+        
+        FaceletCache.MemberFactory<Facelet> faceletFactory = new FaceletCache.MemberFactory<Facelet>()
+        {
+            public Facelet newInstance(URL url) throws IOException
+            {
+                return _createFacelet(url);
+            }
+        };
+        FaceletCache.MemberFactory<Facelet> viewMetadataFaceletFactory = new FaceletCache.MemberFactory<Facelet>()
+        {
+            public Facelet newInstance(URL url) throws IOException
+            {
+                return _createViewMetadataFacelet(url);
+            }
+        };
+        
+        // Note that FaceletCache.setMemberFactories method is protected, and this is the
place where call
+        // this method has sense, because DefaultFaceletFactory is the responsible to create
Facelet instances.
+        // The only way to do it is using reflection, and it has sense, because in this way
it is possible to
+        // setup a java SecurityManager that prevents call this method (because it is protected,
and to do that
+        // the code first check for "suppressAccessChecks" permission).
+        try
+        {
+            Method setMemberFactoriesMethod = FaceletCache.class.getDeclaredMethod("setMemberFactories",
new Class[]{FaceletCache.MemberFactory.class, FaceletCache.MemberFactory.class});
+            setMemberFactoriesMethod.setAccessible(true);
+            setMemberFactoriesMethod.invoke(_faceletCache, faceletFactory, viewMetadataFaceletFactory);
+        } 
+        catch (Exception e)
+        {
+            throw new FacesException("Cannot call setMemberFactories method, Initialization
of FaceletCache failed.", e);
+        }
 
         if (log.isLoggable(Level.FINE))
         {
@@ -151,6 +193,8 @@ public final class DefaultFaceletFactory
      */
     public Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException,
ELException
     {
+        return _faceletCache.getFacelet(url);
+        /*
         ParameterCheck.notNull("url", url);
         
         String key = url.toString();
@@ -168,7 +212,7 @@ public final class DefaultFaceletFactory
             }
         }
         
-        return f;
+        return f;*/
     }
 
     public long getRefreshPeriod()
@@ -383,6 +427,8 @@ public final class DefaultFaceletFactory
     public Facelet getViewMetadataFacelet(URL url) throws IOException,
             FaceletException, FacesException, ELException
     {
+        return _faceletCache.getViewMetadataFacelet(url);
+        /*
         ParameterCheck.notNull("url", url);
         
         String key = url.toString();
@@ -401,6 +447,7 @@ public final class DefaultFaceletFactory
         }
         
         return f;
+        */
     }
     
     /**

Copied: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java
(from r1098603, myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCacheFactoryImpl.java)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java?p2=myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java&p1=myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCacheFactoryImpl.java&r1=1098603&r2=1099119&rev=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCacheFactoryImpl.java
(original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java
Tue May  3 16:44:32 2011
@@ -16,11 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.view.facelets;
+package org.apache.myfaces.view.facelets.impl;
 
+import javax.faces.application.ProjectStage;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
 import javax.faces.view.facelets.FaceletCache;
 import javax.faces.view.facelets.FaceletCacheFactory;
 
+import org.apache.myfaces.shared_impl.util.WebConfigParamUtils;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+
 /**
  * 
  * @author Leonardo Uribe
@@ -29,12 +35,24 @@ import javax.faces.view.facelets.Facelet
  */
 public class FaceletCacheFactoryImpl extends FaceletCacheFactory
 {
+    private final static String PARAM_REFRESH_PERIOD_DEPRECATED = "facelets.REFRESH_PERIOD";
+    
+    private final static String[] PARAMS_REFRESH_PERIOD = {FaceletViewDeclarationLanguage.PARAM_REFRESH_PERIOD,
PARAM_REFRESH_PERIOD_DEPRECATED};
+
 
     @Override
     public FaceletCache getFaceletCache()
     {
-        // TODO IMPLEMENT ME!!!!
-        return null;
+        FacesContext context = FacesContext.getCurrentInstance();
+        ExternalContext eContext = context.getExternalContext();
+        // refresh period
+        long refreshPeriod;
+        if(context.isProjectStage(ProjectStage.Production))
+            refreshPeriod = WebConfigParamUtils.getLongInitParameter(eContext, PARAMS_REFRESH_PERIOD,
FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD_PRODUCTION);
+        else
+            refreshPeriod = WebConfigParamUtils.getLongInitParameter(eContext, PARAMS_REFRESH_PERIOD,
FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD);
+        
+        return new FaceletCacheImpl(refreshPeriod);
     }
 
 }

Added: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java?rev=1099119&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
(added)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheImpl.java
Tue May  3 16:44:32 2011
@@ -0,0 +1,179 @@
+/*
+ * 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.view.facelets.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.view.facelets.FaceletCache;
+import javax.faces.view.facelets.FaceletException;
+
+import org.apache.myfaces.view.facelets.util.ParameterCheck;
+
+/**
+ * TODO: Note MyFaces core has another type of Facelet for read composite component
+ * metadata. The reason behind do this in MyFaces is to retrieve some information
+ * related to insertChildren/insertFacet that can be used as metadata and use that
+ * information later to do the hack for composite components using templates, instead
+ * rely on component relocation. This is not handled by FaceletCache included here 
+ * but in practice this should not be a problem, because the intention of this class
+ * is handle Facelet instances created using custom ResourceResolver stuff, and 
+ * usually those pages are for views, not for composite components. Even if that is
+ * true, composite component metadata Facelet is smaller (only add cc:xxx stuff) that
+ * the other ones used for views or the one used to apply the composite component
+ * itself.  
+ * 
+ * @author Leonardo Uribe
+ * @since 2.1.0
+ *
+ */
+class FaceletCacheImpl extends FaceletCache<DefaultFacelet> {
+
+    private static final long INFINITE_DELAY = -1;
+    private static final long NO_CACHE_DELAY = 0;
+    
+    private Map<String, DefaultFacelet> _facelets;
+    
+    private Map<String, DefaultFacelet> _viewMetadataFacelets;
+
+    private long _refreshPeriod;
+    
+    FaceletCacheImpl(long refreshPeriod)
+    {
+        _refreshPeriod = refreshPeriod < 0 ? INFINITE_DELAY : refreshPeriod * 1000;
+        
+        _facelets = new HashMap<String, DefaultFacelet>();
+        
+        _viewMetadataFacelets = new HashMap<String, DefaultFacelet>();
+    }
+
+    @Override
+    public DefaultFacelet getFacelet(URL url) throws IOException
+    {
+        ParameterCheck.notNull("url", url);
+        
+        String key = url.toString();
+        
+        DefaultFacelet f = _facelets.get(key);
+        
+        if (f == null || this.needsToBeRefreshed(f))
+        {
+            //f = this._createFacelet(url);
+            f = getMemberFactory().newInstance(url);
+            if (_refreshPeriod != NO_CACHE_DELAY)
+            {
+                Map<String, DefaultFacelet> newLoc = new HashMap<String, DefaultFacelet>(_facelets);
+                newLoc.put(key, f);
+                _facelets = newLoc;
+            }
+        }
+        
+        return f;
+    }
+    
+    @Override
+    public boolean isFaceletCached(URL url)
+    {
+        return _facelets.containsKey(url);
+    }
+
+    @Override
+    public DefaultFacelet getViewMetadataFacelet(URL url) throws IOException
+    {
+        ParameterCheck.notNull("url", url);
+        
+        String key = url.toString();
+        
+        DefaultFacelet f = _viewMetadataFacelets.get(key);
+        
+        if (f == null || this.needsToBeRefreshed(f))
+        {
+            //f = this._createViewMetadataFacelet(url);
+            f = getMetadataMemberFactory().newInstance(url);
+            if (_refreshPeriod != NO_CACHE_DELAY)
+            {
+                Map<String, DefaultFacelet> newLoc = new HashMap<String, DefaultFacelet>(_viewMetadataFacelets);
+                newLoc.put(key, f);
+                _viewMetadataFacelets = newLoc;
+            }
+        }
+        
+        return f;
+    }
+
+    @Override
+    public boolean isViewMetadataFaceletCached(URL url)
+    {
+        return _viewMetadataFacelets.containsKey(url);
+    }
+
+    /**
+     * Template method for determining if the Facelet needs to be refreshed.
+     * 
+     * @param facelet
+     *            Facelet that could have expired
+     * @return true if it needs to be refreshed
+     */
+    protected boolean needsToBeRefreshed(DefaultFacelet facelet)
+    {
+        // if set to 0, constantly reload-- nocache
+        if (_refreshPeriod == NO_CACHE_DELAY)
+        {
+            return true;
+        }
+
+        // if set to -1, never reload
+        if (_refreshPeriod == INFINITE_DELAY)
+        {
+            return false;
+        }
+
+        long target = facelet.getCreateTime() + _refreshPeriod;
+        if (System.currentTimeMillis() > target)
+        {
+            // Should check for file modification
+
+            try
+            {
+                URLConnection conn = facelet.getSource().openConnection();
+                InputStream is = conn.getInputStream();
+                try
+                {
+                    long lastModified = conn.getLastModified();
+
+                    return lastModified == 0 || lastModified > target;
+                }
+                finally
+                {
+                    is.close();
+                }
+            }
+            catch (IOException e)
+            {
+                throw new FaceletException("Error Checking Last Modified for " + facelet.getAlias(),
e);
+            }
+        }
+
+        return false;
+    }
+}

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ApplicationImplJsfTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ApplicationImplJsfTest.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ApplicationImplJsfTest.java
(original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ApplicationImplJsfTest.java
Tue May  3 16:44:32 2011
@@ -44,6 +44,7 @@ import org.apache.myfaces.test.mock.Mock
 import org.apache.myfaces.test.mock.resource.MockResource;
 import org.apache.myfaces.test.mock.resource.MockSimpleResource;
 import org.apache.myfaces.view.facelets.MockFaceletViewDeclarationLanguage;
+import org.apache.myfaces.view.facelets.impl.FaceletCacheFactoryImpl;
 import org.apache.myfaces.view.facelets.mock.MockViewDeclarationLanguageFactory;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -136,6 +137,8 @@ public class ApplicationImplJsfTest exte
         // create and configure our ApplicationImpl instance
         FactoryFinder.setFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY,
                 MockViewDeclarationLanguageFactory.class.getName());
+        FactoryFinder.setFactory(FactoryFinder.FACELET_CACHE_FACTORY,
+                FaceletCacheFactoryImpl.class.getName());
         RuntimeConfig runtimeConfig = new RuntimeConfig();
         _testApplication = new TestApplicationWrapper(new ApplicationImpl(runtimeConfig));
         facesContext.setApplication(_testApplication);

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ViewHandlerImplTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ViewHandlerImplTest.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ViewHandlerImplTest.java
(original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/ViewHandlerImplTest.java
Tue May  3 16:44:32 2011
@@ -39,6 +39,7 @@ import org.apache.myfaces.test.base.juni
 import org.apache.myfaces.test.el.MockValueExpression;
 import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
 import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.apache.myfaces.view.facelets.impl.FaceletCacheFactoryImpl;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -67,6 +68,9 @@ public class ViewHandlerImplTest extends
         FactoryFinder.setFactory(FactoryFinder.VIEW_DECLARATION_LANGUAGE_FACTORY,
                 ViewDeclarationLanguageFactoryImpl.class.getName());
         
+        FactoryFinder.setFactory(FactoryFinder.FACELET_CACHE_FACTORY,
+                FaceletCacheFactoryImpl.class.getName());
+        
         // configure the ViewHandler
         _viewHandler = new TestViewHandlerImpl();
         facesContext.getApplication().setViewHandler(_viewHandler);

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java?rev=1099119&r1=1099118&r2=1099119&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
(original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
Tue May  3 16:44:32 2011
@@ -55,6 +55,7 @@ import org.apache.myfaces.test.el.MockEx
 import org.apache.myfaces.test.mock.MockPropertyResolver;
 import org.apache.myfaces.test.mock.MockVariableResolver;
 import org.apache.myfaces.test.mock.visit.MockVisitContextFactory;
+import org.apache.myfaces.view.facelets.impl.FaceletCacheFactoryImpl;
 import org.apache.myfaces.view.facelets.mock.MockViewDeclarationLanguageFactory;
 import org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
 
@@ -151,6 +152,8 @@ public abstract class FaceletTestCase ex
                 PartialViewContextFactoryImpl.class.getName());
         FactoryFinder.setFactory(FactoryFinder.VISIT_CONTEXT_FACTORY, 
                 MockVisitContextFactory.class.getName());
+        FactoryFinder.setFactory(FactoryFinder.FACELET_CACHE_FACTORY,
+                FaceletCacheFactoryImpl.class.getName());
     }
     
     @Override



Mime
View raw message