You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2009/11/16 21:59:14 UTC

svn commit: r880955 - in /tiles/sandbox/trunk/tiles3: tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/ tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/ tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ tiles-t...

Author: apetrelli
Date: Mon Nov 16 20:59:12 2009
New Revision: 880955

URL: http://svn.apache.org/viewvc?rev=880955&view=rev
Log:
TILESSB-14
Converted PutAttributeModel.

Modified:
    tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/PutAttributeFMModel.java
    tiles/sandbox/trunk/tiles3/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/PutAttributeFMModelTest.java
    tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
    tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java
    tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/PutAttributeModelTest.java
    tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java
    tiles/sandbox/trunk/tiles3/tiles-velocity/src/test/java/org/apache/tiles/velocity/template/PutAttributeVModelTest.java

Modified: tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/PutAttributeFMModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/PutAttributeFMModel.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/PutAttributeFMModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/PutAttributeFMModel.java Mon Nov 16 20:59:12 2009
@@ -24,7 +24,6 @@
 import java.io.IOException;
 import java.util.Map;
 
-import org.apache.tiles.ArrayStack;
 import org.apache.tiles.TilesContainer;
 import org.apache.tiles.freemarker.context.FreeMarkerTilesRequestContext;
 import org.apache.tiles.freemarker.context.FreeMarkerUtil;
@@ -39,8 +38,8 @@
 
 /**
  * Wraps {@link PutAttributeModel} to be used in FreeMarker. For the list of
- * parameters, see {@link PutAttributeModel#start(ArrayStack)} and
- * {@link PutAttributeModel #end(org.apache.tiles.TilesContainer, ArrayStack, String, Object, String, String, String, String, boolean, Request)}
+ * parameters, see {@link PutAttributeModel#start(Request)} and
+ * {@link PutAttributeModel #end(org.apache.tiles.TilesContainer, String, Object, String, String, String, String, boolean, Request)}
  * .
  *
  * @version $Rev$ $Date$
@@ -68,19 +67,18 @@
     @SuppressWarnings("unchecked")
     public void execute(Environment env, Map params, TemplateModel[] loopVars,
             TemplateDirectiveBody body) throws TemplateException, IOException {
-        ArrayStack<Object> composeStack = FreeMarkerUtil.getComposeStack(env);
         TilesContainer container = FreeMarkerUtil.getCurrentContainer(env);
         Request request = FreeMarkerTilesRequestContext
                 .createServletFreemarkerRequest(container
                         .getApplicationContext(), env);
-        model.start(composeStack);
+        model.start(request);
         String bodyString = FreeMarkerUtil.renderAsString(body);
-        Map<String, TemplateModel> parms = (Map<String, TemplateModel>) params;
-        model.end(container, composeStack, FreeMarkerUtil.getAsString(parms
-                .get("name")), FreeMarkerUtil.getAsObject(parms.get("value")),
-                FreeMarkerUtil.getAsString(parms.get("expression")),
-                bodyString, FreeMarkerUtil.getAsString(parms.get("role")),
-                FreeMarkerUtil.getAsString(parms.get("type")), FreeMarkerUtil
+        Map<String, TemplateModel> parms = params;
+        model.end(container, FreeMarkerUtil.getAsString(parms
+                .get("name")), FreeMarkerUtil.getAsObject(parms.get("value")), FreeMarkerUtil.getAsString(parms.get("expression")),
+                bodyString,
+                FreeMarkerUtil.getAsString(parms.get("role")), FreeMarkerUtil.getAsString(parms.get("type")),
+                FreeMarkerUtil
                         .getAsBoolean(parms.get("cascade"), false), request);
     }
 

Modified: tiles/sandbox/trunk/tiles3/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/PutAttributeFMModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/PutAttributeFMModelTest.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/PutAttributeFMModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-freemarker/src/test/java/org/apache/tiles/freemarker/template/PutAttributeFMModelTest.java Mon Nov 16 20:59:12 2009
@@ -34,11 +34,9 @@
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.tiles.ArrayStack;
 import org.apache.tiles.TilesContainer;
 import org.apache.tiles.access.TilesAccess;
 import org.apache.tiles.freemarker.context.FreeMarkerTilesRequestContext;
-import org.apache.tiles.freemarker.context.FreeMarkerUtil;
 import org.apache.tiles.request.ApplicationContext;
 import org.apache.tiles.servlet.context.ServletUtil;
 import org.apache.tiles.template.PutAttributeModel;
@@ -94,10 +92,10 @@
     private ObjectWrapper objectWrapper;
 
     /**
-     * @throws java.lang.Exception If something goes wrong.
+     * Sets up the model.
      */
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         template = createMock(Template.class);
         model = createMock(TemplateHashModel.class);
         expect(template.getMacros()).andReturn(new HashMap<Object, Object>());
