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 2010/07/28 02:57:50 UTC

svn commit: r979920 [1/2] - in /myfaces/core/trunk/impl/src: main/java/org/apache/myfaces/view/facelets/tag/ main/java/org/apache/myfaces/view/facelets/tag/ui/ test/java/org/apache/myfaces/view/facelets/tag/ui/template/ test/resources/org/apache/myface...

Author: lu4242
Date: Wed Jul 28 00:57:48 2010
New Revision: 979920

URL: http://svn.apache.org/viewvc?rev=979920&view=rev
Log:
MYFACES-2753 Trivial multi-level templating does not work if ui:include is used

Added:
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java
    myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition4.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionTrim.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate4.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1_2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1_3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/template1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/template2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/template3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/template4.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/user.taglib.xml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag5.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag7.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag8.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTag8_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest2.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest3.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest3_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest4.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest4_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest5.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest5_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest6.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest6_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest7.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest7_1.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest8.xhtml
    myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/userTagTest8_1.xhtml
Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java?rev=979920&r1=979919&r2=979920&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java Wed Jul 28 00:57:48 2010
@@ -38,7 +38,9 @@ import javax.faces.view.facelets.TagHand
 
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.TemplateClient;
+import org.apache.myfaces.view.facelets.TemplateContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
+import org.apache.myfaces.view.facelets.impl.TemplateContextImpl;
 import org.apache.myfaces.view.facelets.tag.ui.DefineHandler;
 
 /**
@@ -109,6 +111,7 @@ final class UserTagHandler extends TagHa
         // eval include
         try
         {
+            actx.pushTemplateContext(new TemplateContextImpl());
             actx.pushClient(this);
             ctx.includeFacelet(parent, this._location);
         }
@@ -121,6 +124,7 @@ final class UserTagHandler extends TagHa
 
             // make sure we undo our changes
             actx.popClient(this);
+            actx.popTemplateContext();
             ctx.setVariableMapper(orig);
         }
     }
@@ -137,7 +141,16 @@ final class UserTagHandler extends TagHa
             DefineHandler handler = (DefineHandler) this._handlers.get(name);
             if (handler != null)
             {
-                handler.applyDefinition(ctx, parent);
+                AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
+                TemplateContext itc = actx.popTemplateContext();
+                try
+                {
+                    handler.applyDefinition(ctx, parent);
+                }
+                finally
+                {
+                    actx.pushTemplateContext(itc);
+                }
                 return true;
             }
             else
@@ -147,7 +160,16 @@ final class UserTagHandler extends TagHa
         }
         else
         {
-            this.nextHandler.apply(ctx, parent);
+            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
+            TemplateContext itc = actx.popTemplateContext();
+            try
+            {
+                this.nextHandler.apply(ctx, parent);
+            }
+            finally
+            {
+                actx.pushTemplateContext(itc);
+            }
             return true;
         }
     }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java?rev=979920&r1=979919&r2=979920&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/IncludeHandler.java Wed Jul 28 00:57:48 2010
@@ -38,6 +38,7 @@ import org.apache.myfaces.shared_impl.ut
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
+import org.apache.myfaces.view.facelets.impl.TemplateContextImpl;
 import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
 
 /**
@@ -86,6 +87,7 @@ public final class IncludeHandler extend
     public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
             ELException
     {
+        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
         String path = this.src.getValue(ctx);
         if (path == null || path.length() == 0)
         {
@@ -107,11 +109,28 @@ public final class IncludeHandler extend
                     // fallback
                     url = getClass().getClassLoader().getResource(ERROR_FACELET);
                 }
-                ctx.includeFacelet(parent, url);
+
+                try
+                {
+                    actx.pushTemplateContext(new TemplateContextImpl());
+                    ctx.includeFacelet(parent, url);
+                }
+                finally
+                {
+                    actx.popTemplateContext();
+                }
             }
             else
             {
-                ctx.includeFacelet(parent, path);
+                try
+                {
+                    actx.pushTemplateContext(new TemplateContextImpl());
+                    ctx.includeFacelet(parent, path);
+                }
+                finally
+                {
+                    actx.popTemplateContext();
+                }
             }
         }
         finally

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/CompositionTestCase.java Wed Jul 28 00:57:48 2010
@@ -0,0 +1,344 @@
+/*
+ * 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.tag.ui.template;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CompositionTestCase extends FaceletTestCase {
+
+    @Override
+    protected void setUpServletObjects() throws Exception
+    {
+        super.setUpServletObjects();
+        servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_SKIP_COMMENTS, "true");
+    }
+
+    /**
+     * Test if ui:composition is used on a page without a reference to a
+     * template, it should trim everything outside the template
+     * @throws Exception
+     */
+    @Test
+    public void testCompositionTrimEffect() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "compositionTrim.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+
+    /**
+     * Test if ui:composition is used on a page with a reference to a
+     * template, it should trim everything, but take its content and insert it
+     * on a template ui:insert without name spot if available. It also test
+     * if no definition for a ui:insert with name is set, just render the content
+     * inside ui:insert 
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testComposition1() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "composition1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber1"));
+        Assert.assertTrue(response.contains("compositionContent"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+
+    /**
+     * An empty ui:composition does not means the content of a ui:insert without
+     * name to be rendered
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testComposition2EmptyComposition() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "composition2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+    
+    /**
+     * An empty ui:composition does not means the content of a ui:insert without
+     * name to be rendered
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testComposition3EmptyComposition() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "composition3.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+    
+    /**
+     * A ui:define takes precedence over a ui:insert
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testComposition4DefineOverInsert() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "composition4.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber1"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+    
+    /**
+     * A ui:insert on nested composition takes the top TemplateClient.
+     * 
+     * In few words, ui:composition acts like a decorator pattern, so it allows
+     * override all definitions from other templates that uses ui:composition
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testComposition5() throws Exception {
+        /*
+        composition5.xhtml
+
+        <ui:composition template="/composition5_1.xhtml">
+            composition5Content
+        </ui:composition>
+
+        composition5_1.xhtml
+
+        <ui:composition template="/composition5_2.xhtml">
+            start first composition
+            <ui:insert />
+            end first composition
+        </ui:composition>
+
+        composition5_2.xhtml
+
+        <ui:composition>      
+            start second composition
+            <ui:insert/>
+            end second composition
+        </ui:composition>
+
+        Result
+
+            start second composition
+            composition5Content
+            end second composition
+        */
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "composition5.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+        
+        response = checkStringInOrder(response, "start second composition");
+        response = checkStringInOrder(response, "composition5Content");
+        response = checkStringInOrder(response, "end second composition");        
+    }
+    
+    private String checkStringInOrder(String response, String token)
+    {
+        int pos = response.indexOf(token);
+        Assert.assertTrue(pos > -1);
+        return response.substring(pos+token.length());
+    }
+    
+    
+    /**
+     * An ui:define on the outer most composition takes precedence over
+     * the inner one.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testCompositionNested1() throws Exception {
+        /*
+
+        compositionNested1.xhtml
+
+        <ui:composition template="/composition4.xhtml">
+        <ui:define name="fragment1">
+        fragmentNumber2
+        </ui:define>
+        </ui:composition>
+
+        composition4.xhtml
+
+        <ui:composition template="/template1.xhtml">
+        <ui:define name="fragment1">
+        fragmentNumber1
+        </ui:define>
+        </ui:composition>
+
+        template1.xhtml
+
+        <ui:composition>
+        <ui:insert>
+        This fragment will not be inserted
+        </ui:insert>
+        <ui:insert name="fragment1">
+        fragmentNumber1
+        </ui:insert>
+        </ui:composition>
+
+        Response
+
+        fragmentNumber2
+
+         */
+
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "compositionNested1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber2"));
+        Assert.assertFalse(response.contains("fragmentNumber1"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+    }
+    
+    @Test
+    public void testCompositionNested2() throws Exception
+    {
+        /*
+        
+        compositeNested2.xhtml
+        
+        <ui:composition template="/compositionNested2_1.xhtml">
+          <ui:define name="fragment1">
+            compositionNested2Content
+          </ui:define>
+        </ui:composition>
+      
+        compositeNested2_1.xhtml
+        
+        <ui:composition>
+            start first decoration
+            <ui:decorate template="/compositionNested2_2.xhtml">
+              <ui:define name="fragment1">
+                start inner text
+                  <ui:insert name="fragment1"/>
+                end inner text
+              </ui:define>
+            </ui:decorate>
+            end first decoration
+        </ui:composition>
+            
+        compositeNested2_2.xhtml
+        
+        <ui:composition>
+          start second composition
+            <ui:insert name="fragment1"/>
+          end second composition
+        </ui:composition>
+        
+        Response
+
+            start first decoration
+            start second composition
+            start inner text
+            compositionNested2Content
+            end inner text
+            end second composition
+            end first decoration
+        */
+      
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "compositionNested2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("THIS SHOULD NOT BE RENDERED"));
+        
+        response = checkStringInOrder(response, "start first decoration");
+        response = checkStringInOrder(response, "start second composition");
+        response = checkStringInOrder(response, "start inner text");
+        response = checkStringInOrder(response, "compositionNested2Content");
+        response = checkStringInOrder(response, "end inner text");
+        response = checkStringInOrder(response, "end second composition");
+        response = checkStringInOrder(response, "end first decoration");
+    }
+}

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/DecorateTestCase.java Wed Jul 28 00:57:48 2010
@@ -0,0 +1,325 @@
+/*
+ * 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.tag.ui.template;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DecorateTestCase extends FaceletTestCase {
+
+    @Override
+    protected void setUpServletObjects() throws Exception
+    {
+        super.setUpServletObjects();
+        servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_SKIP_COMMENTS, "true");
+    }
+
+    @Test
+    public void testDecorate1() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorate1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber1"));
+        Assert.assertTrue(response.contains("decorateContent"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+    }
+    
+    @Test
+    public void testDecorate2EmptyDecorate() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorate2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+    }
+    
+    @Test
+    public void testDecorate3EmptyDecorate() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorate3.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+    }
+    
+    @Test
+    public void testDecorate4DefineOverInsert() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorate4.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber1"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+    }
+    
+    /**
+     * Based on
+     * 
+     * https://facelets.dev.java.net/issues/show_bug.cgi?id=256
+     * 
+     * In few words it says how two nested ui:decorate tags should be resolved.
+     * Note the difference between ui:composition and ui:decorate. Since the first one
+     * trims everything above and below, the page author can only use once per view, but
+     * with ui:decorate you can use more than once per view. Additionally, an ui:insert
+     * inside a ui:decorate, should take into account the outer one first.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testDecorate5() throws Exception 
+    {
+        /*
+        decorate5.xhtml
+
+        <ui:decorate template="/decorate5_1.xhtml">
+        decorate5Content
+        </ui:decorate>
+
+        decorate5_1.xhtml
+
+        <ui:composition>
+            start first decoration
+            <ui:decorate template="/decorate5_2.xhtml">
+              start inner text
+              <ui:insert />
+              end inner text
+            </ui:decorate>
+            end first decoration
+        </ui:composition>
+
+        decorate5_2.xhtml
+
+        <ui:composition>      
+            start second decoration
+            <ui:insert/>
+            end second decoration
+        </ui:composition>
+
+        Result
+
+            start first decoration
+             start second decoration
+              start inner text
+               decorate5Content
+              end inner text
+             end second decoration
+            end first decoration
+        */
+
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorate5.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+        
+        response = checkStringInOrder(response, "start first decoration");
+        response = checkStringInOrder(response, "start second decoration");
+        response = checkStringInOrder(response, "start inner text");
+        response = checkStringInOrder(response, "decorate5Content");
+        response = checkStringInOrder(response, "end inner text");
+        response = checkStringInOrder(response, "end second decoration");
+        response = checkStringInOrder(response, "end first decoration");
+    }
+    
+    private String checkStringInOrder(String response, String token)
+    {
+        int pos = response.indexOf(token);
+        Assert.assertTrue(pos > -1);
+        return response.substring(pos+token.length());
+    }
+
+    /**
+     * An outer ui:decorate definition takes precedence over an inner
+     * ui:composition definition.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testDecorateNested1() throws Exception {
+        /*
+        decorate4.xhtml
+
+        <ui:decorate template="/composition4.xhtml">
+          <ui:define name="fragment1">
+            fragmentNumber2
+          </ui:define>
+        fragmentNumber3
+        </ui:decorate>
+
+        composition4.xhtml
+
+        <ui:composition template="/template1.xhtml">
+          <ui:define name="fragment1">
+            fragmentNumber1
+          </ui:define>
+        </ui:composition>
+
+        template1.xhtml
+
+        <ui:composition>
+          <ui:insert>
+            This fragment will not be inserted
+          </ui:insert>
+          <ui:insert name="fragment1">
+            fragmentNumber1
+          </ui:insert>
+        </ui:composition>
+
+        Response
+
+            fragmentNumber3
+            fragmentNumber2
+
+        */
+
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorateNested1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        Assert.assertTrue(response.contains("fragmentNumber3"));
+        Assert.assertTrue(response.contains("fragmentNumber2"));
+        Assert.assertFalse(response.contains("fragmentNumber1"));
+        Assert.assertFalse(response.contains("This fragment will not be inserted"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED"));
+        Assert.assertTrue(response.contains("THIS SHOULD BE RENDERED TOO"));
+    }
+    
+    
+    @Test
+    public void testDecorateNested2() throws Exception
+    {
+        /*
+        decorateNested2.xhtml
+        
+        <ui:composition>
+          <ui:decorate template="/decorateNested2_1.xhtml">
+            <ui:define name="fragment1">
+              decorateNested2Content
+            </ui:define>
+          </ui:decorate>
+        </ui:composition>
+      
+        decorateNested2_1.xhtml
+        
+        <ui:composition>
+            start first decoration
+            <ui:decorate template="/decorateNested2_2.xhtml">
+              <ui:define name="fragment1">
+                start inner text
+                  <ui:insert name="fragment1"/>
+                end inner text
+              </ui:define>
+            </ui:decorate>
+            end first decoration
+        </ui:composition>
+        
+        decorateNested2_2.xhtml
+    
+        <ui:composition>
+            start second composition
+            <ui:insert name="fragment1"/>
+            end second composition
+        </ui:composition>
+        
+        Response
+        
+        start first decoration
+        start second composition
+        start inner text
+        decorateNested2Content
+        end inner text
+        end second composition
+        end first decoration
+        
+        */
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "decorateNested2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+
+        response = checkStringInOrder(response, "start first decoration");
+        response = checkStringInOrder(response, "start second composition");
+        response = checkStringInOrder(response, "start inner text");
+        response = checkStringInOrder(response, "decorateNested2Content");
+        response = checkStringInOrder(response, "end inner text");
+        response = checkStringInOrder(response, "end second composition");
+        response = checkStringInOrder(response, "end first decoration");
+    }
+}

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/IncludeTestCase.java Wed Jul 28 00:57:48 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.tag.ui.template;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class IncludeTestCase extends FaceletTestCase
+{
+    
+    @Override
+    protected void setUpServletObjects() throws Exception
+    {
+        super.setUpServletObjects();
+        servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_SKIP_COMMENTS, "true");
+    }
+    
+    @Test
+    public void testIncludeIsolation1() throws Exception {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "includeIsolation1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+    }
+
+}

