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 2012/02/15 17:06:10 UTC

svn commit: r1244559 - in /myfaces/core/trunk/impl/src/test: java/org/apache/myfaces/mc/test/core/ java/org/apache/myfaces/view/facelets/updateheadres/ java/org/apache/myfaces/view/facelets/updateheadres/managed/ resources/org/apache/myfaces/view/facel...

Author: lu4242
Date: Wed Feb 15 16:06:09 2012
New Revision: 1244559

URL: http://svn.apache.org/viewvc?rev=1244559&view=rev
Log:
MYFACES-3462 REGRESSION - Detect when to wpdate head or body target when content has been updated dynamically (add test case)

Added:
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java   (with props)
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/   (with props)
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js   (with props)
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css   (with props)
Modified:
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java?rev=1244559&r1=1244558&r2=1244559&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/AbstractMyFacesRequestTestCase.java Wed Feb 15 16:06:09 2012
@@ -55,6 +55,10 @@ public abstract class AbstractMyFacesReq
     {
         tearDownRequest();
         session = null;
+        if (client != null)
+        {
+            client.setTestCase(null);
+        }
         client = null;
         super.tearDown();
     }
@@ -107,7 +111,7 @@ public abstract class AbstractMyFacesReq
     
     protected MockMyFacesClient createClient()
     {
-        return new MockMyFacesClient(facesContext);
+        return new MockMyFacesClient(facesContext, this);
     }
     
     protected void tearDownRequest()
@@ -207,13 +211,16 @@ public abstract class AbstractMyFacesReq
      */
     protected void submit(UIComponent component) throws Exception
     {
+        client.submit(component);
+        /*
         processRemainingPhases();
         client.submit((UICommand)component);
         String viewId = facesContext.getViewRoot().getViewId();
         tearDownRequest();
         setupRequest(viewId);
+        */
     }
-
+    
     protected MockMyFacesClient client = null;
     
     // Servlet objects 

Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java?rev=1244559&r1=1244558&r2=1244559&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/mc/test/core/MockMyFacesClient.java Wed Feb 15 16:06:09 2012
@@ -55,9 +55,14 @@ public class MockMyFacesClient
     
     private final FacesContext facesContext;
     
-    public MockMyFacesClient(FacesContext facesContext)
+    // It has sense the client has a reference over the test, because 
+    // after all this class encapsulate some automatic operations
+    private AbstractMyFacesRequestTestCase testCase;
+    
+    public MockMyFacesClient(FacesContext facesContext, AbstractMyFacesRequestTestCase testCase)
     {
         this.facesContext = facesContext;
+        this.testCase = testCase;
     }
     
     public void inputText(UIInput input, String text)
@@ -65,7 +70,16 @@ public class MockMyFacesClient
         parameters.put(input.getClientId(), text);
     }
     
-    public void submit(UICommand command)
+    public void submit(UIComponent component) throws Exception
+    {
+        testCase.processRemainingPhases();
+        this.internalSubmit((UICommand)component);
+        String viewId = facesContext.getViewRoot().getViewId();
+        testCase.tearDownRequest();
+        testCase.setupRequest(viewId);
+    }
+    
+    protected void internalSubmit(UICommand command)
     {
         if (command instanceof HtmlCommandButton)
         {
@@ -97,6 +111,49 @@ public class MockMyFacesClient
         }
     }
     
+    public void ajax(UIComponent source, String event, String execute, String render, boolean submit) throws Exception
+    {
+        testCase.processRemainingPhases();
+        this.internalAjax(source, event, execute, render, submit);
+        String viewId = facesContext.getViewRoot().getViewId();
+        testCase.tearDownRequest();
+        testCase.setupRequest(viewId);
+    }
+    
+    public void internalAjax(UIComponent source, String event, String execute, String render, boolean submit)
+    {
+        parameters.put("javax.faces.partial.ajax", "true");
+        parameters.put("javax.faces.behavior.event", event);
+        parameters.put("javax.faces.partial.event", "action".equals(event) ? "click" : event);
+        parameters.put(ResponseStateManager.VIEW_STATE_PARAM, facesContext.getApplication().getStateManager().getViewState(facesContext));
+        parameters.put("javax.faces.source", source.getClientId(facesContext));
+        if (execute == null)
+        {
+            parameters.put("javax.faces.partial.execute", source.getClientId(facesContext));
+        }
+        else
+        {
+            parameters.put("javax.faces.partial.execute", execute);
+        }
+        if (render != null)
+        {
+            parameters.put("javax.faces.partial.render", render);
+        }
+        
+        if (submit)
+        {
+            parameters.put(source.getClientId(facesContext)+"_SUBMIT", "1");
+            parameters.put(source.getClientId(facesContext), source.getClientId(facesContext));
+        }
+        
+        MockHttpServletResponse response = (MockHttpServletResponse) facesContext.getExternalContext().getResponse(); 
+        Cookie cookie = response.getCookie("oam.Flash.RENDERMAP.TOKEN");
+        getCookies().put("oam.Flash.RENDERMAP.TOKEN", cookie);
+        
+        headers.put("Faces-Request", "partial/ajax");
+        headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
+    }
+    
     public Map<String, String> getParameters()
     {
         return parameters;
@@ -160,4 +217,14 @@ public class MockMyFacesClient
             request.addCookie(entry.getValue());
         }
     }
