Package org.apache.tapestry5.runtime

Examples of org.apache.tapestry5.runtime.Component


    @Test
    public void get_embedded_does_not_exist()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Logger logger = mockLogger();

        train_getLogger(model, logger);
View Full Code Here


    @Test
    public void get_existing_embedded_component()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        ComponentPageElement childElement = mockComponentPageElement();
        Component childComponent = mockComponent();
        TypeCoercer coercer = mockTypeCoercer();
        Logger logger = mockLogger();

        train_getLogger(model, logger);
View Full Code Here

    @Test
    public void component_ids_must_be_unique_within_container()
    {
        Page page = newPage(PAGE_NAME);
        Component pageComponent = mockComponent();
        ComponentModel model = mockComponentModel();
        ComponentPageElement child1 = mockComponentPageElement();
        ComponentPageElement child2 = mockComponentPageElement();
        TypeCoercer coercer = mockTypeCoercer();
        Location l = mockLocation();
View Full Code Here

    @Test
    public void get_mixin_by_class_name()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        final String mixinClassName = "foo.Bar";
        Component mixin = mockComponent();
        ComponentModel mixinModel = mockComponentModel();
        Logger logger = mockLogger();

        train_getLogger(model, logger);
View Full Code Here

    @Test
    public void get_mixin_by_unknown_class_name()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        TypeCoercer coercer = mockTypeCoercer();
        Component mixin = mockComponent();
        ComponentModel mixinModel = mockComponentModel();
        Logger logger = mockLogger();

        train_getLogger(model, logger);
View Full Code Here

    @Test
    public void set_explicit_parameter_of_unknown_mixin()
    {
        Page page = newPage(PAGE_NAME);
        Component component = mockComponent();
        ComponentModel model = mockComponentModel();
        ComponentModel mixinModel = mockComponentModel();
        Component mixin = mockComponent();
        TypeCoercer coercer = mockTypeCoercer();
        Binding binding = mockBinding();
        Logger logger = mockLogger();

        train_getLogger(model, logger);
View Full Code Here

    @Test
    public void invariant_object_retained_after_detach() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        Component component = setupForIntegrationTest(resources);

        // On first invocation, the resources are queried.

        String value = "To be in Tapestry in the spring time ...";

        train_isLoaded(resources, true);
        train_isBound(resources, "invariantObject", true);
        train_readParameter(resources, "invariantObject", String.class, value);

        replay();

        assertSame(access.get(component, "invariantObject"), value);

        verify();

        // No further training needed here.

        replay();

        // Still cached ...

        assertSame(access.get(component, "invariantObject"), value);

        component.postRenderCleanup();

        // Still cached ...

        assertSame(access.get(component, "invariantObject"), value);

        component.containingPageDidDetach();

        // Still cached ...

        assertSame(access.get(component, "invariantObject"), value);
View Full Code Here

    @Test
    public void invariant_primitive_retained_after_detach() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        Component component = setupForIntegrationTest(resources);

        // On first invocation, the resources are queried.

        long value = 123456;

        train_isLoaded(resources, true);
        train_isBound(resources, "invariantPrimitive", true);
        train_readParameter(resources, "invariantPrimitive", Long.class, value);

        replay();

        assertEquals(access.get(component, "invariantPrimitive"), value);

        verify();

        // No further training needed here.

        replay();

        // Still cached ...

        assertEquals(access.get(component, "invariantPrimitive"), value);

        component.postRenderCleanup();

        // Still cached ...

        assertEquals(access.get(component, "invariantPrimitive"), value);
View Full Code Here

    @Test
    public void changes_before_load_become_defaults_and_dont_update_bindings() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        Component component = setupForIntegrationTest(resources);

        train_isLoaded(resources, false);

        replay();

        assertNull(access.get(component, "object"));

        verify();

        train_isLoaded(resources, false);

        replay();

        access.set(component, "object", "new-default");

        verify();

        train_isLoaded(resources, false);

        replay();

        assertEquals(access.get(component, "object"), "new-default");

        verify();

        trainForPageDidLoad(resources);

        replay();

        component.containingPageDidLoad();

        verify();

        // For the set ...

        train_isLoaded(resources, true);
        train_isBound(resources, "object", false);
        train_isRendering(resources, false);

        // For the first read ...

        train_isLoaded(resources, true);
        train_isBound(resources, "object", false);

        // For the second read (after postRenderCleanup) ...

        train_isLoaded(resources, true);
        train_isBound(resources, "object", false);

        replay();

        access.set(component, "object", "new-value");
        assertEquals(access.get(component, "object"), "new-value");

        component.postRenderCleanup();

        assertEquals(access.get(component, "object"), "new-default");

        verify();
    }
View Full Code Here

    @Test
    public void cached_object_read() throws Exception
    {
        InternalComponentResources resources = mockInternalComponentResources();

        Component component = setupForIntegrationTest(resources);

        train_isLoaded(resources, true);
        train_isBound(resources, "object", true);
        train_readParameter(resources, "object", String.class, "first");
        train_isRendering(resources, false);

        replay();

        assertEquals(access.get(component, "object"), "first");

        verify();

        // Keeps re-reading the parameter when not rendering.

        train_isLoaded(resources, true);
        train_isBound(resources, "object", true);
        train_readParameter(resources, "object", String.class, "second");
        train_isRendering(resources, false);

        replay();

        assertEquals(access.get(component, "object"), "second");

        verify();

        // Now, when rendering is active, the value is cached

        train_isLoaded(resources, true);
        train_isBound(resources, "object", true);
        train_readParameter(resources, "object", String.class, "third");
        train_isRendering(resources, true);

        replay();

        assertEquals(access.get(component, "object"), "third");

        // Does not cause readParameter() to be invoked:

        assertEquals(access.get(component, "object"), "third");

        verify();

        train_isLoaded(resources, true);
        train_isBound(resources, "object", true);
        train_readParameter(resources, "object", String.class, "fourth");
        train_isRendering(resources, false);

        replay();

        component.postRenderCleanup();

        assertEquals(access.get(component, "object"), "fourth");

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.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.