[seam-commits] Seam SVN: r9099 - in trunk/src: test/integration/src/org/jboss/seam/test/integration/i8ln and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Sep 22 11:45:21 EDT 2008


Author: dan.j.allen
Date: 2008-09-22 11:45:21 -0400 (Mon, 22 Sep 2008)
New Revision: 9099

Modified:
   trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java
   trunk/src/test/integration/src/org/jboss/seam/test/integration/i8ln/LocaleTest.java
Log:
restore old behavior of SeamTest such that the JSF Application object is recreated before each class


Modified: trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java	2008-09-22 15:10:09 UTC (rev 9098)
+++ trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java	2008-09-22 15:45:21 UTC (rev 9099)
@@ -73,6 +73,7 @@
 {
 
    private Application application;
+   private ApplicationFactory applicationFactory;
    private ServletContext servletContext;
    private static SeamPhaseListener phases;
    private MockHttpSession session;
@@ -935,7 +936,6 @@
     */
    protected void stopSeam() throws Exception
    {
-      ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).setApplication(null);
       ServletLifecycle.endApplication();
    }
    
@@ -947,7 +947,8 @@
    protected void setupClass() throws Exception
    {
       servletContext = (MockServletContext) ServletLifecycle.getServletContext();
-      application = ((ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY)).getApplication();
+      applicationFactory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+      application = applicationFactory.getApplication();
       conversationViewRootAttributes = new HashMap<String, Map>();
       seamFilter = createSeamFilter();
       FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY, MockFacesContextFactory.class.getName());
@@ -966,6 +967,7 @@
    {
       seamFilter.destroy();
       conversationViewRootAttributes = null;
+      applicationFactory.setApplication(null);
    }
 
    protected Filter createSeamFilter() throws ServletException

Modified: trunk/src/test/integration/src/org/jboss/seam/test/integration/i8ln/LocaleTest.java
===================================================================
--- trunk/src/test/integration/src/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2008-09-22 15:10:09 UTC (rev 9098)
+++ trunk/src/test/integration/src/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2008-09-22 15:45:21 UTC (rev 9099)
@@ -8,18 +8,34 @@
 import javax.faces.component.UIOutput;
 import javax.faces.event.ValueChangeEvent;
 
+import org.jboss.seam.international.LocaleConfig;
 import org.jboss.seam.international.LocaleSelector;
+import org.jboss.seam.Seam;
+import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.mock.SeamTest;
 import org.testng.annotations.Test;
 
 public class LocaleTest extends SeamTest
 {
-   
    @Test
    public void localeTest() throws Exception
    {
+      new NonFacesRequest()
+      {
+         @Override
+         protected void renderResponse() throws Exception
+         {
+            // it's necessary to emulate the startup behavior of LocaleConfig since it alters the JSF Application
+            // and we cannot be sure that the JSF Application wasn't cleared by an earlier class
+            // NOTE: I wish this test suite had some better place of initializing the application context
+            Contexts.getApplicationContext().remove(Seam.getComponentName(LocaleConfig.class));
+            LocaleConfig.instance();
+         }
+      }.run();
+
       new FacesRequest()
       {
+
          @Override
          protected void invokeApplication() throws Exception
          {




More information about the seam-commits mailing list