@Test public void not_found_by_page_name_but_found_in_configuration() { ComponentModel model = mockComponentModel(); SymbolSource symbolSource = mockSymbolSource(); ComponentModelSource modelSource = mockComponentModelSource(); String key = "foo.bar"; String value = "zaphod"; String pageName = "gnip/Gnop"; expect(modelSource.getPageModel(pageName)).andReturn(model); train_getMeta(model, key, null); train_expandSymbols(symbolSource, value, "*expanded*"); replay(); Map<String, String> configuration = CollectionFactory.newMap(); configuration.put("gnip:foo.bar", value); MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration); assertSame(locator.findMeta(key, pageName, String.class), "*expanded*"); verify(); }
public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); @PostInjection void setupInvalidation(@ComponentClasses InvalidationEventHub invalidationEventHub); T findMeta(String key, final ComponentResources resources, Class<T> expectedType); T findMeta(String key, final String pageName, Class<T> expectedType); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); @PostInjection void setupInvalidation(@ComponentClasses InvalidationEventHub invalidationEventHub); T findMeta(String key, final ComponentResources resources, Class<T> expectedType); T findMeta(String key, final String pageName, Class<T> expectedType);  }