@@ -121,8 +119,6 @@
 
         expect(container.getApplicationContext()).andReturn(applicationContext);
         HttpServletRequest request = createMock(HttpServletRequest.class);
-        ArrayStack<Object> composeStack = new ArrayStack<Object>();
-        expect(request.getAttribute(FreeMarkerUtil.COMPOSE_STACK_ATTRIBUTE_NAME)).andReturn(composeStack);
         expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(null);
         request.setAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
         replay(request);
@@ -148,10 +144,10 @@
         params.put("type", objectWrapper.wrap("myType"));
         params.put("cascade", objectWrapper.wrap(false));
 
-        tModel.start(composeStack);
-        tModel.end(eq(container), eq(composeStack), eq("myName"), eq(value),
-                eq("myExpression"), eq(""), eq("myRole"), eq("myType"),
-                eq(false), isA(FreeMarkerTilesRequestContext.class));
+        tModel.start(isA(FreeMarkerTilesRequestContext.class));
+        tModel.end(eq(container), eq("myName"), eq(value), eq("myExpression"),
+                eq(""), eq("myRole"), eq("myType"), eq(false),
+                isA(FreeMarkerTilesRequestContext.class));
         body.render(isA(StringWriter.class));
 
         replay(tModel, body, container, applicationContext);

Modified: tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java Mon Nov 16 20:59:12 2009
@@ -274,9 +274,9 @@
         Request request = JspTilesRequestContext.createServletJspRequest(
                 currentContainer.getApplicationContext(),
                 (PageContext) jspContext);
-        model.start(JspUtil.getComposeStack(jspContext));
+        model.start(request);
         String body = JspUtil.evaluateFragmentAsString(getJspBody());
-        model.end(currentContainer, JspUtil.getComposeStack(jspContext), name,
-                value, expression, body, role, type, cascade, request);
+        model.end(currentContainer, name, value,
+                expression, body, role, type, cascade, request);
     }
 }

Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java Mon Nov 16 20:59:12 2009
@@ -68,11 +68,13 @@
 
     /**
      * Starts the operation.
-     *
+     * @param request TODO
      * @param composeStack The compose stack.
+     *
      * @since 2.2.0
      */
