You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/10/27 00:04:13 UTC
svn commit: r1189498 [1/2] - in /myfaces/core/trunk/impl/src/test:
java/org/apache/myfaces/view/facelets/pss/
java/org/apache/myfaces/view/facelets/pss/acid/
java/org/apache/myfaces/view/facelets/pss/acid/component/
java/org/apache/myfaces/view/facelet...
Author: lu4242
Date: Wed Oct 26 22:04:12 2011
New Revision: 1189498
URL: http://svn.apache.org/viewvc?rev=1189498&view=rev
Log:
MYFACES-2935 Add acid test from state saving (thank to Richard from Kennard Consulting for provide this test cases)
Added:
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/ (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ (with props)
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/ (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/ (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/ (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml (with props)
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/toggle.xhtml (with props)
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,421 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid;
+
+import javax.faces.application.StateManager;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.html.HtmlDataTable;
+
+import junit.framework.Assert;
+
+import org.apache.myfaces.mc.test.core.AbstractMyFacesRequestTestCase;
+import org.apache.myfaces.shared.config.MyfacesConfig;
+import org.junit.Test;
+
+public class AcidMyFacesRequestTestCase extends AbstractMyFacesRequestTestCase
+{
+
+ @Override
+ protected boolean isScanAnnotations()
+ {
+ return true;
+ }
+
+ @Override
+ protected void setUpWebConfigParams() throws Exception
+ {
+ super.setUpWebConfigParams();
+ servletContext.addInitParameter("org.apache.myfaces.annotation.SCAN_PACKAGES","org.apache.myfaces.view.facelets.pss.acid");
+ servletContext.addInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/testcomponent.taglib.xml");
+ servletContext.addInitParameter(StateManager.STATE_SAVING_METHOD_PARAM_NAME, StateManager.STATE_SAVING_METHOD_CLIENT);
+ servletContext.addInitParameter("javax.faces.PARTIAL_STATE_SAVING", "true");
+ servletContext.addInitParameter(MyfacesConfig.INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, "auto");
+ }
+
+ @Test
+ public void testIndex() throws Exception
+ {
+ setupRequest("/index.xhtml");
+ processLifecycleExecuteAndRender();
+
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(1, comp.getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+
+ /*
+ MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
+ Assert.assertTrue(new String(writer1.content()).contains(
+ "<div style=\"border: 1px solid red; margin: 2px\">" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
+ "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
+ "</div>" +
+ "Dynamically added child" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
+ */
+ //System.out.println(writer1.content());
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(1, comp.getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ /*
+ MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
+ Assert.assertTrue(new String(writer2.content()).contains(
+ "<div style=\"border: 1px solid red; margin: 2px\">" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
+ "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
+ "</div>" +
+ "Dynamically added child" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
+ */
+ //System.out.println(writer2.content());
+ tearDownRequest();
+ }
+
+ @Test
+ public void testInput() throws Exception
+ {
+ setupRequest("/input.xhtml");
+ processLifecycleExecuteAndRender();
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+
+ Assert.assertEquals(1, comp.getChildCount());
+ Assert.assertEquals(1, comp.getChildren().get(0).getChildCount());
+ Assert.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
+ /*
+ MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
+ Assert.assertTrue(new String(writer1.content()).contains(
+ "<div style=\"border: 1px solid red; margin: 2px\">" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
+ "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
+ "</div>" +
+ "<span style=\"border: 1px dashed blue; padding: 5px; margin: 5px\">" +
+ "<input id=\"mainForm:input\" name=\"mainForm:input\" type=\"text\" value=\"Foo\" style=\"background-color: red\" />" +
+ "</span>" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
+ */
+ //System.out.println(writer1.content());
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(1, comp.getChildCount());
+ Assert.assertEquals(1, comp.getChildren().get(0).getChildCount());
+ Assert.assertEquals("mainForm:input", comp.getChildren().get(0).getChildren().get(0).getClientId(facesContext));
+
+ /*
+ MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
+ System.out.println(writer2.content());
+ Assert.assertTrue(new String(writer2.content()).contains(
+ "<div style=\"border: 1px solid red; margin: 2px\">" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">" +
+ "TestComponent::encodeBegin <span style=\"color: #888888\">(1 children)</span>" +
+ "</div>" +
+ "<span style=\"border: 1px dashed blue; padding: 5px; margin: 5px\">" +
+ "<input id=\"mainForm:input\" name=\"mainForm:input\" type=\"text\" value=\"Foo\" style=\"background-color: red\" />" +
+ "</span>" +
+ "<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>"));
+ */
+ }
+
+ @Test
+ public void testRecursive() throws Exception
+ {
+ setupRequest("/recursive.xhtml");
+ processLifecycleExecuteAndRender();
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals(1, comp.getChildren().get(1).getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals(1, comp.getChildren().get(1).getChildCount());
+ Assert.assertEquals("Dynamically added child", comp.getChildren().get(1).getChildren().get(0).getAttributes().get("value"));
+
+ tearDownRequest();
+ }
+
+ @Test
+ public void testStable() throws Exception
+ {
+ setupRequest("/stable.xhtml");
+ processLifecycleExecuteAndRender();
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(3, comp.getChildCount());
+ Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ Assert.assertEquals("text3", comp.getChildren().get(2).getId());
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(3, comp.getChildCount());
+ Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ Assert.assertEquals("text3", comp.getChildren().get(2).getId());
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(3, comp.getChildCount());
+ Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ Assert.assertEquals("text3", comp.getChildren().get(2).getId());
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ UIInput input = (UIInput) facesContext.getViewRoot().findComponent("mainForm:text3");
+ inputText(input, "3");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(3, comp.getChildCount());
+ Assert.assertEquals("1", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("2", comp.getChildren().get(1).getAttributes().get("value"));
+ Assert.assertEquals("text3", comp.getChildren().get(2).getId());
+
+ }
+
+ @Test
+ public void testTable() throws Exception
+ {
+ setupRequest("/table.xhtml");
+ processLifecycleExecuteAndRender();
+
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(1, comp.getChildCount());
+ HtmlDataTable dataTable = (HtmlDataTable) comp.getChildren().get(0);
+ Assert.assertEquals(1, dataTable.getChildCount());
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(1, comp.getChildCount());
+ dataTable = (HtmlDataTable) comp.getChildren().get(0);
+ Assert.assertEquals(1, dataTable.getChildCount());
+ }
+
+ @Test
+ public void testToggle() throws Exception
+ {
+ setupRequest("/toggle.xhtml");
+ processLifecycleExecuteAndRender();
+
+ UIComponent comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(1).getAttributes().get("value"));
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(1).getAttributes().get("value"));
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(1).getAttributes().get("value"));
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
+ submit(button);
+ processLifecycleExecuteAndRender();
+
+ comp = facesContext.getViewRoot().findComponent("mainForm:component");
+ Assert.assertEquals(2, comp.getChildCount());
+ Assert.assertEquals("Manually added child 1<br/>", comp.getChildren().get(0).getAttributes().get("value"));
+ Assert.assertEquals("Manually added child 2<br/>", comp.getChildren().get(1).getAttributes().get("value"));
+
+ }
+
+ @Test
+ public void testInclude() throws Exception
+ {
+ setupRequest("/include.xhtml");
+ processLifecycleExecute();
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+ //Set a token to save on the state as delta
+ UIComponent component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ component.getAttributes().put("test", "test1");
+ processRender();
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page1");
+ submit(button);
+ processLifecycleExecute();
+ //Check it is restored
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ Assert.assertEquals("test1", component.getAttributes().get("test"));
+ processRender();
+ //Check buildView does not destroy the state
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ Assert.assertEquals("test1", component.getAttributes().get("test"));
+
+ //Go to page2
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ //Check it is restored
+ Assert.assertEquals("test1", component.getAttributes().get("test"));
+
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+
+ //Check the page was changed and the state discarded, because it is a different component.
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertNull(component.getAttributes().get("test"));
+ //Set a token to save on the state as delta
+ component.getAttributes().put("test", "test2");
+ processRender();
+
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertEquals("test2", component.getAttributes().get("test"));
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ //Check it is restored
+ Assert.assertNotNull("mainForm:component2 was not restored correctly",component);
+ Assert.assertEquals("test2", component.getAttributes().get("test"));
+
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+
+ //Check buildView does not destroy the state
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertEquals("test2", component.getAttributes().get("test"));
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ //Check it is restored
+ Assert.assertEquals("test2", component.getAttributes().get("test"));
+ }
+
+ /**
+ * Same as testInclude, but only check the component is restored correctly.
+ * Since there is no delta, no state is saved unless it is necessary.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testInclude2() throws Exception
+ {
+ setupRequest("/include.xhtml");
+ processLifecycleExecute();
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+ //Set a token to save on the state as delta
+ UIComponent component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ Assert.assertNotNull(component);
+ processRender();
+
+ UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page1");
+ submit(button);
+
+ processLifecycleExecute();
+ //Check it is restored
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ Assert.assertNotNull(component);
+ processRender();
+ //Check buildView does not destroy the state
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ Assert.assertNotNull(component);
+
+ //Go to page2
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component1");
+ //Check it is restored
+ Assert.assertNotNull(component);
+
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+
+ //Check the page was changed and the state discarded, because it is a different component.
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertNotNull(component);
+ processRender();
+
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertNotNull(component);
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ //Check it is restored
+ Assert.assertNotNull(component);
+
+ //Build the view
+ facesContext.getApplication().getViewHandler().getViewDeclarationLanguage(
+ facesContext, facesContext.getViewRoot().getViewId()).buildView(facesContext, facesContext.getViewRoot());
+
+ //Check buildView does not destroy the state
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ Assert.assertNotNull(component);
+
+ button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:page2");
+ submit(button);
+
+ processLifecycleExecute();
+ component = facesContext.getViewRoot().findComponent("mainForm:component2");
+ //Check it is restored
+ Assert.assertNotNull(component);
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidMyFacesRequestTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid;
+
+import javax.faces.application.StateManager;
+
+public class AcidNoPssMyFacesRequestTestCase extends AcidMyFacesRequestTestCase
+{
+
+ @Override
+ protected void setUpWebConfigParams() throws Exception
+ {
+ super.setUpWebConfigParams();
+ servletContext.addInitParameter(StateManager.PARTIAL_STATE_SAVING_PARAM_NAME, "false");
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidNoPssMyFacesRequestTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid;
+
+import javax.faces.application.StateManager;
+
+import org.apache.myfaces.shared.config.MyfacesConfig;
+
+public class AcidPssRefreshMyFacesRequestTestCase extends AcidMyFacesRequestTestCase
+{
+
+ @Override
+ protected void setUpWebConfigParams() throws Exception
+ {
+ super.setUpWebConfigParams();
+ servletContext.addInitParameter(StateManager.PARTIAL_STATE_SAVING_PARAM_NAME, "true");
+ servletContext.addInitParameter(MyfacesConfig.INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, "true");
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshMyFacesRequestTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid;
+
+import javax.faces.application.StateManager;
+
+import org.apache.myfaces.shared.config.MyfacesConfig;
+
+public class AcidPssRefreshPreserveStateMyFacesRequestTestCase extends AcidMyFacesRequestTestCase
+{
+
+ @Override
+ protected void setUpWebConfigParams() throws Exception
+ {
+ super.setUpWebConfigParams();
+ servletContext.addInitParameter(StateManager.PARTIAL_STATE_SAVING_PARAM_NAME, "true");
+ servletContext.addInitParameter(MyfacesConfig.INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS, "true");
+ servletContext.addInitParameter(MyfacesConfig.INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE, "true");
+ }
+
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/AcidPssRefreshPreserveStateMyFacesRequestTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UIAddComponent")
+public class UIAddComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UIAddComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ if (!FacesContext.getCurrentInstance().isPostback())
+ {
+
+ HtmlOutputText component = new HtmlOutputText();
+ component.setValue("Dynamically added child");
+ getChildren().add(component);
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIAddComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlPanelGroup;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UIInputComponent")
+public class UIInputComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UIInputComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (!context.isPostback())
+ {
+
+ UIComponent originalComponent = getChildren().remove(0);
+
+ HtmlPanelGroup panelGroup = new HtmlPanelGroup();
+ panelGroup
+ .setStyle("border: 1px dashed blue; padding: 5px; margin: 5px");
+ getChildren().add(panelGroup);
+
+ // Move original HtmlInputText inside new HtmlPanelGroup
+
+ panelGroup.getChildren().add(originalComponent);
+ }
+ else
+ {
+ // If the algorithm do a refresh, the inputText is added again, but since it is inside
+ // the HtmlPanelGroup, it is not affected by the c:if add/delete algorithm. We need to
+ // remove that duplicate.
+ for (Iterator<UIComponent> it = getChildren().iterator(); it
+ .hasNext();)
+ {
+ if (it.next() instanceof HtmlInputText)
+ {
+ it.remove();
+ }
+ }
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIInputComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UIRecursiveComponent")
+public class UIRecursiveComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UIRecursiveComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ if (!FacesContext.getCurrentInstance().isPostback())
+ {
+
+ HtmlOutputText component = new HtmlOutputText();
+ component.setValue("Dynamically added child");
+ getChildren().add(component);
+
+ if (!(getParent() instanceof UIRecursiveComponent))
+ {
+ getChildren().add(new UIRecursiveComponent());
+ }
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIRecursiveComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UISelfRenderComponent")
+public class UISelfRenderComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UISelfRenderComponent()
+ {
+
+ setRendererType("testcomponentself");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ getChildren().add(getChildren().remove(0));
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UISelfRenderComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UIStableComponent")
+public class UIStableComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UIStableComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ if (FacesContext.getCurrentInstance().isPostback())
+ {
+ return;
+ }
+
+ if (FacesContext.getCurrentInstance().getMaximumSeverity() != null)
+ {
+ return;
+ }
+
+ HtmlInputText inputText1 = new HtmlInputText();
+ inputText1.setValue("1");
+ getChildren().add(inputText1);
+
+ HtmlInputText inputText2 = new HtmlInputText();
+ inputText2.setValue("2");
+ getChildren().add(inputText2);
+
+ HtmlInputText inputText3 = new HtmlInputText();
+ inputText3.setId("text3");
+ inputText3.setRequired(true);
+ getChildren().add(inputText3);
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIStableComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.application.Application;
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UITableComponent")
+public class UITableComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UITableComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (!context.isPostback())
+ {
+
+ Application application = context.getApplication();
+
+ HtmlDataTable dataTable = new HtmlDataTable();
+ dataTable.setVar("_internal");
+ dataTable.setValueExpression(
+ "value",
+ application.getExpressionFactory().createValueExpression(
+ context.getELContext(), "#{testManagedBean.list}",
+ Object.class));
+ getChildren().add(dataTable);
+
+ UIColumn column = new UIColumn();
+ column.setId(context.getViewRoot().createUniqueId());
+ dataTable.getChildren().add(column);
+
+ HtmlOutputText outputText = new HtmlOutputText();
+ outputText.setId(context.getViewRoot().createUniqueId());
+ outputText.setValueExpression(
+ "value",
+ application.getExpressionFactory().createValueExpression(
+ context.getELContext(), "#{_internal}",
+ Object.class));
+ column.getChildren().add(outputText);
+ }
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UITableComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.component;
+
+import javax.faces.component.FacesComponent;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PreRenderViewEvent;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+
+@FacesComponent(value = "com.myapp.UIToggleComponent")
+public class UIToggleComponent extends UIComponentBase implements
+ SystemEventListener
+{
+
+ //
+ // Constructor
+ //
+
+ public UIToggleComponent()
+ {
+
+ setRendererType("testcomponent");
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UIViewRoot root = context.getViewRoot();
+
+ root.subscribeToViewEvent(PreRenderViewEvent.class, this);
+ }
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public String getFamily()
+ {
+
+ return "com.myapp";
+ }
+
+ public boolean isListenerForSource(Object source)
+ {
+
+ return (source instanceof UIViewRoot);
+ }
+
+ public void processEvent(SystemEvent event) throws AbortProcessingException
+ {
+
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (!facesContext.isPostback())
+ {
+ HtmlOutputText text1 = new HtmlOutputText();
+ text1.setId(facesContext.getViewRoot().createUniqueId());
+ text1.setValue("Manually added child 1<br/>");
+ text1.setEscape(false);
+ getChildren().add(text1);
+
+ HtmlOutputText text2 = new HtmlOutputText();
+ text2.setId(facesContext.getViewRoot().createUniqueId());
+ text2.setValue("Manually added child 2<br/>");
+ text2.setEscape(false);
+ getChildren().add(text2);
+
+ //<h:outputText value="Manually added child 1<br/>" escape="false"/>
+ //<h:outputText value="Manually added child 2<br/>" escape="false"/>
+ }
+
+ UIComponent component = getChildren().remove(0);
+ getChildren().add(component);
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/component/UIToggleComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.managed;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.event.ActionEvent;
+
+@ManagedBean(name="testManagedBean")
+public class ProbeManagedBean {
+
+ private static final List<String> LIST;
+
+ static {
+
+ LIST = new ArrayList<String>();
+ LIST.add( "Foo" );
+ LIST.add( "Bar" );
+ LIST.add( "Baz" );
+ }
+
+ public List<String> getList() {
+
+ return LIST;
+ }
+
+ private String page = "page1.xhtml";
+
+ public String getPage()
+ {
+ return page;
+ }
+
+ public void setPage(String page)
+ {
+ this.page = page;
+ }
+
+ public void page1(ActionEvent evt)
+ {
+ setPage("page1.xhtml");
+ }
+
+ public void page2(ActionEvent evt)
+ {
+ setPage("page2.xhtml");
+ }
+
+ public void save() {
+
+ // Do nothing. Just a way to POSTback
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/managed/ProbeManagedBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java Wed Oct 26 22:04:12 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.view.facelets.pss.acid.renderkit;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.FacesRenderer;
+import javax.faces.render.Renderer;
+
+@FacesRenderer(componentFamily = "com.myapp", rendererType = "testcomponent")
+public class ProbeComponentRenderer extends Renderer
+{
+
+ //
+ // Public methods
+ //
+
+ @Override
+ public void encodeBegin(FacesContext context, UIComponent component)
+ throws IOException
+ {
+
+ context.getResponseWriter()
+ .write("<div style=\"border: 1px solid red; margin: 2px\"><div style=\"background-color: #ffc0c0; padding: 2px; margin-bottom: 5px; display:block\">TestComponent::encodeBegin <span style=\"color: #888888\">("
+ + component.getChildCount() + " children)</span></div>");
+
+ super.encodeBegin(context, component);
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component)
+ throws IOException
+ {
+
+ super.encodeEnd(context, component);
+
+ context.getResponseWriter()
+ .write("<div style=\"background-color: #ffc0c0; padding: 2px; margin-top: 5px; display:block\">TestComponent::encodeEnd</div></div>");
+ }
+}
Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/pss/acid/renderkit/ProbeComponentRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/
------------------------------------------------------------------------------
bugtraq:number = true
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE facelet-taglib PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib>
+ <namespace>http://testcomponent</namespace>
+
+ <tag>
+ <tag-name>addcomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UIAddComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>togglecomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UIToggleComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>recursivecomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UIRecursiveComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>stablecomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UIStableComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>inputcomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UIInputComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>tablecomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UITableComponent</component-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>selfrendercomponent</tag-name>
+ <component>
+ <component-type>com.myapp.UISelfRenderComponent</component-type>
+ </component>
+ </tag>
+
+</facelet-taglib>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/WEB-INF/testcomponent.taglib.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <body>
+
+ <h1>SystemEvent Acid Test</h1>
+ <h3>JSF Implementation: #{facesContext.application.class.package.implementationTitle} #{facesContext.application.class.package.implementationVersion}</h3>
+
+ <p>
+ This WAR tests aspects of JSF SystemEvent handling. Click on each test below:
+ </p>
+
+ <ol>
+ <li><a href="index.jsf">Add test</a></li>
+ <li><a href="toggle.jsf">Toggle test</a></li>
+ <li><a href="recursive.jsf">Recursive test</a></li>
+ <li><a href="stable.jsf">Stable test</a></li>
+ <li><a href="input.jsf">Input test</a></li>
+ <li><a href="table.jsf">Table test</a></li>
+ </ol>
+
+ <hr/>
+
+ <ui:insert />
+
+ </body>
+</html>
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/common.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,29 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+<h:head>
+</h:head>
+<h:body>
+<h:form id="mainForm">
+<ui:include src="#{testManagedBean.page}"/>
+<h:commandButton id="page1" value="Go to 1" actionListener="#{testManagedBean.page1}"/>
+<h:commandButton id="page2" value="Go to 2" actionListener="#{testManagedBean.page2}"/>
+</h:form>
+</h:body>
+</html>
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/include.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:test="http://testcomponent"
+ template="common.xhtml">
+
+ <h2>Add Test Instructions</h2>
+
+ <ol>
+ <li>The component should have dynamically modified the tree so that 'Dynamically added child' appears inside the red box</li>
+ <li>Click 'POSTback'. The 'Dynamically added child' should not disappear (because it should have been serialized in the ViewState)</li>
+ </ol>
+
+ <h:messages/>
+
+ <h:form id="mainForm">
+
+ <test:addcomponent id="component"/>
+
+ <br/>
+
+ <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
+
+ </h:form>
+
+</ui:composition>
+
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/index.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:test="http://testcomponent"
+ template="common.xhtml">
+
+ <h2>Input Test Instructions</h2>
+
+ <ol>
+ <li>The component should have dynamically modified the tree so that it has added an HtmlPanelGroup (with a dashed blue border)</li>
+ <li>The component should have moved the textbox originally declared in the XHTML page (with a red background) inside the dynamically added HtmlPanelGroup</li>
+ <li>Click 'POSTback'. There should be no error, and the textbox should stay inside the dashed blue border</li>
+ </ol>
+
+ <h:messages/>
+
+ <h:form id="mainForm">
+
+ <test:inputcomponent id="component">
+ <h:inputText id="input" value="Foo" style="background-color: red"/>
+ </test:inputcomponent>
+
+ <br/>
+
+ <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
+
+ </h:form>
+
+</ui:composition>
+
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/input.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+<h:outputText id="component1" value="Page 1"/>
+</ui:composition>
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page1.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+<h:outputText id="component2" value="Page 2"/>
+</ui:composition>
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/page2.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:test="http://testcomponent"
+ template="common.xhtml">
+
+ <h2>Recursive Test Instructions</h2>
+
+ <ol>
+ <li>The component should have dynamically modified the tree so that 'Dynamically added child' appears inside the red box</li>
+ <li>There should be a nested component that also contains 'Dynamically added child' inside the red box</li>
+ <li>Click 'POSTback'. Nothing should disappear (because it should have been serialized in the ViewState)</li>
+ </ol>
+
+ <h:messages/>
+
+ <h:form id="mainForm">
+
+ <test:recursivecomponent id="component"/>
+
+ <br/>
+
+ <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
+
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/recursive.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,43 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:test="http://testcomponent"
+ template="common.xhtml">
+
+ <h2>Stable Test Instructions</h2>
+
+ <ol>
+ <li>3 text boxes should have been dynamically added inside the component. The first two should display '1' and '2'. The third should be blank</li>
+ <li>The first two boxes will receive an auto-generated id. The third box has had its id set programmatically</li>
+ <li>The third box is a required field, so when you click 'POSTback' you should see a 'Value is required' message</li>
+ <li>Keep clicking 'POSTback'. The order of the boxes should not change - it should remain stable</li>
+ </ol>
+
+ <h:messages/>
+
+ <h:form id="mainForm">
+
+ <test:stablecomponent id="component"/>
+
+ <br/>
+
+ <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
+
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/stable.xhtml
------------------------------------------------------------------------------
svn:eol-style = native
Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml?rev=1189498&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml Wed Oct 26 22:04:12 2011
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ 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.
+-->
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:test="http://testcomponent"
+ template="common.xhtml">
+
+ <h2>Table Test Instructions</h2>
+
+ <ol>
+ <li>The component should have dynamically created a HtmlDataTable</li>
+ <li>
+ The 'dynamic creation' code has subtle similarities to the 're-use same component on each row' code within HtmlDataTable. Specifically
+ if the 'dynamic creation' code is hooking in to 'setParent' then it might get triggered by HtmlDataTable
+ </li>
+ <li>Click 'POSTback'. There should be no error</li>
+ </ol>
+
+ <h:messages/>
+
+ <h:form id="mainForm">
+
+ <test:tablecomponent id="component"/>
+
+ <br/>
+
+ <h:commandButton id="postback" value="POSTback" action="#{testManagedBean.save}"/>
+
+ </h:form>
+
+</ui:composition>
\ No newline at end of file
Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/pss/acid/table.xhtml
------------------------------------------------------------------------------
svn:eol-style = native