myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r393660 - in /myfaces/core/branches/1_1_2/impl: ./ src/main/java/org/apache/myfaces/application/jsp/ src/test/java/org/apache/myfaces/application/ src/test/java/org/apache/myfaces/application/jsp/
Date Wed, 12 Apr 2006 23:44:28 GMT
Author: schof
Date: Wed Apr 12 16:44:26 2006
New Revision: 393660

URL: http://svn.apache.org/viewcvs?rev=393660&view=rev
Log:
Fixes MYFACES-1281  (apparently i forgot to commit this last night.)

Added:
    myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/
    myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/
    myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/JspStateManagerImplTest.java
Modified:
    myfaces/core/branches/1_1_2/impl/pom.xml
    myfaces/core/branches/1_1_2/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java

Modified: myfaces/core/branches/1_1_2/impl/pom.xml
URL: http://svn.apache.org/viewcvs/myfaces/core/branches/1_1_2/impl/pom.xml?rev=393660&r1=393659&r2=393660&view=diff
==============================================================================
--- myfaces/core/branches/1_1_2/impl/pom.xml (original)
+++ myfaces/core/branches/1_1_2/impl/pom.xml Wed Apr 12 16:44:26 2006
@@ -155,7 +155,7 @@
                 <artifactItem>
                    <groupId>org.apache.myfaces.shared</groupId>
                    <artifactId>myfaces-shared-impl</artifactId>
-                   <version>2.0.1-SNAPSHOT</version>
+                   <version>2.0.0-SNAPSHOT</version>
                  </artifactItem>
                </artifactItems>
                <outputDirectory>${project.build.directory}/classes</outputDirectory>

Modified: myfaces/core/branches/1_1_2/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
URL: http://svn.apache.org/viewcvs/myfaces/core/branches/1_1_2/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java?rev=393660&r1=393659&r2=393660&view=diff
==============================================================================
--- myfaces/core/branches/1_1_2/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
(original)
+++ myfaces/core/branches/1_1_2/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
Wed Apr 12 16:44:26 2006
@@ -58,7 +58,7 @@
 /**
  * Default StateManager implementation for use when views are defined
  * via tags in JSP pages.
- * 
+ *
  * @author Thomas Spiegl (latest modification by $Author$)
  * @author Manfred Geiler
  * @version $Revision$ $Date$
@@ -518,6 +518,11 @@
                     // use latest sequence
                     Map map = externalContext.getSessionMap();
                     sequence = (Integer) map.get(RendererUtils.SEQUENCE_PARAM);
+
+                    if (sequence == null)
+                    {
+                        sequence = (Integer) externalContext.getRequestMap().get(RendererUtils.SEQUENCE_PARAM);
+                    }
                 }
                 else
                 {
@@ -542,7 +547,7 @@
     {
         ExternalContext externalContext = facescontext.getExternalContext();
         Object sessionObj = externalContext.getSession(true);
-        synchronized(sessionObj) // synchronized to increase sequence if multiple requests

+        synchronized(sessionObj) // synchronized to increase sequence if multiple requests
                                  // are handled at the same time for the session
         {
             Map map = externalContext.getSessionMap();

Added: myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/JspStateManagerImplTest.java
URL: http://svn.apache.org/viewcvs/myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/JspStateManagerImplTest.java?rev=393660&view=auto
==============================================================================
--- myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/JspStateManagerImplTest.java
(added)
+++ myfaces/core/branches/1_1_2/impl/src/test/java/org/apache/myfaces/application/jsp/JspStateManagerImplTest.java
Wed Apr 12 16:44:26 2006
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2004-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.application.jsp;
+
+//import org.apache.myfaces.shared_impl.config.MyfacesConfig;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.apache.shale.test.mock.MockResponseWriter;
+import org.apache.myfaces.application.MyfacesStateManager;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIOutput;
+import javax.faces.validator.LengthValidator;
+import javax.faces.application.StateManager;
+import javax.faces.render.RenderKitFactory;
+import java.io.BufferedWriter;
+import java.io.CharArrayWriter;
+
+public class JspStateManagerImplTest extends AbstractJsfTestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(JspStateManagerImplTest.class);
+    }
+
+    public JspStateManagerImplTest(String name) {
+        super(name);
+    }
+
+    /**
+     * New test to address an issue uncovered through TCK testing.
+     */
+    public void testWriteAndRestoreState() throws Exception
+    {
+        // additional setup not provided automatically by the shale mock stuff
+        facesContext.setResponseWriter(new MockResponseWriter(new BufferedWriter(new CharArrayWriter()),
null, null));
+
+        UIViewRoot viewRoot = facesContext.getViewRoot();
+        viewRoot.setViewId("/root");
+        StateManager stateManager = new JspStateManagerImpl();
+
+        UIOutput output = new UIOutput();
+        output.setValue("foo");
+        output.setId("foo");
+
+        stateManager.writeState(facesContext, stateManager.saveSerializedView(facesContext));
+
+        UIViewRoot restoredViewRoot = stateManager.restoreView(facesContext, "/root", RenderKitFactory.HTML_BASIC_RENDER_KIT);
+        assertNotNull("restored view root should not be null", restoredViewRoot);
+    }
+
+    // Return the tests included in this test case.
+    public static Test suite()
+    {
+        return (new TestSuite(JspStateManagerImplTest.class));
+    }
+}



Mime
View raw message