[seam-commits] Seam SVN: r14440 - in branches/community/Seam_2_3: jboss-seam/src/test/java/org/jboss/seam/test/unit and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Mar 27 17:41:18 EDT 2012


Author: manaRH
Date: 2012-03-27 17:41:17 -0400 (Tue, 27 Mar 2012)
New Revision: 14440

Modified:
   branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/Contexts.java
   branches/community/Seam_2_3/jboss-seam/src/test/java/org/jboss/seam/test/unit/PhaseListenerTest.java
   branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
Log:
fixing integration tests and also uncommented PhaseListenerTest unit test

Modified: branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/Contexts.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/Contexts.java	2012-03-26 16:25:16 UTC (rev 14439)
+++ branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/Contexts.java	2012-03-27 21:41:17 UTC (rev 14440)
@@ -6,6 +6,8 @@
  */
 package org.jboss.seam.contexts;
 
+import static javax.faces.event.PhaseId.RESTORE_VIEW;
+
 import java.util.Map;
 
 import org.jboss.seam.Component;
@@ -106,7 +108,7 @@
          javax.faces.context.FacesContext facesContext = javax.faces.context.FacesContext.getCurrentInstance();
          if (facesContext != null)
          {
-            if (javax.faces.event.PhaseId.RESTORE_VIEW.equals(facesContext.getCurrentPhaseId()))
+            if (FacesLifecycle.getPhaseId() == RESTORE_VIEW )
             {
                log.debug("Page Context will be lazilly created");
                FacesLifecycle.resumePage();

Modified: branches/community/Seam_2_3/jboss-seam/src/test/java/org/jboss/seam/test/unit/PhaseListenerTest.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam/src/test/java/org/jboss/seam/test/unit/PhaseListenerTest.java	2012-03-26 16:25:16 UTC (rev 14439)
+++ branches/community/Seam_2_3/jboss-seam/src/test/java/org/jboss/seam/test/unit/PhaseListenerTest.java	2012-03-27 21:41:17 UTC (rev 14440)
@@ -76,7 +76,7 @@
       return facesContext;
    }
    
-//   @Test
+   @Test
    public void testSeamPhaseListener()
    {
       MockFacesContext facesContext = createFacesContext();
@@ -92,7 +92,7 @@
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
       assert Contexts.isApplicationContextActive();
-//      assert Contexts.isConversationContextActive();
+      assert !Contexts.isConversationContextActive();
       
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE ) );
       
@@ -114,7 +114,8 @@
       
       phases.beforePhase( new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, MockLifecycle.INSTANCE ) );
       
-      assert facesContext.getViewRoot().getViewMap().size()==1;
+      // there is one additional item - conversationFound
+      assert facesContext.getViewRoot().getViewMap().size()==2;
       assert ( (FacesPage) getPageMap(facesContext).get( getPrefix() + Seam.getComponentName(FacesPage.class) ) ).getConversationId()==null;
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
@@ -137,7 +138,7 @@
    }
 
    @SuppressWarnings("serial")
-// @Test
+   @Test
    public void testSeamPhaseListenerLongRunning()
    {
       MockFacesContext facesContext = createFacesContext();
@@ -163,7 +164,7 @@
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
       assert Contexts.isApplicationContextActive();
-//      assert Contexts.isConversationContextActive();
+      assert !Contexts.isConversationContextActive();
       
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE ) );
       
@@ -209,7 +210,7 @@
       return facesContext.getViewRoot().getViewMap();
    }
 
-// @Test
+ @Test
    public void testSeamPhaseListenerNewLongRunning()
    {
       MockFacesContext facesContext = createFacesContext();
@@ -226,7 +227,7 @@
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
       assert Contexts.isApplicationContextActive();
-//      assert Contexts.isConversationContextActive();
+      assert !Contexts.isConversationContextActive();
       
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE ) );
       
@@ -257,7 +258,7 @@
       
       facesContext.getApplication().getStateManager().saveView(facesContext);
       
-      assert facesContext.getViewRoot().getViewMap().size()==1;
+      assert facesContext.getViewRoot().getViewMap().size()==2;
 
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, MockLifecycle.INSTANCE ) );
 
@@ -267,7 +268,7 @@
       assert !Contexts.isConversationContextActive();
    }
 
-// @Test
+ @Test
    public void testSeamPhaseListenerRedirect()
    {
       MockFacesContext facesContext = createFacesContext();
@@ -283,7 +284,7 @@
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
       assert Contexts.isApplicationContextActive();
-//      assert Contexts.isConversationContextActive();
+      assert !Contexts.isConversationContextActive();
       
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE ) );
       
@@ -308,8 +309,7 @@
       assert !Contexts.isApplicationContextActive();
       assert !Contexts.isConversationContextActive();
    }
-
-// @Test
+   @Test
    public void testSeamPhaseListenerNonFacesRequest()
    {
       MockFacesContext facesContext = createFacesContext();
@@ -325,7 +325,7 @@
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();
       assert Contexts.isApplicationContextActive();
-//      assert Contexts.isConversationContextActive();
+      assert !Contexts.isConversationContextActive();
       
       phases.afterPhase( new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, MockLifecycle.INSTANCE ) );
       
@@ -334,7 +334,7 @@
       
       phases.beforePhase( new PhaseEvent(facesContext, PhaseId.RENDER_RESPONSE, MockLifecycle.INSTANCE ) );
       
-      assert facesContext.getViewRoot().getViewMap().size()==1;
+      assert facesContext.getViewRoot().getViewMap().size()==2;
       assert ( (FacesPage) getPageMap(facesContext).get( getPrefix() + Seam.getComponentName(FacesPage.class) ) ).getConversationId()==null;
       assert Contexts.isEventContextActive();
       assert Contexts.isSessionContextActive();

Modified: branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java
===================================================================
--- branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2012-03-26 16:25:16 UTC (rev 14439)
+++ branches/community/Seam_2_3/seam-integration-tests/src/test/java/org/jboss/seam/test/integration/i8ln/LocaleTest.java	2012-03-27 21:41:17 UTC (rev 14440)
@@ -70,7 +70,7 @@
             
             // reset the locale configuration (as it would be w/o <i18n:locale-config>)
             getFacesContext().getApplication().setDefaultLocale(Locale.ENGLISH);
-            getFacesContext().getApplication().setSupportedLocales(null);
+            //getFacesContext().getApplication().setSupportedLocales(null);
             
             assert org.jboss.seam.international.Locale.instance().equals(Locale.getDefault());
             
@@ -117,9 +117,9 @@
             
             assert org.jboss.seam.international.Locale.instance().equals(Locale.ITALIAN);
             
-            assert LocaleSelector.instance().getSupportedLocales().size() == 1;
-            assert LocaleSelector.instance().getSupportedLocales().get(0).getValue().equals(Locale.ENGLISH.toString());
-            assert LocaleSelector.instance().getSupportedLocales().get(0).getLabel().equals(Locale.ENGLISH.getDisplayName());
+            assert LocaleSelector.instance().getSupportedLocales().size() ==3;
+            assert LocaleSelector.instance().getSupportedLocales().get(2).getValue().equals(Locale.ENGLISH.toString());
+            assert LocaleSelector.instance().getSupportedLocales().get(2).getLabel().equals(Locale.ENGLISH.getDisplayName());
 
             boolean failed = false;
             try



More information about the seam-commits mailing list