+
+    public AbstractMyFacesRequestTestCase getTestCase()
+    {
+        return testCase;
+    }
+
+    public void setTestCase(AbstractMyFacesRequestTestCase testCase)
+    {
+        this.testCase = testCase;
+    }
 }

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java Wed Feb 15 16:06:09 2012
@@ -0,0 +1,112 @@
+/*
+ * 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.updateheadres;
+
+import javax.faces.application.StateManager;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+
+import org.apache.myfaces.mc.test.core.AbstractMyFacesRequestTestCase;
+import org.apache.myfaces.shared.config.MyfacesConfig;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class UpdateHeadDynamicViewTestCase 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.updateheadres.managed");
+        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");
+        servletContext.addInitParameter("org.apache.myfaces.STRICT_JSF_2_REFRESH_TARGET_AJAX", "true");
+    }
+    
+    @Test
+    public void testNoUpdateScript1Head() throws Exception
+    {
+        setupRequest("/ajaxContent.xhtml");
+        processLifecycleExecuteAndRender();
+        
+        UIComponent content = facesContext.getViewRoot().findComponent("content");
+        UIComponent page1Button = facesContext.getViewRoot().findComponent("mainForm:page1");
+        
+        client.ajax((UICommand)page1Button, "action", page1Button.getClientId(facesContext), content.getClientId(facesContext), true);
+        
+        processLifecycleExecuteAndRender();
+        String text = getRenderedContent(facesContext);
+        // the inclusion should trigger update head
+        Assert.assertFalse(text.contains("update id=\"javax.faces.ViewHead\""));
+        //System.out.println(text);
+        tearDownRequest();
+    }
+    
+    @Test
+    public void testUpdateScript2Head() throws Exception
+    {
+        setupRequest("/ajaxContent.xhtml");
+        processLifecycleExecuteAndRender();
+        
+        UIComponent content = facesContext.getViewRoot().findComponent("content");
+        UIComponent page2Button = facesContext.getViewRoot().findComponent("mainForm:page2");
+        
+        client.ajax((UICommand)page2Button, "action", page2Button.getClientId(facesContext), content.getClientId(facesContext), true);
+        
+        processLifecycleExecuteAndRender();
+        
+        String text = getRenderedContent(facesContext);
+        // the inclusion should trigger update head
+        Assert.assertTrue(text.contains("update id=\"javax.faces.ViewHead\""));
+        Assert.assertTrue(text.contains("alert(\"script2\");"));
+        //System.out.println(text);
+        tearDownRequest();
+    }
+    
+    @Test
+    public void testUpdateScript3Head() throws Exception
+    {
+        setupRequest("/ajaxContent.xhtml");
+        processLifecycleExecuteAndRender();
+        
+        UIComponent content = facesContext.getViewRoot().findComponent("content");
+        UIComponent page3Button = facesContext.getViewRoot().findComponent("mainForm:page3");
+        
+        client.ajax((UICommand)page3Button, "action", page3Button.getClientId(facesContext), content.getClientId(facesContext), true);
+        
+        processLifecycleExecuteAndRender();
+        
+        String text = getRenderedContent(facesContext);
+        // the inclusion should trigger update head
+        Assert.assertTrue(text.contains("update id=\"javax.faces.ViewHead\""));
+        Assert.assertTrue(text.contains("alert(\"script3\");"));
+        Assert.assertTrue(text.contains("link rel=\"stylesheet\" media=\"screen\" type=\"text/css\" href=\"/test/faces/javax.faces.resource/style3.css\""));
+        //System.out.println(text);
+        tearDownRequest();
+    }
+   
+}

Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/UpdateHeadDynamicViewTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java Wed Feb 15 16:06:09 2012
@@ -0,0 +1,69 @@
+/*
+ * 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.updateheadres.managed;
+
+import java.io.Serializable;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import javax.faces.event.ActionEvent;
+
+@ManagedBean(name="ajaxContentBean")
+@ViewScoped
+public class AjaxContentBean implements Serializable
+{
+    private String page = "ajaxContent1";
+    
+    private String text;
+
+    public String getPage()
+    {
+        return page;
+    }
+
+    public void setPage(String page)
+    {
+        this.page = page;
+    }
+    
+    public void setPage1(ActionEvent event)
+    {
+        this.page = "ajaxContent1";
+    }
+    
+    public void setPage2(ActionEvent event)
+    {
+        this.page = "ajaxContent2";
+    }
+    
+    public void setPage3(ActionEvent event)
+    {
+        this.page = "ajaxContent3";
+    }
+
+    public String getText()
+    {
+        return text;
+    }
+
+    public void setText(String text)
+    {
+        this.text = text;
+    }
+}

Propchange: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/updateheadres/managed/AjaxContentBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml Wed Feb 15 16:06:09 2012
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ 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"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<h:head>
+    <script type="text/javascript">
+        window.myfaces = window.myfaces || {};
+        myfaces.config = myfaces.config || {}; 
+        myfaces.config.no_portlet_env = true; 
+    </script>
+    <h:outputScript library="javax.faces" name="jsf.js"/>
+</h:head>
+<h:body>
+<h:panelGroup id="header" layout="block">
+    <h1>Header</h1>
+</h:panelGroup>
+<h:panelGroup id="menu" layout="block">
+    <h:form id="mainForm">
+        <h:panelGrid columns="1">
+          <h:commandLink id="page1" value="Page 1" actionListener="#{ajaxContentBean.setPage1}">
+              <f:ajax render=":content"/>
+          </h:commandLink>
+          <h:commandLink id="page2" value="Page 2" actionListener="#{ajaxContentBean.setPage2}" >
+              <f:ajax render=":content"/>
+          </h:commandLink>
+          <h:commandLink id="page3" value="Page 3" actionListener="#{ajaxContentBean.setPage3}" >
+              <f:ajax render=":content"/>
+          </h:commandLink>
+          <h:commandLink id="page3all" value="Page 3 All" actionListener="#{ajaxContentBean.setPage3}" >
+              <f:ajax render="@all"/>
+          </h:commandLink>
+        </h:panelGrid>
+    </h:form>
+</h:panelGroup>
+<h:panelGroup id="content" layout="block">
+    <ui:include src="#{ajaxContentBean.page}.xhtml" />
+</h:panelGroup>
+</h:body>
+</html>

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml Wed Feb 15 16:06:09 2012
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ 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"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<head>
+</head>
+<body>
+<ui:composition>
+<f:subview id="ajaxContent1">
+<h:outputScript name="script1.js" target="head"/>
+<h:commandButton type="button" value="MSG" onclick="script1()"/>
+  Page 1 <h:outputText id="msg" value=" Great!"/>
+</f:subview>
+</ui:composition>
+</body>
+</html>

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent1.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml Wed Feb 15 16:06:09 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ 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"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<head>
+</head>
+<body>
+<ui:composition>
+<f:subview id="ajaxContent2">
+<h:outputScript target="head">
+script2 = function(){
+    alert("script2");
+}
+</h:outputScript>
+<h:commandButton type="button" value="MSG" onclick="script2()"/>
+  Page 2 <h:outputText id="msg" value=" Great!"/>
+  <h:form id="mainForm">
+    <h:inputText value="#{ajaxContentBean.text}"/>
+    <h:commandButton value="Submit">
+        <f:ajax execute="mainForm" render="mainForm"/>
+    </h:commandButton>
+  </h:form>
+</f:subview>
+</ui:composition>
+</body>
+</html>

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent2.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml Wed Feb 15 16:06:09 2012
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ 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"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ >
+<head>
+</head>
+<body>
+<ui:composition>
+<f:subview id="ajaxContent3">
+<h:outputStylesheet name="style3.css"/>
+<!-- 
+<h:outputScript name="script3.js" target="head"/>
+ -->
+<h:outputScript target="head">
+script3 = function(){
+    alert("script3");
+}
+</h:outputScript>
+<h:commandButton type="button" value="MSG" styleClass="myCustomBox" onclick="script3()"/>
+  Page 3 <h:outputText id="msg" value=" Great!"/>
+</f:subview>
+</ui:composition>
+</body>
+</html>

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/ajaxContent3.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js Wed Feb 15 16:06:09 2012
@@ -0,0 +1 @@
+//Dummy class to make work h:outputScript

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/javax.faces/jsf.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js Wed Feb 15 16:06:09 2012
@@ -0,0 +1,18 @@
+/* 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.
+ */
+script1 = function(){
+    alert("script1");
+}

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script1.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js Wed Feb 15 16:06:09 2012
@@ -0,0 +1,18 @@
+/* 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.
+ */
+script2 = function(){
+    alert("script2");
+}

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script2.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js Wed Feb 15 16:06:09 2012
@@ -0,0 +1,18 @@
+/* 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.
+ */
+script3 = function(){
+    alert("script3");
+}

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/script3.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css?rev=1244559&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css Wed Feb 15 16:06:09 2012
@@ -0,0 +1,18 @@
+/* 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.
+ */
+.myCustomBox {
+   background:red; 
+}

Propchange: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/updateheadres/resources/style3.css
------------------------------------------------------------------------------
    svn:eol-style = native