Examples of IPropertySpecification


Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("PropertySpecifications.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInitialValue", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertEquals("type", "boolean", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());
        assertNull("type", ps.getType());

        // Starting with release 4.0, the initial value is a binding reference
        // with an appropriate prefix. In 3.0 it was always an OGNL expression.

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("type", ps.getType());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInitialValue");
        assertEquals("ognl:long.initial.value", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("Property.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInit", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        // In a 4.0 DTD, type is always null.
        assertNull("type", ps.getType());

        // Note that no prefix is added. Initial value will be a string literal,
        // or have a prefix and be something else.

        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInit");
        assertEquals("message:long-init-key", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

    {
        List names = new ArrayList();
        Iterator i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            names.add(ps.getName());
        }

        MockControl c = newControl(IComponentSpecification.class);
        IComponentSpecification result = (IComponentSpecification) c.getMock();

        result.getPropertySpecificationNames();
        c.setReturnValue(names);

        i = propertySpecs.iterator();
        while (i.hasNext())
        {
            IPropertySpecification ps = (IPropertySpecification) i.next();

            result.getPropertySpecification(ps.getName());
            c.setReturnValue(ps);
        }

        return result;
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

        Iterator i = spec.getPropertySpecificationNames().iterator();

        while (i.hasNext())
        {
            String name = (String) i.next();
            IPropertySpecification ps = spec.getPropertySpecification(name);

            try
            {
                performEnhancement(op, ps);
            }
            catch (RuntimeException ex)
            {
                _errorLog.error(
                        EnhanceMessages.errorAddingProperty(name, op.getBaseClass(), ex),
                        ps.getLocation(),
                        ex);
            }
        }
    }
View Full Code Here

Examples of org.apache.tapestry.spec.IPropertySpecification

    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

Examples of org.apache.tapestry.spec.IPropertySpecification

        new PersistAnnotationWorker().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

Examples of org.apache.tapestry.spec.IPropertySpecification

        new PersistAnnotationWorker().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

Examples of org.apache.tapestry.spec.IPropertySpecification

        new PersistAnnotationWorker().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

Examples of org.apache.tapestry.spec.IPropertySpecification

        IComponentSpecification spec = parsePage("Property.page");

        checkList("propertySpecificationNames", new String[]
        { "bool", "init", "longInit", "persist" }, spec.getPropertySpecificationNames());

        IPropertySpecification ps = spec.getPropertySpecification("bool");
        assertEquals("name", "bool", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        // In a 3.1 DTD, type is always null.
        assertNull("type", ps.getType());

        // Note that no prefix is added. Initial value will be a string literal,
        // or have a prefix and be something else.

        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 24);

        ps = spec.getPropertySpecification("init");
        assertEquals("name", "init", ps.getName());
        assertEquals("persistent", false, ps.isPersistent());

        assertEquals("initialValue", "ognl:pageName", ps.getInitialValue());
        checkLine(ps, 26);

        ps = spec.getPropertySpecification("persist");
        assertEquals("name", "persist", ps.getName());
        assertEquals("persistent", true, ps.isPersistent());
        assertNull("initialValue", ps.getInitialValue());
        checkLine(ps, 25);

        ps = spec.getPropertySpecification("longInit");
        assertEquals("message:long-init-key", ps.getInitialValue());

        ps = spec.getPropertySpecification("unknown");

        assertNull("Unknown PropertySpecification", ps);
    }
View Full Code Here

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();

        spec.getPropertySpecification(propertyName);
        specc.setReturnValue(ps);

        ps.getPersistence();
        psc.setReturnValue(persistence);

        return spec;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.