Package org.apache.tapestry.runtime

Examples of org.apache.tapestry.runtime.Component


    /** More of an integration test. */
    @Test
    public void load_component_via_service() throws Exception
    {
        Component target = createComponent(BasicComponent.class);

        // Should not be an instance, since it is loaded by a different class loader.
        assertFalse(BasicComponent.class.isInstance(target));

        _access.set(target, "value", "some default value");
        assertEquals(_access.get(target, "value"), "some default value");

        _access.set(target, "retainedValue", "some retained value");
        assertEquals(_access.get(target, "retainedValue"), "some retained value");

        // Setting a property value before pageDidLoad will cause that value
        // to be the default when the page detaches.

        target.containingPageDidLoad();

        _access.set(target, "value", "some transient value");
        assertEquals(_access.get(target, "value"), "some transient value");

        target.containingPageDidDetach();

        assertEquals(_access.get(target, "value"), "some default value");
        assertEquals(_access.get(target, "retainedValue"), "some retained value");
    }
View Full Code Here


    }

    @Test
    public void load_sub_component_via_service() throws Exception
    {
        Component target = createComponent(BasicSubComponent.class);

        target.containingPageDidLoad();

        _access.set(target, "value", "base class");
        assertEquals(_access.get(target, "value"), "base class");

        _access.set(target, "intValue", 33);
        assertEquals(_access.get(target, "intValue"), 33);

        target.containingPageDidDetach();

        assertNull(_access.get(target, "value"));
        assertEquals(_access.get(target, "intValue"), 0);
    }
View Full Code Here

        // Can't wait for the HiveMind code base to start using some generics for this kind of
        // thing.

        Instantiator inst = _source.findInstantiator(classname);

        Component target = inst.newInstance(resources);

        verify();

        return target;
    }
View Full Code Here

    /** More of an integration test. */
    @Test
    public void load_component_via_service() throws Exception
    {
        Component target = createComponent(BasicComponent.class);

        // Should not be an instance, since it is loaded by a different class loader.
        assertFalse(BasicComponent.class.isInstance(target));

        _access.set(target, "value", "some default value");
        assertEquals(_access.get(target, "value"), "some default value");

        _access.set(target, "retainedValue", "some retained value");
        assertEquals(_access.get(target, "retainedValue"), "some retained value");

        // Setting a property value before pageDidLoad will cause that value
        // to be the default when the page detaches.

        target.containingPageDidLoad();

        _access.set(target, "value", "some transient value");
        assertEquals(_access.get(target, "value"), "some transient value");

        target.containingPageDidDetach();

        assertEquals(_access.get(target, "value"), "some default value");
        assertEquals(_access.get(target, "retainedValue"), "some retained value");
    }
View Full Code Here

    }

    @Test
    public void load_sub_component_via_service() throws Exception
    {
        Component target = createComponent(BasicSubComponent.class);

        target.containingPageDidLoad();

        _access.set(target, "value", "base class");
        assertEquals(_access.get(target, "value"), "base class");

        _access.set(target, "intValue", 33);
        assertEquals(_access.get(target, "intValue"), 33);

        target.containingPageDidDetach();

        assertNull(_access.get(target, "value"));
        assertEquals(_access.get(target, "intValue"), 0);
    }
View Full Code Here

        // Can't wait for the HiveMind code base to start using some generics for this kind of
        // thing.

        Instantiator inst = _source.findInstantiator(classname);

        Component target = inst.newInstance(resources);

        verify();

        return target;
    }
View Full Code Here

    public void not_a_field()
    {
        FieldValidatorSource source = mockFieldValidatorSource();
        ComponentResources container = mockComponentResources();
        ComponentResources component = mockComponentResources();
        Component instance = mockComponent();
        Location l = mockLocation();

        train_getComponent(component, instance);
        train_getCompleteId(component, "foo.Bar:baz");
View Full Code Here

    @Test
    public void peek_required_without_value_is_error()
    {
        Environment e = new EnvironmentImpl();
        Location l = mockLocation();
        Component c = mockComponent();

        replay();

        e.push(Location.class, l);
        e.push(Component.class, c);
View Full Code Here

    private static final String LINK_URI = "{LinkURI}";

    @Test
    public void result_is_root_component() throws Exception
    {
        Component result = mockComponent();
        Component source = mockComponent();
        ComponentResources resources = mockComponentResources();
        Logger logger = mockLogger();
        RequestPageCache cache = mockRequestPageCache();
        Page page = mockPage();
        LinkFactory factory = mockLinkFactory();
View Full Code Here

    }

    @Test
    public void warning_for_component_is_not_root_component() throws Exception
    {
        Component value = mockComponent();
        Component source = mockComponent();
        Component containerResources = mockComponent();
        ComponentResources valueResources = mockComponentResources();
        ComponentResources sourceResources = mockComponentResources();
        Logger logger = mockLogger();
        RequestPageCache cache = mockRequestPageCache();
        Page page = mockPage();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.runtime.Component

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.