Package org.apache.tapestry.spec

Examples of org.apache.tapestry.spec.IPropertySpecification


        MockControl specc = newControl(IComponentSpecification.class);
        IComponentSpecification spec = (IComponentSpecification) specc.getMock();

        MockControl psc = newControl(IPropertySpecification.class);
        IPropertySpecification ps = (IPropertySpecification) psc.getMock();

        component.getSpecification();
        componentc.setReturnValue(spec);

        spec.getPropertySpecification("zip");
        specc.setReturnValue(ps);

        ps.getPersistence();
        psc.setReturnValue("unknown");

        source.getStrategy("unknown");
        sourcec.setThrowable(inner);

        ps.getLocation();
        psc.setReturnValue(l);

        log.error("Simulated error.", l, inner);

        replayControls();
View Full Code Here


    PropertyPersistenceStrategy findStrategy(IComponent component, String propertyName)
    {
        // So much for Law of Demeter!

        IPropertySpecification propertySpecification = component.getSpecification().getPropertySpecification(propertyName);

        if (propertySpecification == null)
        {
            _log.error(RecordMessages.missingPropertySpecification(propertyName, component), null, null);
            return null;
        }

        String name = propertySpecification.getPersistence();

        // Should check for nulls, but the architecture of the framework pretty
        // much
        // ensures that we won't get here unless there is a property
        // and a persistence value for the property.

        try
        {
            return _strategySource.getStrategy(name);
        }
        catch (ApplicationRuntimeException ex)
        {
            _log.error(ex.getMessage(), propertySpecification.getLocation(), ex);
            return null;
        }
    }
View Full Code Here

    private IComponentSpecification newSpec(String propertyName, String persistence)
    {
        IComponentSpecification spec = newSpec();
       
        IPropertySpecification ps = newMock(IPropertySpecification.class);
        checkOrder(ps, false);
       
        expect(spec.getPropertySpecification(propertyName)).andReturn(ps);

        expect(ps.getPersistence()).andReturn(persistence);

        return spec;
    }
View Full Code Here

        IComponent component = newComponent();
       
        IComponentSpecification spec = newSpec();
       
        IPropertySpecification ps = newMock(IPropertySpecification.class);

        expect(component.getSpecification()).andReturn(spec);

        expect(spec.getPropertySpecification("zip")).andReturn(ps);

        expect(ps.getPersistence()).andReturn("unknown");

        expect(source.getStrategy("unknown")).andThrow(inner);

        expect(ps.getLocation()).andReturn(l);

        log.error("Simulated error.", l, inner);

        replay();
View Full Code Here

        worker.peformEnhancement(op, spec, method, resource);

        verify();

        IPropertySpecification ps = spec.getPropertySpecification("propertyWithInitialValue");

        assertEquals("propertyWithInitialValue", ps.getName());
        assertEquals(false, ps.isPersistent());
        assertEquals("fred", ps.getInitialValue());

        Location expectedLocation = newMethodLocation(
                AnnotatedPage.class,
                method,
                InitialValue.class);

        assertEquals(expectedLocation, ps.getLocation());
    }
View Full Code Here

      worker.setPropertySource(propertySource);
      worker.performEnhancement(op, spec, m, l);

        verify();

        IPropertySpecification ps = spec.getPropertySpecification("persistentProperty");

        assertEquals("session", ps.getPersistence());
        assertEquals("persistentProperty", ps.getName());
        assertSame(l, ps.getLocation());
        assertNull(ps.getInitialValue());
    }
View Full Code Here

      worker.setPropertySource(propertySource);
      worker.performEnhancement(op, spec, m, l);

        verify();

        IPropertySpecification ps = spec.getPropertySpecification("clientPersistentProperty");

        assertEquals("client", ps.getPersistence());
        assertEquals("clientPersistentProperty", ps.getName());
        assertSame(l, ps.getLocation());
        assertNull(ps.getInitialValue());
    }
View Full Code Here

      worker.setPropertySource(propertySource);
      worker.performEnhancement(op, spec, m, l);

        verify();

        IPropertySpecification ps = spec
                .getPropertySpecification("persistentPropertyWithInitialValue");

        assertEquals("session", ps.getPersistence());
        assertEquals("persistentPropertyWithInitialValue", ps.getName());
        assertSame(l, ps.getLocation());
        assertEquals("user.naturalName", ps.getInitialValue());
    }
View Full Code Here

public class TestComponentPropertyProxyWorker extends BaseAnnotationTestCase
{

    IPropertySpecification addProperty(EnhancementOperation op, IComponentSpecification spec, Location l,
            String propertyName) {
        IPropertySpecification pspec = new PropertySpecification();

        pspec.setName(propertyName);
        pspec.setPersistence("session");
        pspec.setLocation(l);

        spec.addPropertySpecification(pspec);
       
        return pspec;
    }
View Full Code Here

        worker.performEnhancement(op, spec);

        verify();

        IPropertySpecification prop = spec.getPropertySpecification("value");

        assert prop != null;
        assert prop.isPersistent();
        assert prop.isProxyChecked();
        assert !prop.canProxy();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.spec.IPropertySpecification

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.