Package org.apache.tapestry.engine

Examples of org.apache.tapestry.engine.IPropertySource


@Test
public class TestLocalizedPropertySource extends BaseComponentTestCase
{
    public void testFound()
    {
        IPropertySource ps = newMock(IPropertySource.class);

        expect(ps.getPropertyValue("property-name_en")).andReturn(null);

        expect(ps.getPropertyValue("property-name")).andReturn("fred");

        replay();

        LocalizedPropertySource lps = new LocalizedPropertySource(ps);
View Full Code Here


        verify();
    }

    public void testNotFound()
    {
        IPropertySource ps = newMock(IPropertySource.class);

        expect(ps.getPropertyValue("property-name_fr")).andReturn(null);

        expect(ps.getPropertyValue("property-name")).andReturn(null);

        replay();

        LocalizedPropertySource lps = new LocalizedPropertySource(ps);
View Full Code Here

    private IPropertySource getSourceForNamespace(INamespace namespace)
    {
        Resource key = namespace.getSpecificationLocation();

        IPropertySource result = (IPropertySource) _namespaceSources.get(key);

        if (result == null)
        {
            result = createSourceForNamespace(namespace);
View Full Code Here

    private IPropertySource getSourceForComponent(IComponent component)
    {
        Resource key = component.getSpecification().getSpecificationLocation();

        IPropertySource result = (IPropertySource) _componentSources.get(key);

        if (result == null)
        {
            result = createSourceForComponent(component);
            _componentSources.put(key, result);
View Full Code Here

        assertEquals(expected, f.newResource(path));
    }

    public void testGlobalPropertyObjectProviderSuccess()
    {
        IPropertySource source = newMock(IPropertySource.class);

        // Training

        expect(source.getPropertyValue("foo")).andReturn("bar");

        replay();

        PropertyObjectProvider p = new PropertyObjectProvider();
        p.setSource(source);
View Full Code Here

    public void testGlobalPropertyObjectProviderFailure()
    {
        Location l = fabricateLocation(223);

        IPropertySource source = newMock(IPropertySource.class);

        // Training

        expect(source.getPropertyValue("foo")).andThrow(new ApplicationRuntimeException("failure"));

        replay();

        PropertyObjectProvider p = new PropertyObjectProvider();
        p.setSource(source);
View Full Code Here

    {
        Location l = newLocation();

        EnhancementOperation op = newOp();
        IComponentSpecification spec = new ComponentSpecification();
      IPropertySource propertySource = trainPropertySource();

      replay();

        Method m = findMethod(AnnotatedPage.class, "getPersistentProperty");
View Full Code Here

    {
        Location l = newLocation();

        EnhancementOperation op = newOp();
        IComponentSpecification spec = new ComponentSpecification();
      IPropertySource propertySource = trainPropertySource();

      replay();

        Method m = findMethod(AnnotatedPage.class, "getClientPersistentProperty");
View Full Code Here

    {
        Location l = newLocation();

        EnhancementOperation op = newOp();
        IComponentSpecification spec = new ComponentSpecification();
      IPropertySource propertySource = trainPropertySource();

      replay();

        Method m = findMethod(AnnotatedPage.class, "getPersistentPropertyWithInitialValue");
View Full Code Here

        assertEquals("user.naturalName", ps.getInitialValue());
    }

  private IPropertySource trainPropertySource()
  {
    IPropertySource propertySource = newMock(IPropertySource.class);
    expect(propertySource.getPropertyValue(PersistAnnotationWorker.DEFAULT_PROPERTY_PERSISTENCE_STRATEGY)).andReturn("session");
    return propertySource;
  }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.engine.IPropertySource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.