Search in sources :

Example 6 with SymbolSource

use of org.apache.tapestry5.ioc.services.SymbolSource in project tapestry-5 by apache.

the class MetaDataLocatorImplTest method default_to_symbol_source.

@Test
public void default_to_symbol_source() {
    ComponentResources resources = mockComponentResources();
    ComponentModel model = mockComponentModel();
    SymbolSource symbolSource = mockSymbolSource();
    ComponentModelSource modelSource = mockComponentModelSource();
    String key = "foo.bar";
    String value = "zaphod";
    String completeId = "foo/Bar:baz";
    train_getCompleteId(resources, completeId);
    train_getComponentModel(resources, model);
    train_getMeta(model, key, null);
    train_getContainerResources(resources, null);
    train_getPageName(resources, "foo/Bar");
    train_valueForSymbol(symbolSource, key, value);
    replay();
    Map<String, String> configuration = Collections.emptyMap();
    MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration);
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
    // And check that it's cached:
    train_getCompleteId(resources, completeId);
    replay();
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) ComponentModel(org.apache.tapestry5.model.ComponentModel) MetaDataLocator(org.apache.tapestry5.services.MetaDataLocator) ComponentResources(org.apache.tapestry5.ComponentResources) Test(org.testng.annotations.Test)

Example 7 with SymbolSource

use of org.apache.tapestry5.ioc.services.SymbolSource in project tapestry-5 by apache.

the class PageTesterTest method application_path_is_defined_as_a_symbol.

@Test(dataProvider = "testers")
public void application_path_is_defined_as_a_symbol(PageTester tester) {
    SymbolSource source = tester.getRegistry().getService(SymbolSource.class);
    assertEquals(source.valueForSymbol(TapestryHttpInternalSymbols.APP_PACKAGE_PATH), "org/apache/tapestry5/integration/app2");
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) Test(org.testng.annotations.Test)

Example 8 with SymbolSource

use of org.apache.tapestry5.ioc.services.SymbolSource in project tapestry-5 by apache.

the class MetaDataLocatorImplTest method subfolder_default_overrides_high_level_default.

@Test
public void subfolder_default_overrides_high_level_default() {
    ComponentResources resources = mockComponentResources();
    ComponentModel model = mockComponentModel();
    SymbolSource symbolSource = mockSymbolSource();
    ComponentModelSource modelSource = mockComponentModelSource();
    String key = "foo.bar";
    String value = "zaphod";
    String completeId = "foo.Bar";
    train_getCompleteId(resources, completeId);
    train_getComponentModel(resources, model);
    train_getMeta(model, key, null);
    train_getContainerResources(resources, null);
    train_getPageName(resources, "foo/Bar");
    train_expandSymbols(symbolSource, value, value);
    replay();
    Map<String, String> configuration = newMap();
    configuration.put(key, "xxx");
    configuration.put("foo:" + key, value);
    MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration);
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
    // And check that it's cached:
    train_getCompleteId(resources, completeId);
    replay();
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) ComponentModel(org.apache.tapestry5.model.ComponentModel) MetaDataLocator(org.apache.tapestry5.services.MetaDataLocator) ComponentResources(org.apache.tapestry5.ComponentResources) Test(org.testng.annotations.Test)

Example 9 with SymbolSource

use of org.apache.tapestry5.ioc.services.SymbolSource in project tapestry-5 by apache.

the class MetaDataLocatorImplTest method found_via_high_level_default.

@Test
public void found_via_high_level_default() {
    ComponentResources resources = mockComponentResources();
    ComponentModel model = mockComponentModel();
    SymbolSource symbolSource = mockSymbolSource();
    ComponentModelSource modelSource = mockComponentModelSource();
    String key = "foo.bar";
    String value = "zaphod";
    String completeId = "Bar";
    String logicalPageName = completeId;
    train_getCompleteId(resources, completeId);
    train_getComponentModel(resources, model);
    train_getMeta(model, key, null);
    train_getContainerResources(resources, null);
    train_getPageName(resources, logicalPageName);
    train_expandSymbols(symbolSource, value, value);
    replay();
    Map<String, String> configuration = newMap();
    configuration.put(key, value);
    MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration);
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
    // And check that it's cached:
    train_getCompleteId(resources, completeId);
    replay();
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) ComponentModel(org.apache.tapestry5.model.ComponentModel) MetaDataLocator(org.apache.tapestry5.services.MetaDataLocator) ComponentResources(org.apache.tapestry5.ComponentResources) Test(org.testng.annotations.Test)

Example 10 with SymbolSource

use of org.apache.tapestry5.ioc.services.SymbolSource in project tapestry-5 by apache.

the class MetaDataLocatorImplTest method default_matching_is_case_insensitive.

@Test
public void default_matching_is_case_insensitive() {
    ComponentResources resources = mockComponentResources();
    ComponentModel model = mockComponentModel();
    SymbolSource symbolSource = mockSymbolSource();
    ComponentModelSource modelSource = mockComponentModelSource();
    String key = "foo.bar";
    String value = "zaphod";
    String completeId = "foo.Bar";
    train_getCompleteId(resources, completeId);
    train_getComponentModel(resources, model);
    train_getMeta(model, key, null);
    train_getContainerResources(resources, null);
    train_getPageName(resources, "foo/Bar");
    train_expandSymbols(symbolSource, value, value);
    replay();
    Map<String, String> configuration = newMap();
    configuration.put(key.toUpperCase(), value);
    MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration);
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
    // And check that it's cached:
    train_getCompleteId(resources, completeId);
    replay();
    assertSame(locator.findMeta(key, resources, String.class), value);
    verify();
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) ComponentModel(org.apache.tapestry5.model.ComponentModel) MetaDataLocator(org.apache.tapestry5.services.MetaDataLocator) ComponentResources(org.apache.tapestry5.ComponentResources) Test(org.testng.annotations.Test)

Aggregations

SymbolSource (org.apache.tapestry5.ioc.services.SymbolSource)15 Test (org.testng.annotations.Test)13 ComponentModel (org.apache.tapestry5.model.ComponentModel)9 MetaDataLocator (org.apache.tapestry5.services.MetaDataLocator)9 ComponentResources (org.apache.tapestry5.ComponentResources)7 Asset (org.apache.tapestry5.Asset)3 AssetSource (org.apache.tapestry5.services.AssetSource)3 AnnotationProvider (org.apache.tapestry5.commons.AnnotationProvider)2 ObjectLocator (org.apache.tapestry5.commons.ObjectLocator)2 ObjectProvider (org.apache.tapestry5.commons.ObjectProvider)2 TypeCoercer (org.apache.tapestry5.commons.services.TypeCoercer)2 AssetPathProcessor (com.flowlogix.web.services.internal.AssetPathProcessor)1 Formatter (java.util.Formatter)1 ServletContext (javax.servlet.ServletContext)1 Path (org.apache.tapestry5.annotations.Path)1 Resource (org.apache.tapestry5.commons.Resource)1 SymbolBeanFactoryPostProcessor (org.apache.tapestry5.internal.spring.SymbolBeanFactoryPostProcessor)1 Contribute (org.apache.tapestry5.ioc.annotations.Contribute)1 ClasspathResource (org.apache.tapestry5.ioc.internal.util.ClasspathResource)1 ServiceActivity (org.apache.tapestry5.ioc.services.ServiceActivity)1