@Test public void testExecuteIgnore() throws IOException { TilesContainer container = createMock(TilesContainer.class); AttributeContext attributeContext = createMock(AttributeContext.class); Request request = createMock(Request.class); Writer writer = createMock(Writer.class); Map<String, Object> requestScope = new HashMap<String, Object>(); Deque<Object> composeStack = new ArrayDeque<Object>(); requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack); 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(); expect(request.getWriter()).andReturn(writer); container.prepare("myPreparer", request); expect(resolver.computeAttribute(container, null, "myName", "myRole", true, "myDefaultValue", "myDefaultValueRole", "myDefaultValueType", request)).andReturn(null); expect(container.startContext(request)).andReturn(attributeContext); container.endContext(request); replay(resolver, container, writer, request, applicationContext, modelBody); model.execute(true, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole", "myDefaultValueType", "myName", null, request, modelBody); verify(resolver, container, writer, request, applicationContext, modelBody); }
public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, @Parameter(required = true) String name, Attribute value, 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); Writer writer = request.getWriter(); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(attribute, container, writer, ignore, request); }
GetAsStringModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, @Parameter(required = true) String name, Attribute value, 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); Writer writer = request.getWriter(); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(attribute, container, writer, ignore, request); } }
GetAsStringModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, @Parameter(required = true) String name, Attribute value, 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); Writer writer = request.getWriter(); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(attribute, container, writer, ignore, request); } GetAsStringModel();  GetAsStringModel(AttributeResolver attributeResolver); }
GetAsStringModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, @Parameter(required = true) String name, Attribute value, 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); Writer writer = request.getWriter(); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(attribute, container, writer, ignore, request); } GetAsStringModel();  GetAsStringModel(AttributeResolver attributeResolver); void execute(boolean ignore, String preparer, String role,
            Object defaultValue, String defaultValueRole,
            String defaultValueType, @Parameter(required = true) String name,
            Attribute value, Request request, ModelBody modelBody); }
GetAsStringModel { public void execute(boolean ignore, String preparer, String role, Object defaultValue, String defaultValueRole, String defaultValueType, @Parameter(required = true) String name, Attribute value, 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); Writer writer = request.getWriter(); if (attribute != null) { attribute = (Attribute) composeStack.pop(); } renderAttribute(attribute, container, writer, ignore, request); } GetAsStringModel();  GetAsStringModel(AttributeResolver attributeResolver); void execute(boolean ignore, String preparer, String role,
            Object defaultValue, String defaultValueRole,
            String defaultValueType, @Parameter(required = true) String name,
            Attribute value, Request request, ModelBody modelBody);  }