@Test public void child_component_inherits_parent_template() { TemplateParser parser = mockTemplateParser(); ComponentTemplate template = mockComponentTemplate(); ComponentModel model = mockComponentModel(); ComponentModel parentModel = mockComponentModel(); Resource resource = mockResource(); ComponentResourceLocator locator = mockLocator(model, english, null); train_getComponentClassName(model, "foo.Bar"); train_getParentModel(model, parentModel); expect(locator.locateTemplate(parentModel, english)).andReturn(resource).once(); expect(resource.exists()).andReturn(true); expect(resource.toURL()).andReturn(null); train_parseTemplate(parser, resource, template); replay(); ComponentTemplateSource source = new ComponentTemplateSourceImpl(true, parser, locator, converter); assertSame(source.getTemplate(model, english), template); verify(); }
public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector) { String componentName = componentModel.getComponentClassName(); MultiKey key = new MultiKey(componentName, selector); Resource resource = templateResources.get(key); if (resource == null) { resource = locateTemplateResource(componentModel, selector); templateResources.put(key, resource); } ComponentTemplate result = templates.get(resource); if (result == null) { result = parseTemplate(resource); templates.put(resource, result); } return result; }
ComponentTemplateSourceImpl extends InvalidationEventHubImpl implements ComponentTemplateSource,
        UpdateListener { public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector) { String componentName = componentModel.getComponentClassName(); MultiKey key = new MultiKey(componentName, selector); Resource resource = templateResources.get(key); if (resource == null) { resource = locateTemplateResource(componentModel, selector); templateResources.put(key, resource); } ComponentTemplate result = templates.get(resource); if (result == null) { result = parseTemplate(resource); templates.put(resource, result); } return result; } }
ComponentTemplateSourceImpl extends InvalidationEventHubImpl implements ComponentTemplateSource,
        UpdateListener { public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector) { String componentName = componentModel.getComponentClassName(); MultiKey key = new MultiKey(componentName, selector); Resource resource = templateResources.get(key); if (resource == null) { resource = locateTemplateResource(componentModel, selector); templateResources.put(key, resource); } ComponentTemplate result = templates.get(resource); if (result == null) { result = parseTemplate(resource); templates.put(resource, result); } return result; } ComponentTemplateSourceImpl(@Inject
                                       @Symbol(SymbolConstants.PRODUCTION_MODE)
                                       boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                       ClasspathURLConverter classpathURLConverter);   ComponentTemplateSourceImpl(boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                URLChangeTracker tracker); }
ComponentTemplateSourceImpl extends InvalidationEventHubImpl implements ComponentTemplateSource,
        UpdateListener { public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector) { String componentName = componentModel.getComponentClassName(); MultiKey key = new MultiKey(componentName, selector); Resource resource = templateResources.get(key); if (resource == null) { resource = locateTemplateResource(componentModel, selector); templateResources.put(key, resource); } ComponentTemplate result = templates.get(resource); if (result == null) { result = parseTemplate(resource); templates.put(resource, result); } return result; } ComponentTemplateSourceImpl(@Inject
                                       @Symbol(SymbolConstants.PRODUCTION_MODE)
                                       boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                       ClasspathURLConverter classpathURLConverter);   ComponentTemplateSourceImpl(boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                URLChangeTracker tracker); @PostInjection void registerAsUpdateListener(UpdateListenerHub hub); @PostInjection void setupReload(ReloadHelper helper); ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector); ComponentTemplate getTemplate(ComponentModel componentModel, Locale locale); void checkForUpdates(); InvalidationEventHub getInvalidationEventHub(); }
ComponentTemplateSourceImpl extends InvalidationEventHubImpl implements ComponentTemplateSource,
        UpdateListener { public ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector) { String componentName = componentModel.getComponentClassName(); MultiKey key = new MultiKey(componentName, selector); Resource resource = templateResources.get(key); if (resource == null) { resource = locateTemplateResource(componentModel, selector); templateResources.put(key, resource); } ComponentTemplate result = templates.get(resource); if (result == null) { result = parseTemplate(resource); templates.put(resource, result); } return result; } ComponentTemplateSourceImpl(@Inject
                                       @Symbol(SymbolConstants.PRODUCTION_MODE)
                                       boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                       ClasspathURLConverter classpathURLConverter);   ComponentTemplateSourceImpl(boolean productionMode, TemplateParser parser, ComponentResourceLocator locator,
                                URLChangeTracker tracker); @PostInjection void registerAsUpdateListener(UpdateListenerHub hub); @PostInjection void setupReload(ReloadHelper helper); ComponentTemplate getTemplate(ComponentModel componentModel, ComponentResourceSelector selector); ComponentTemplate getTemplate(ComponentModel componentModel, Locale locale); void checkForUpdates(); InvalidationEventHub getInvalidationEventHub();  }