@Test public void testExecuteSingleToName() { TilesContainer container = createMock(TilesContainer.class); Request request = createMock(Request.class); AttributeContext attributeContext = createMock(AttributeContext.class); Attribute attribute = new Attribute(); ApplicationContext applicationContext = createMock(ApplicationContext.class); Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, container); expect(request.getApplicationContext()).andReturn(applicationContext); expect(request.getContext("request")).andReturn(requestScope).anyTimes(); expect(container.getAttributeContext(request)).andReturn(attributeContext); expect(attributeContext.getAttribute("myName")).andReturn(attribute); expect(container.evaluate(attribute, request)).andReturn("myEvaluatedValue"); replay(container, attributeContext, request, applicationContext); model.execute("myName", "request", "myToName", false, request); Map<String, Object> attributes = requestScope; assertEquals(2, attributes.size()); assertEquals("myEvaluatedValue", attributes.get("myToName")); verify(container, attributeContext, request, applicationContext); }
public void execute(String name, String scope, String toName, boolean ignore, Request request) { Map<String, Object> attributes = getImportedAttributes( name, toName, ignore, request); if (scope == null) { scope = request.getAvailableScopes().get(0); } request.getContext(scope).putAll(attributes); }
ImportAttributeModel { public void execute(String name, String scope, String toName, boolean ignore, Request request) { Map<String, Object> attributes = getImportedAttributes( name, toName, ignore, request); if (scope == null) { scope = request.getAvailableScopes().get(0); } request.getContext(scope).putAll(attributes); } }
ImportAttributeModel { public void execute(String name, String scope, String toName, boolean ignore, Request request) { Map<String, Object> attributes = getImportedAttributes( name, toName, ignore, request); if (scope == null) { scope = request.getAvailableScopes().get(0); } request.getContext(scope).putAll(attributes); }  }
ImportAttributeModel { public void execute(String name, String scope, String toName, boolean ignore, Request request) { Map<String, Object> attributes = getImportedAttributes( name, toName, ignore, request); if (scope == null) { scope = request.getAvailableScopes().get(0); } request.getContext(scope).putAll(attributes); }  void execute(String name, String scope, String toName, boolean ignore, Request request); }
ImportAttributeModel { public void execute(String name, String scope, String toName, boolean ignore, Request request) { Map<String, Object> attributes = getImportedAttributes( name, toName, ignore, request); if (scope == null) { scope = request.getAvailableScopes().get(0); } request.getContext(scope).putAll(attributes); }  void execute(String name, String scope, String toName, boolean ignore, Request request);  }