You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/09/21 15:31:40 UTC

svn commit: r999405 - in /myfaces/tobago/trunk: tobago-core/pom.xml tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java tobago-extension/tobago-sandbox/pom.xml

Author: lofwyr
Date: Tue Sep 21 13:31:40 2010
New Revision: 999405

URL: http://svn.apache.org/viewvc?rev=999405&view=rev
Log:
using parent class from myfaces-test after adding JSF 1.1 support for it

Modified:
    myfaces/tobago/trunk/tobago-core/pom.xml
    myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java
    myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml

Modified: myfaces/tobago/trunk/tobago-core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/pom.xml?rev=999405&r1=999404&r2=999405&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-core/pom.xml Tue Sep 21 13:31:40 2010
@@ -353,7 +353,7 @@
     <dependency>
       <groupId>org.apache.myfaces.test</groupId>
       <artifactId>myfaces-test12</artifactId>
-      <version>1.0.0-beta-3</version>
+      <version>1.0.1-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
   </dependencies>

Modified: myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java?rev=999405&r1=999404&r2=999405&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/faces/AbstractTobagoTestBase.java Tue Sep 21 13:31:40 2010
@@ -17,34 +17,17 @@ package org.apache.myfaces.tobago.intern
  * limitations under the License.
  */
 
-import org.apache.myfaces.test.mock.MockApplication;
-import org.apache.myfaces.test.mock.MockExternalContext;
+import org.apache.myfaces.test.base.junit4.AbstractJsfTestCase;
 import org.apache.myfaces.test.mock.MockFacesContext;
-import org.apache.myfaces.test.mock.MockFacesContextFactory;
 import org.apache.myfaces.test.mock.MockHttpServletRequest;
-import org.apache.myfaces.test.mock.MockHttpServletResponse;
-import org.apache.myfaces.test.mock.MockHttpSession;
-import org.apache.myfaces.test.mock.MockRenderKit;
-import org.apache.myfaces.test.mock.MockServletConfig;
-import org.apache.myfaces.test.mock.MockServletContext;
-import org.apache.myfaces.test.mock.lifecycle.MockLifecycle;
-import org.apache.myfaces.test.mock.lifecycle.MockLifecycleFactory;
 import org.apache.myfaces.tobago.component.ComponentTypes;
 import org.apache.myfaces.tobago.component.UIInput;
 import org.apache.myfaces.tobago.component.UIOut;
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.Theme;
-import org.junit.After;
 import org.junit.Before;
 
-import javax.faces.FactoryFinder;
-import javax.faces.application.ApplicationFactory;
-import javax.faces.component.UIViewRoot;
-import javax.faces.lifecycle.LifecycleFactory;
-import javax.faces.render.RenderKitFactory;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -60,25 +43,7 @@ import java.util.Map;
  * </p>
  */
 
-public abstract class AbstractTobagoTestBase {
-
-  // Mock object instances for our tests
-  private MockApplication application = null;
-  private MockServletConfig config = null;
-  private MockExternalContext externalContext = null;
-  private MockFacesContext facesContext = null;
-  private MockFacesContextFactory facesContextFactory = null;
-  private MockLifecycle lifecycle = null;
-  private MockLifecycleFactory lifecycleFactory = null;
-  private MockRenderKit renderKit = null;
-  private MockHttpServletRequest request = null;
-  private MockHttpServletResponse response = null;
-  private MockServletContext servletContext = null;
-  private MockHttpSession session = null;
-
-  // Thread context class loader saved and restored after each test
-  private ClassLoader threadContextClassLoader = null;
-
+public abstract class AbstractTobagoTestBase extends AbstractJsfTestCase {
 
   /**
    * <p>Set up instance variables required by this test case.</p>
@@ -86,57 +51,7 @@ public abstract class AbstractTobagoTest
   @Before
   public void setUp() throws Exception {
 
-    // Set up a new thread context class loader
-    threadContextClassLoader = Thread.currentThread().getContextClassLoader();
-    Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0],
-        this.getClass().getClassLoader()));
-
-    // Set up Servlet API Objects
-    servletContext = new MockServletContext();
-    config = new MockServletConfig(servletContext);
-    session = new MockHttpSession();
-    session.setServletContext(servletContext);
-    request = new MockHttpServletRequest(session);
-    request.setServletContext(servletContext);
-    response = new MockHttpServletResponse();
-
-    // Set up JSF API Objects
-    FactoryFinder.releaseFactories();
-    FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
-        "org.apache.myfaces.test.mock.MockApplicationFactory");
-    FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
-        "org.apache.myfaces.test.mock.MockFacesContextFactory");
-    FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
-        "org.apache.myfaces.test.mock.lifecycle.MockLifecycleFactory");
-    FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
-        "org.apache.myfaces.test.mock.MockRenderKitFactory");
-
-    externalContext =
-        new MockExternalContext(servletContext, request, response);
-    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");
-    root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
-    facesContext.setViewRoot(root);
-    ApplicationFactory applicationFactory = (ApplicationFactory)
-        FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
-    application = (MockApplication) applicationFactory.getApplication();
-    facesContext.setApplication(application);
-    RenderKitFactory renderKitFactory = (RenderKitFactory)
-        FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
-    renderKit = new MockRenderKit();
-    renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT, renderKit);
+    super.setUp();
 
     // Tobago specific extensions
 
@@ -173,29 +88,4 @@ public abstract class AbstractTobagoTest
   public MockHttpServletRequest getRequest() {
     return request;
   }
-
-  /**
-   * <p>Tear down instance variables required by this test case.</p>
-   */
-  @After
-  public void tearDown() throws Exception {
-
-    application = null;
-    config = null;
-    externalContext = null;
-    facesContext.release();
-    facesContext = null;
-    lifecycle = null;
-    lifecycleFactory = null;
-    renderKit = null;
-    request = null;
-    response = null;
-    servletContext = null;
-    session = null;
-    FactoryFinder.releaseFactories();
-
-    Thread.currentThread().setContextClassLoader(threadContextClassLoader);
-    threadContextClassLoader = null;
-
-  }
 }

Modified: myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml?rev=999405&r1=999404&r2=999405&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml (original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-sandbox/pom.xml Tue Sep 21 13:31:40 2010
@@ -340,7 +340,7 @@
     <dependency>
       <groupId>org.apache.myfaces.test</groupId>
       <artifactId>myfaces-test12</artifactId>
-      <version>1.0.0-beta-3</version>
+      <version>1.0.1-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
   </dependencies>