Package org.apache.tapestry

Examples of org.apache.tapestry.PropertyConduit


    }

    @Test
    public void default_order_no_annotation()
    {
        PropertyConduit conduit = newPropertyConduit();

        train_getAnnotation(conduit, Order.class, null);

        replay();
View Full Code Here


    }

    @Test
    public void default_order_with_annotation()
    {
        PropertyConduit conduit = newPropertyConduit();
        Order order = newMock(Order.class);

        train_getAnnotation(conduit, Order.class, order);

        expect(order.value()).andReturn(99);
View Full Code Here

public class ValidateAnnotationConstraintGeneratorTest extends InternalBaseTestCase
{
    @Test
    public void no_annotation()
    {
        PropertyConduit conduit = newPropertyConduit();

        train_getAnnotation(conduit, Validate.class, null);

        replay();
View Full Code Here

    }

    @Test
    public void single_constraint()
    {
        PropertyConduit conduit = newPropertyConduit();
        Validate validate = newValidate("required");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

    }

    @Test
    public void multiple_constraints()
    {
        PropertyConduit conduit = newPropertyConduit();
        Validate validate = newValidate("required,minlength=3");

        train_getAnnotation(conduit, Validate.class, validate);

        replay();
View Full Code Here

        assertEquals(firstName.getPropertyType(), String.class);
        assertEquals(firstName.getDataType(), "text");

        assertEquals(model.get("lastName").getLabel(), "Last Name");

        PropertyConduit conduit = model.get("lastName").getConduit();

        SimpleBean instance = new SimpleBean();

        instance.setLastName("Lewis Ship");

        assertEquals(conduit.get(instance), "Lewis Ship");

        conduit.set(instance, "TapestryDude");

        assertEquals(instance.getLastName(), "TapestryDude");

        // Now, one with some type coercion.
View Full Code Here

        String[] value =
        { "foo", "bar" };

        StringArrayBean bean = new StringArrayBean();

        PropertyConduit conduit = propertyModel.getConduit();

        conduit.set(bean, value);

        assertSame(bean.getArray(), value);

        assertSame(conduit.get(bean), value);

        verify();
    }
View Full Code Here

    }

    @Test
    public void question_dot_operator_for_object_type()
    {
        PropertyConduit normal = _source.create(CompositeBean.class, "simple.firstName");
        PropertyConduit smart = _source.create(CompositeBean.class, "simple?.firstName");

        CompositeBean bean = new CompositeBean();
        bean.setSimple(null);

        try
        {
            normal.get(bean);
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        assertNull(smart.get(bean));

        try
        {
            normal.set(bean, "Howard");
            unreachable();
        }
        catch (NullPointerException ex)
        {
            // Expected.
        }

        // This will be a no-op due to the null property in the expression

        smart.set(bean, "Howard");
    }
View Full Code Here

    }

    @Test
    public void default_order_no_annotation()
    {
        PropertyConduit conduit = mockPropertyConduit();

        train_getAnnotation(conduit, Order.class, null);

        replay();
View Full Code Here

    }

    @Test
    public void default_order_with_annotation()
    {
        PropertyConduit conduit = mockPropertyConduit();
        Order order = newMock(Order.class);

        train_getAnnotation(conduit, Order.class, order);

        expect(order.value()).andReturn(99);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.PropertyConduit

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.