Return-Path: Delivered-To: apmail-struts-dev-archive@www.apache.org Received: (qmail 82308 invoked from network); 7 Jul 2005 21:36:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jul 2005 21:36:04 -0000 Received: (qmail 45412 invoked by uid 500); 7 Jul 2005 21:35:58 -0000 Delivered-To: apmail-struts-dev-archive@struts.apache.org Received: (qmail 45202 invoked by uid 500); 7 Jul 2005 21:35:56 -0000 Mailing-List: contact dev-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Developers List" Reply-To: "Struts Developers List" Delivered-To: mailing list dev@struts.apache.org Received: (qmail 45189 invoked by uid 500); 7 Jul 2005 21:35:56 -0000 Received: (qmail 45180 invoked by uid 99); 7 Jul 2005 21:35:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2005 14:35:56 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 07 Jul 2005 14:35:55 -0700 Received: (qmail 82275 invoked by uid 65534); 7 Jul 2005 21:35:54 -0000 Message-ID: <20050707213554.82274.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r209653 - in /struts/shale/trunk/test-framework/src/java/org/apache/shale/test: base/AbstractJsfTestCase.java mock/MockFacesContextFactory.java Date: Thu, 07 Jul 2005 21:35:51 -0000 To: commits@struts.apache.org From: craigmcc@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: craigmcc Date: Thu Jul 7 14:35:48 2005 New Revision: 209653 URL: http://svn.apache.org/viewcvs?rev=209653&view=rev Log: Flesh out the simulation of the JSF environment by registering all of the relevant factories, so we can test remote commands that need them. Modified: struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java struts/shale/trunk/test-framework/src/java/org/apache/shale/test/mock/MockFacesContextFactory.java Modified: struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java?rev=209653&r1=209652&r2=209653&view=diff ============================================================================== --- struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java (original) +++ struts/shale/trunk/test-framework/src/java/org/apache/shale/test/base/AbstractJsfTestCase.java Thu Jul 7 14:35:48 2005 @@ -24,6 +24,7 @@ import javax.faces.el.MethodNotFoundException; import javax.faces.el.PropertyNotFoundException; import javax.faces.el.ValueBinding; +import javax.faces.lifecycle.LifecycleFactory; import javax.faces.render.RenderKit; import javax.faces.render.RenderKitFactory; @@ -41,10 +42,12 @@ import org.apache.shale.test.mock.MockApplicationFactory; import org.apache.shale.test.mock.MockExternalContext; import org.apache.shale.test.mock.MockFacesContext; +import org.apache.shale.test.mock.MockFacesContextFactory; import org.apache.shale.test.mock.MockHttpServletRequest; import org.apache.shale.test.mock.MockHttpServletResponse; import org.apache.shale.test.mock.MockHttpSession; import org.apache.shale.test.mock.MockLifecycle; +import org.apache.shale.test.mock.MockLifecycleFactory; import org.apache.shale.test.mock.MockRenderKit; import org.apache.shale.test.mock.MockRenderKitFactory; import org.apache.shale.test.mock.MockServletConfig; @@ -102,13 +105,27 @@ // Set up JSF API Objects FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY, "org.apache.shale.test.mock.MockApplicationFactory"); + FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY, + "org.apache.shale.test.mock.MockFacesContextFactory"); + FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY, + "org.apache.shale.test.mock.MockLifecycleFactory"); FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY, "org.apache.shale.test.mock.MockRenderKitFactory"); externalContext = new MockExternalContext(servletContext, request, response); - lifecycle = new MockLifecycle(); - facesContext = new MockFacesContext(externalContext, lifecycle); + lifecycleFactory = (MockLifecycleFactory) + FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); + lifecycle = (MockLifecycle) + lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); + facesContextFactory = (MockFacesContextFactory) + FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); + facesContext = (MockFacesContext) + facesContextFactory.getFacesContext(servletContext, + request, + response, + lifecycle); + externalContext = (MockExternalContext) facesContext.getExternalContext(); UIViewRoot root = new UIViewRoot(); root.setViewId("/viewId"); facesContext.setViewRoot(root); @@ -146,6 +163,7 @@ externalContext = null; facesContext = null; lifecycle = null; + lifecycleFactory = null; renderKit = null; request = null; response = null; @@ -163,7 +181,9 @@ protected MockServletConfig config = null; protected MockExternalContext externalContext = null; protected MockFacesContext facesContext = null; + protected MockFacesContextFactory facesContextFactory = null; protected MockLifecycle lifecycle = null; + protected MockLifecycleFactory lifecycleFactory = null; protected MockRenderKit renderKit = null; protected MockHttpServletRequest request = null; protected MockHttpServletResponse response = null; Modified: struts/shale/trunk/test-framework/src/java/org/apache/shale/test/mock/MockFacesContextFactory.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/test-framework/src/java/org/apache/shale/test/mock/MockFacesContextFactory.java?rev=209653&r1=209652&r2=209653&view=diff ============================================================================== --- struts/shale/trunk/test-framework/src/java/org/apache/shale/test/mock/MockFacesContextFactory.java (original) +++ struts/shale/trunk/test-framework/src/java/org/apache/shale/test/mock/MockFacesContextFactory.java Thu Jul 7 14:35:48 2005 @@ -21,6 +21,9 @@ import javax.faces.context.FacesContextFactory; import javax.faces.context.FacesContext; import javax.faces.lifecycle.Lifecycle; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; /** *

Mock implementation of FacesContextFactory.

@@ -53,7 +56,11 @@ Object response, Lifecycle lifecycle) throws FacesException { - return new MockFacesContext(); + MockExternalContext externalContext = + new MockExternalContext((ServletContext) context, + (HttpServletRequest) request, + (HttpServletResponse) response); + return new MockFacesContext(externalContext, lifecycle); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org For additional commands, e-mail: dev-help@struts.apache.org