@Test public void testExecute() throws IOException { TilesContainer container = createMock(TilesContainer.class); Request request = createMock(Request.class); Attribute attribute = new Attribute("myValue"); AttributeContext attributeContext = createMock(AttributeContext.class); Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, container); ApplicationContext applicationContext = createMock(ApplicationContext.class); ModelBody modelBody = createMock(ModelBody.class); modelBody.evaluateWithoutWriting(); expect(request.getApplicationContext()).andReturn(applicationContext).times(2); expect(request.getContext("request")).andReturn(requestScope).anyTimes(); container.prepare("myPreparer", request); expect(resolver.computeAttribute(container, attribute, "myName", "myRole", false, "myDefaultValue", "myDefaultValueRole", "myDefaultValueType", request)).andReturn(attribute); expect(container.startContext(request)).andReturn(attributeContext); container.endContext(request); container.render(attribute, request); replay(resolver, container, request, applicationContext, modelBody); model.execute(false, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole", "myDefaultValueType", "myName", attribute, false, request, modelBody); verify(resolver, container, request, applicationContext, modelBody); }
public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, String name, Attribute value, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request); Attribute attribute = resolveAttribute(container, ignore, preparer, role, defaultValue, defaultValueRole, defaultValueType, name, value, request); if (attribute != null) { composeStack.push(attribute); } modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(container, ignore, attribute, request); if (flush) { request.getWriter().flush(); } }
InsertAttributeModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, String name, Attribute value, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request); Attribute attribute = resolveAttribute(container, ignore, preparer, role, defaultValue, defaultValueRole, defaultValueType, name, value, request); if (attribute != null) { composeStack.push(attribute); } modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(container, ignore, attribute, request); if (flush) { request.getWriter().flush(); } } }
InsertAttributeModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, String name, Attribute value, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request); Attribute attribute = resolveAttribute(container, ignore, preparer, role, defaultValue, defaultValueRole, defaultValueType, name, value, request); if (attribute != null) { composeStack.push(attribute); } modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(container, ignore, attribute, request); if (flush) { request.getWriter().flush(); } } InsertAttributeModel();  InsertAttributeModel(AttributeResolver attributeResolver); }
InsertAttributeModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, String name, Attribute value, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request); Attribute attribute = resolveAttribute(container, ignore, preparer, role, defaultValue, defaultValueRole, defaultValueType, name, value, request); if (attribute != null) { composeStack.push(attribute); } modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(container, ignore, attribute, request); if (flush) { request.getWriter().flush(); } } InsertAttributeModel();  InsertAttributeModel(AttributeResolver attributeResolver); void execute(boolean ignore, String preparer,
            String role, Object defaultValue, String defaultValueRole,
            String defaultValueType, String name, Attribute value,
            boolean flush, Request request, ModelBody modelBody); }
InsertAttributeModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, String name, Attribute value, boolean flush, Request request, ModelBody modelBody) throws IOException { TilesContainer container = TilesAccess.getCurrentContainer(request); Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request); Attribute attribute = resolveAttribute(container, ignore, preparer, role, defaultValue, defaultValueRole, defaultValueType, name, value, request); if (attribute != null) { composeStack.push(attribute); } modelBody.evaluateWithoutWriting(); container = TilesAccess.getCurrentContainer(request); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(container, ignore, attribute, request); if (flush) { request.getWriter().flush(); } } InsertAttributeModel();  InsertAttributeModel(AttributeResolver attributeResolver); void execute(boolean ignore, String preparer,
            String role, Object defaultValue, String defaultValueRole,
            String defaultValueType, String name, Attribute value,
            boolean flush, Request request, ModelBody modelBody);  }