-    public void start(ArrayStack<Object> composeStack) {
+    public void start(Request request) {
+        ArrayStack<Object> composeStack = ComposeStackUtil.getComposeStack(request);
         Attribute attribute = new Attribute();
         composeStack.push(attribute);
     }
@@ -81,7 +83,6 @@
      * Ends the operation.
      *
      * @param container The Tiles container to use.
-     * @param composeStack The composing stack.
      * @param name The name of the attribute to put.
      * @param value The value of the attribute. Use this parameter, or
      * expression, or body.
@@ -94,11 +95,13 @@
      * @param type The type (renderer) of the attribute.
      * @param cascade If <code>true</code> the attribute will be cascaded to all nested attributes.
      * @param request TODO
+     * @param composeStack The composing stack.
      * @since 2.2.0
      */
-    public void end(TilesContainer container, ArrayStack<Object> composeStack,
-            String name, Object value, String expression, String body,
-            String role, String type, boolean cascade, Request request) {
+    public void end(TilesContainer container, String name,
+            Object value, String expression, String body, String role,
+            String type, boolean cascade, Request request) {
+        ArrayStack<Object> composeStack = ComposeStackUtil.getComposeStack(request);
         Attribute attribute = (Attribute) composeStack.pop();
         putAttributeInParent(attribute, container, composeStack, name, value,
                 expression, body, role, type, cascade, request);
@@ -108,7 +111,6 @@
      * Executes the operation.
      *
      * @param container The Tiles container to use.
-     * @param composeStack The composing stack.
      * @param name The name of the attribute to put.
      * @param value The value of the attribute. Use this parameter, or
      * expression, or body.
@@ -121,11 +123,13 @@
      * @param type The type (renderer) of the attribute.
      * @param cascade If <code>true</code> the attribute will be cascaded to all nested attributes.
      * @param request TODO
+     * @param composeStack The composing stack.
      * @since 2.2.0
      */
-    public void execute(TilesContainer container, ArrayStack<Object> composeStack,
-            String name, Object value, String expression, String body,
-            String role, String type, boolean cascade, Request request) {
+    public void execute(TilesContainer container, String name,
+            Object value, String expression, String body, String role,
+            String type, boolean cascade, Request request) {
+        ArrayStack<Object> composeStack = ComposeStackUtil.getComposeStack(request);
         putAttributeInParent(new Attribute(), container, composeStack, name,
                 value, expression, body, role, type, cascade, request);
     }

Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/PutAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/PutAttributeModelTest.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/PutAttributeModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/PutAttributeModelTest.java Mon Nov 16 20:59:12 2009
@@ -25,6 +25,9 @@
 import static org.easymock.classextension.EasyMock.*;
 import static org.junit.Assert.*;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.tiles.ArrayStack;
 import org.apache.tiles.Attribute;
 import org.apache.tiles.AttributeContext;
@@ -53,25 +56,29 @@
     }
 
     /**
-     * Test method for {@link org.apache.tiles.template.PutAttributeModel#start(ArrayStack)}.
+     * Test method for {@link org.apache.tiles.template.PutAttributeModel#start(Request)}.
      */
     @SuppressWarnings("unchecked")
     @Test
     public void testStart() {
         ArrayStack<Object> composeStack = createMock(ArrayStack.class);
         Attribute attribute = new Attribute();
+        Request request = createMock(Request.class);
+        Map<String, Object> requestScope = new HashMap<String, Object>();
+        requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack);
 
+        expect(request.getRequestScope()).andReturn(requestScope);
         expect(composeStack.push(isA(Attribute.class))).andReturn(attribute);
 
-        replay(composeStack);
-        model.start(composeStack);
-        verify(composeStack);
+        replay(request, composeStack);
+        model.start(request);
+        verify(request, composeStack);
     }
 
     /**
      * Test method for {@link org.apache.tiles.template.PutAttributeModel
-     * #end(org.apache.tiles.TilesContainer, ArrayStack, String, Object, String,
-     * String, String, String, boolean, Request)}.
+     * #end(org.apache.tiles.TilesContainer, String, Object, String, String,
+     * String, String, boolean, Request)}.
      */
     @Test
     public void testEnd() {
@@ -81,13 +88,16 @@
         ArrayStack<Object> composeStack = new ArrayStack<Object>();
         Attribute attribute = new Attribute();
         composeStack.push(attribute);
+        Map<String, Object> requestScope = new HashMap<String, Object>();
+        requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack);
 
+        expect(request.getRequestScope()).andReturn(requestScope);
         expect(container.getAttributeContext(request)).andReturn(attributeContext);
         attributeContext.putAttribute("myName", attribute, false);
 
         replay(container, attributeContext, request);
-        model.end(container, composeStack, "myName", "myValue", "myExpression",
-                "myBody", "myRole", "myType", false, request);
+        model.end(container, "myName", "myValue", "myExpression", "myBody",
+                "myRole", "myType", false, request);
         assertEquals("myValue", attribute.getValue());
         assertEquals("myExpression", attribute.getExpressionObject()
                 .getExpression());
@@ -98,8 +108,8 @@
 
     /**
      * Test method for {@link org.apache.tiles.template.PutAttributeModel
-     * #end(org.apache.tiles.TilesContainer, ArrayStack, String, Object, String,
-     * String, String, String, boolean, Request)}.
+     * #end(org.apache.tiles.TilesContainer, String, Object, String, String,
+     * String, String, boolean, Request)}.
      */
     @Test
     public void testEndBody() {
@@ -109,13 +119,16 @@
         ArrayStack<Object> composeStack = new ArrayStack<Object>();
         Attribute attribute = new Attribute();
         composeStack.push(attribute);
+        Map<String, Object> requestScope = new HashMap<String, Object>();
+        requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack);
 
+        expect(request.getRequestScope()).andReturn(requestScope);
         expect(container.getAttributeContext(request)).andReturn(attributeContext);
         attributeContext.putAttribute("myName", attribute, false);
 
         replay(container, attributeContext, request);
-        model.end(container, composeStack, "myName", "myValue", "myExpression",
-                "myBody", "myRole", "myType", false, request);
+        model.end(container, "myName", "myValue", "myExpression", "myBody",
+                "myRole", "myType", false, request);
         assertEquals("myValue", attribute.getValue());
         assertEquals("myExpression", attribute.getExpressionObject()
                 .getExpression());
@@ -126,8 +139,8 @@
 
     /**
      * Test method for {@link org.apache.tiles.template.PutAttributeModel
-     * #execute(org.apache.tiles.TilesContainer, ArrayStack, String, Object, String,
-     * String, String, String, boolean, Request)}.
+     * #execute(org.apache.tiles.TilesContainer, String, Object, String, String,
+     * String, String, boolean, Request)}.
      */
     @Test
     public void testExecuteListAttribute() {
@@ -137,14 +150,16 @@
         ArrayStack<Object> composeStack = new ArrayStack<Object>();
         ListAttribute listAttribute = new ListAttribute();
         composeStack.push(listAttribute);
+        Map<String, Object> requestScope = new HashMap<String, Object>();
+        requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack);
 
+        expect(request.getRequestScope()).andReturn(requestScope);
         expect(container.getAttributeContext(request)).andReturn(attributeContext);
         attributeContext.putAttribute(eq("myName"), (Attribute) notNull(), eq(false));
 
         replay(container, attributeContext, request);
-        model.execute(container, composeStack, "myName", "myValue",
-                "myExpression", "myBody", "myRole", "myType", false,
-                request);
+        model.execute(container, "myName", "myValue", "myExpression",
+                "myBody", "myRole", "myType", false, request);
         verify(container, attributeContext, request);
     }
 }

