Search in sources :

Example 1 with PropertiesFileParserImpl

use of org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl in project tapestry-5 by apache.

the class ComponentMessagesSourceImplTest method no_app_catalog.

@Test
public void no_app_catalog() {
    ComponentModel model = mockComponentModel();
    ComponentModel parent = mockComponentModel();
    train_getComponentClassName(model, "org.apache.tapestry5.internal.services.SubclassComponent");
    train_getBaseResource(model, new ClasspathResource("org/apache/tapestry5/internal/services/SubclassComponent.class"));
    train_getParentModel(model, parent);
    train_getComponentClassName(parent, SIMPLE_COMPONENT_CLASS_NAME);
    train_getBaseResource(parent, simpleComponentResource);
    train_getParentModel(parent, null);
    replay();
    forceCacheClear();
    Resource resource = simpleComponentResource.forFile("NoSuchAppCatalog.properties");
    List<Resource> resources = Arrays.asList(resource);
    ComponentMessagesSource source = new ComponentMessagesSourceImpl(true, resources, new PropertiesFileParserImpl(), resourceLocator, converter, componentRequestSelectorAnalyzer, threadLocale);
    Messages messages = source.getMessages(model, Locale.ENGLISH);
    assertEquals(messages.get("color"), "color");
    assertEquals(messages.get("app-catalog-source"), "[[missing key: app-catalog-source]]");
    assertEquals(messages.get("app-catalog-overridden"), "Overridden by Component");
    verify();
}
Also used : ClasspathResource(org.apache.tapestry5.ioc.internal.util.ClasspathResource) PropertiesFileParserImpl(org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl) Messages(org.apache.tapestry5.commons.Messages) ComponentModel(org.apache.tapestry5.model.ComponentModel) Resource(org.apache.tapestry5.commons.Resource) ClasspathResource(org.apache.tapestry5.ioc.internal.util.ClasspathResource) ComponentMessagesSource(org.apache.tapestry5.services.messages.ComponentMessagesSource) Test(org.testng.annotations.Test)

Aggregations

Messages (org.apache.tapestry5.commons.Messages)1 Resource (org.apache.tapestry5.commons.Resource)1 PropertiesFileParserImpl (org.apache.tapestry5.internal.services.messages.PropertiesFileParserImpl)1 ClasspathResource (org.apache.tapestry5.ioc.internal.util.ClasspathResource)1 ComponentModel (org.apache.tapestry5.model.ComponentModel)1 ComponentMessagesSource (org.apache.tapestry5.services.messages.ComponentMessagesSource)1 Test (org.testng.annotations.Test)1