@Test public void testRenderAttributeContext() throws IOException { TilesContainer container = createMock(TilesContainer.class); InternalContextAdapter internalContextAdapter = createMock(InternalContextAdapter.class); ApplicationContext applicationContext = createMock(ApplicationContext.class); StringWriter writer = new StringWriter(); Map<String, Object> requestScope = new HashMap<String, Object>(); Map<String, Object> applicationScope = new HashMap<String, Object>(); requestScope.put(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, container); expect(request.getAttribute(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME)).andReturn(container); expect(applicationContext.getApplicationScope()).andReturn(applicationScope).anyTimes(); expect(servletContext.getAttribute(ApplicationAccess .APPLICATION_CONTEXT_ATTRIBUTE)).andReturn(applicationContext) .anyTimes(); container.renderContext(isA(VelocityRequest.class)); replay(velocityContext, request, response, servletContext, container, internalContextAdapter, applicationContext); initializeTool(); Renderable renderable = tool.renderAttributeContext(); renderable.render(internalContextAdapter, writer); verify(velocityContext, request, response, servletContext, container, internalContextAdapter, applicationContext); }
public Renderable renderAttributeContext() { return new AbstractDefaultToStringRenderable(getVelocityContext(), null, getResponse(), getRequest()) { public boolean render(InternalContextAdapter context, Writer writer) { Request velocityRequest = createVelocityRequest( getServletContext(), writer); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); container.renderContext(velocityRequest); return true; } }; }
VelocityStyleTilesTool extends ContextHolder { public Renderable renderAttributeContext() { return new AbstractDefaultToStringRenderable(getVelocityContext(), null, getResponse(), getRequest()) { public boolean render(InternalContextAdapter context, Writer writer) { Request velocityRequest = createVelocityRequest( getServletContext(), writer); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); container.renderContext(velocityRequest); return true; } }; } }
VelocityStyleTilesTool extends ContextHolder { public Renderable renderAttributeContext() { return new AbstractDefaultToStringRenderable(getVelocityContext(), null, getResponse(), getRequest()) { public boolean render(InternalContextAdapter context, Writer writer) { Request velocityRequest = createVelocityRequest( getServletContext(), writer); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); container.renderContext(velocityRequest); return true; } }; }  }
VelocityStyleTilesTool extends ContextHolder { public Renderable renderAttributeContext() { return new AbstractDefaultToStringRenderable(getVelocityContext(), null, getResponse(), getRequest()) { public boolean render(InternalContextAdapter context, Writer writer) { Request velocityRequest = createVelocityRequest( getServletContext(), writer); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); container.renderContext(velocityRequest); return true; } }; }  Attribute get(String key); Attribute createAttribute(); Attribute clone(Attribute attribute); Attribute createTemplateAttribute(String template); Renderable render(final Attribute attribute); Renderable renderDefinition(final String definitionName); Renderable renderAttributeContext(); AttributeContext startAttributeContext(); VelocityStyleTilesTool endAttributeContext(); AttributeContext getAttributeContext(); VelocityStyleTilesTool setCurrentContainer(String containerKey); @Override String toString(); }
VelocityStyleTilesTool extends ContextHolder { public Renderable renderAttributeContext() { return new AbstractDefaultToStringRenderable(getVelocityContext(), null, getResponse(), getRequest()) { public boolean render(InternalContextAdapter context, Writer writer) { Request velocityRequest = createVelocityRequest( getServletContext(), writer); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); container.renderContext(velocityRequest); return true; } }; }  Attribute get(String key); Attribute createAttribute(); Attribute clone(Attribute attribute); Attribute createTemplateAttribute(String template); Renderable render(final Attribute attribute); Renderable renderDefinition(final String definitionName); Renderable renderAttributeContext(); AttributeContext startAttributeContext(); VelocityStyleTilesTool endAttributeContext(); AttributeContext getAttributeContext(); VelocityStyleTilesTool setCurrentContainer(String containerKey); @Override String toString();  }