Modified: tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/PutAttributeVModel.java Mon Nov 16 20:59:12 2009
@@ -39,11 +39,11 @@
 /**
  * Wraps {@link PutAttributeModel} to be used in Velocity. For the list of
  * parameters, see
- * {@link PutAttributeModel#start(java.util.Stack)}
+ * {@link PutAttributeModel#start(Request)}
  * , {@link PutAttributeModel#end(org.apache.tiles.TilesContainer,
- * java.util.Stack, String, Object, String, String, String, String, boolean, Request)} and
+ * String, Object, String, String, String, String, boolean, Request)} and
  * {@link PutAttributeModel#execute(org.apache.tiles.TilesContainer,
- * java.util.Stack, String, Object, String, String, String, String, boolean, Request)}.
+ * String, Object, String, String, String, String, boolean, Request)}.
  *
  * @version $Rev$ $Date$
  * @since 2.2.0
@@ -83,12 +83,11 @@
                 .createVelocityRequest(container.getApplicationContext(),
                         request, response, velocityContext, null);
         model.execute(container,
-                ServletUtil.getComposeStack(request), (String) params
+                (String) params
                         .get("name"), params.get("value"), (String) params
-                        .get("expression"), null, (String) params.get("role"),
-                (String) params.get("type"), VelocityUtil.toSimpleBoolean(
-                        (Boolean) params.get("cascade"), false),
-                currentRequest);
+                        .get("expression"), null, (String) params.get("role"), (String) params.get("type"),
+                VelocityUtil.toSimpleBoolean(
+                        (Boolean) params.get("cascade"), false), currentRequest);
 
         return VelocityUtil.EMPTY_RENDERABLE;
     }
@@ -104,12 +103,11 @@
                 .createVelocityRequest(container.getApplicationContext(),
                         request, response, velocityContext, null);
         model.end(container,
-                ServletUtil.getComposeStack(request), (String) params
+                (String) params
                         .get("name"), params.get("value"), (String) params
-                        .get("expression"), null, (String) params.get("role"),
-                (String) params.get("type"), VelocityUtil.toSimpleBoolean(
-                        (Boolean) params.get("cascade"), false),
-                currentRequest);
+                        .get("expression"), null, (String) params.get("role"), (String) params.get("type"),
+                VelocityUtil.toSimpleBoolean(
+                        (Boolean) params.get("cascade"), false), currentRequest);
         return VelocityUtil.EMPTY_RENDERABLE;
     }
 
@@ -117,6 +115,11 @@
     public void start(HttpServletRequest request, HttpServletResponse response,
             Context velocityContext, Map<String, Object> params) {
         VelocityUtil.getParameterStack(velocityContext).push(params);
-        model.start(ServletUtil.getComposeStack(request));
+        TilesContainer container = ServletUtil.getCurrentContainer(
+                request, servletContext);
+        Request currentRequest = VelocityTilesRequestContext
+                .createVelocityRequest(container.getApplicationContext(),
+                        request, response, velocityContext, null);
+        model.start(currentRequest);
     }
 }

Modified: tiles/sandbox/trunk/tiles3/tiles-velocity/src/test/java/org/apache/tiles/velocity/template/PutAttributeVModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-velocity/src/test/java/org/apache/tiles/velocity/template/PutAttributeVModelTest.java?rev=880955&r1=880954&r2=880955&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-velocity/src/test/java/org/apache/tiles/velocity/template/PutAttributeVModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-velocity/src/test/java/org/apache/tiles/velocity/template/PutAttributeVModelTest.java Mon Nov 16 20:59:12 2009
@@ -89,16 +89,13 @@
         Context velocityContext = createMock(Context.class);
         TilesContainer container = createMock(TilesContainer.class);
         Map<String, Object> params = createParams();
-        ArrayStack<Object> composeStack = new ArrayStack<Object>();
         ApplicationContext applicationContext = createMock(ApplicationContext.class);
 
         expect(container.getApplicationContext()).andReturn(applicationContext);
         expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
-        expect(request.getAttribute(ServletUtil.COMPOSE_STACK_ATTRIBUTE_NAME))
-                .andReturn(composeStack);
-        tModel.execute(eq(container), eq(composeStack), eq("myName"), eq("myValue"),
-                eq("myExpression"), (String) isNull(), eq("myRole"), eq("myType"),
-                eq(false), isA(VelocityTilesRequestContext.class));
+        tModel.execute(eq(container), eq("myName"), eq("myValue"), eq("myExpression"),
+                (String) isNull(), eq("myRole"), eq("myType"), eq(false),
+                isA(VelocityTilesRequestContext.class));
 
         replay(tModel, container, servletContext, request, response, velocityContext, applicationContext);
         initializeModel();
@@ -117,20 +114,21 @@
         HttpServletResponse response = createMock(HttpServletResponse.class);
         Context velocityContext = createMock(Context.class);
         Map<String, Object> params = createParams();
-        ArrayStack<Object> composeStack = new ArrayStack<Object>();
         ArrayStack<Map<String, Object>> parameterMapStack = new ArrayStack<Map<String, Object>>();
+        TilesContainer container = createMock(TilesContainer.class);
+        ApplicationContext applicationContext = createMock(ApplicationContext.class);
 
-        expect(request.getAttribute(ServletUtil.COMPOSE_STACK_ATTRIBUTE_NAME))
-                .andReturn(composeStack);
+        expect(container.getApplicationContext()).andReturn(applicationContext);
+        expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
         expect(velocityContext.get(PARAMETER_MAP_STACK_KEY)).andReturn(parameterMapStack);
-        tModel.start(composeStack);
+        tModel.start(isA(VelocityTilesRequestContext.class));
 
-        replay(tModel, servletContext, request, response, velocityContext);
+        replay(tModel, servletContext, request, response, velocityContext, container, applicationContext);
         initializeModel();
         model.start(request, response, velocityContext, params);
         assertEquals(1, parameterMapStack.size());
         assertEquals(params, parameterMapStack.peek());
-        verify(tModel, servletContext, request, response, velocityContext);
+        verify(tModel, servletContext, request, response, velocityContext, container, applicationContext);
     }
 
     /**
@@ -145,19 +143,16 @@
         Context velocityContext = createMock(Context.class);
         TilesContainer container = createMock(TilesContainer.class);
         Map<String, Object> params = createParams();
-        ArrayStack<Object> composeStack = new ArrayStack<Object>();
         ArrayStack<Map<String, Object>> parameterMapStack = new ArrayStack<Map<String, Object>>();
         parameterMapStack.push(params);
         ApplicationContext applicationContext = createMock(ApplicationContext.class);
 
         expect(container.getApplicationContext()).andReturn(applicationContext);
         expect(request.getAttribute(ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container);
-        expect(request.getAttribute(ServletUtil.COMPOSE_STACK_ATTRIBUTE_NAME))
-                .andReturn(composeStack);
         expect(velocityContext.get(PARAMETER_MAP_STACK_KEY)).andReturn(parameterMapStack);
-        tModel.end(eq(container), eq(composeStack), eq("myName"), eq("myValue"),
-                eq("myExpression"), (String) isNull(), eq("myRole"), eq("myType"),
-                eq(false), isA(VelocityTilesRequestContext.class));
+        tModel.end(eq(container), eq("myName"), eq("myValue"), eq("myExpression"),
+                (String) isNull(), eq("myRole"), eq("myType"), eq(false),
+                isA(VelocityTilesRequestContext.class));
 
         replay(tModel, container, servletContext, request, response, velocityContext, applicationContext);
         initializeModel();