@Test public void testGetAttributeContext() { TilesContainer container = createMock(TilesContainer.class); AttributeContext attributeContext = createMock(AttributeContext.class); ApplicationContext applicationContext = createMock(ApplicationContext.class); 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(); expect(container.getAttributeContext(isA(VelocityRequest.class))) .andReturn(attributeContext); replay(velocityContext, request, response, servletContext, container, attributeContext, applicationContext); initializeTool(); assertEquals(attributeContext, tool.getAttributeContext()); verify(velocityContext, request, response, servletContext, container, attributeContext, applicationContext); }
public AttributeContext getAttributeContext() { Request velocityRequest = createVelocityRequest( getServletContext(), null); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); return container.getAttributeContext(velocityRequest); }
VelocityStyleTilesTool extends ContextHolder { public AttributeContext getAttributeContext() { Request velocityRequest = createVelocityRequest( getServletContext(), null); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); return container.getAttributeContext(velocityRequest); } }
VelocityStyleTilesTool extends ContextHolder { public AttributeContext getAttributeContext() { Request velocityRequest = createVelocityRequest( getServletContext(), null); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); return container.getAttributeContext(velocityRequest); }  }
VelocityStyleTilesTool extends ContextHolder { public AttributeContext getAttributeContext() { Request velocityRequest = createVelocityRequest( getServletContext(), null); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); return container.getAttributeContext(velocityRequest); }  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 AttributeContext getAttributeContext() { Request velocityRequest = createVelocityRequest( getServletContext(), null); TilesContainer container = TilesAccess .getCurrentContainer(velocityRequest); return container.getAttributeContext(velocityRequest); }  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();  }