Added: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java (added)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/template/UserTagTestCase.java Wed Jul 28 00:57:48 2010
@@ -0,0 +1,184 @@
+/*
+ * 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.tag.ui.template;
+
+import java.io.StringWriter;
+
+import javax.faces.component.UIViewRoot;
+
+import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class UserTagTestCase extends FaceletTestCase
+{
+    
+    @Override
+    protected void setUpServletObjects() throws Exception
+    {
+        super.setUpServletObjects();
+        servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_SKIP_COMMENTS, "true");
+        servletContext.addInitParameter(FaceletViewDeclarationLanguage.PARAM_LIBRARIES, "/user.taglib.xml");
+    }
+    
+    @Test
+    public void testUserTag1() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest1.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+    }
+
+    @Test
+    public void testUserTag2() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest2.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+    
+    @Test
+    public void testUserTag3() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest3.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+    
+    @Test
+    public void testUserTag4() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest4.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+    
+    @Test
+    public void testUserTag5() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest5.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+
+    @Test
+    public void testUserTag6() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest6.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+    
+    @Test
+    public void testUserTag7() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest7.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+    
+    @Test
+    public void testUserTag8() throws Exception {
+        
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "userTagTest8.xhtml");
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        root.encodeAll(facesContext);
+        sw.flush();
+        
+        String response = sw.toString();
+        
+        Assert.assertTrue(response.contains("Do you see me?"));
+        Assert.assertFalse(response.contains("This text should not be rendered"));
+    }
+}

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/template1.xhtml">
+compositionContent
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,25 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/template1.xhtml"></ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition3.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition3.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition3.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition3.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,25 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/template1.xhtml"/>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition4.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition4.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition4.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition4.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,29 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/template1.xhtml">
+<ui:define name="fragment1">
+fragmentNumber1
+</ui:define>
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/composition5_1.xhtml">
+    composition5Content
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition template="/composition5_2.xhtml">
+    start first composition
+    <ui:insert />
+    end first composition
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/composition5_2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>      
+    start second composition
+    <ui:insert/>
+    end second composition
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,29 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/composition4.xhtml">
+<ui:define name="fragment1">
+fragmentNumber2
+</ui:define>
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,29 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD NOT BE RENDERED
+<ui:composition template="/compositionNested2_1.xhtml">
+  <ui:define name="fragment1">
+    compositionNested2Content
+  </ui:define>
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,33 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+    start first decoration
+    <ui:decorate template="/compositionNested2_2.xhtml">
+      <ui:define name="fragment1">
+        start inner text
+          <ui:insert name="fragment1"/>
+        end inner text
+      </ui:define>
+    </ui:decorate>
+    end first decoration
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionNested2_2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+    start second composition
+    <ui:insert name="fragment1"/>
+    end second composition
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionTrim.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionTrim.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionTrim.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/compositionTrim.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,25 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+THIS SHOULD NOT BE RENDERED
+<ui:composition >
+THIS SHOULD BE RENDERED
+</ui:composition>
+THIS SHOULD NOT BE RENDERED
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/template1.xhtml">
+decorateContent
+</ui:decorate>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,25 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/template1.xhtml"></ui:decorate>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate3.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate3.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate3.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate3.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,25 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/template1.xhtml"/>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate4.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate4.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate4.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate4.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,29 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/template1.xhtml">
+<ui:define name="fragment1">
+fragmentNumber1
+</ui:define>
+</ui:decorate>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/decorate5_1.xhtml">
+decorate5Content
+</ui:decorate>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,31 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+    start first decoration
+    <ui:decorate template="/decorate5_2.xhtml">
+      start inner text
+      <ui:insert />
+      end inner text
+    </ui:decorate>
+    end first decoration
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorate5_2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>      
+    start second decoration
+    <ui:insert/>
+    end second decoration
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,30 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+THIS SHOULD BE RENDERED
+<ui:decorate template="/composition4.xhtml">
+<ui:define name="fragment1">
+fragmentNumber2
+</ui:define>
+fragmentNumber3
+</ui:decorate>
+THIS SHOULD BE RENDERED TOO
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,29 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+  <ui:decorate template="/decorateNested2_1.xhtml">
+    <ui:define name="fragment1">
+      decorateNested2Content
+    </ui:define>
+  </ui:decorate>
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,33 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+    start first decoration
+    <ui:decorate template="/decorateNested2_2.xhtml">
+      <ui:define name="fragment1">
+        start inner text
+          <ui:insert name="fragment1"/>
+        end inner text
+      </ui:define>
+    </ui:decorate>
+    end first decoration
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_2.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_2.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/decorateNested2_2.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,27 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:composition>
+    start second composition
+    <ui:insert name="fragment1"/>
+    end second composition
+</ui:composition>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1.xhtml?rev=979920&view=auto
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1.xhtml (added)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/ui/template/includeIsolation1.xhtml Wed Jul 28 00:57:48 2010
@@ -0,0 +1,30 @@
+<!--
+ 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.
+
+ $Id: child-says.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
+<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">
+<body>
+<ui:decorate
+    template="/includeIsolation1_1.xhtml">
+    <ui:define name="content">
+        start decorate content
+        <ui:include src="/includeIsolation1_2.xhtml" />
+        end decorate content
+    </ui:define>
+</ui:decorate> 
+</body>
+</html>
\ No newline at end of file