Package org.apache.tapestry5.services.pageload

Examples of org.apache.tapestry5.services.pageload.ComponentResourceLocator


    {
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        Resource resource = mockResource();
        ComponentResourceLocator locator = mockLocator(model, english, resource);

        train_getComponentClassName(model, PACKAGE + ".Fred");

        expect(resource.exists()).andReturn(true);
        expect(resource.toURL()).andReturn(null);
View Full Code Here


        ComponentTemplate template = mockComponentTemplate();
        InvalidationListener listener = mockInvalidationListener();

        train_getComponentClassName(model, "baz.Biff");

        ComponentResourceLocator locator = mockLocator(model, english, localized);

        train_parseTemplate(parser, localized, template);

        replay();

        ComponentTemplateSourceImpl source = new ComponentTemplateSourceImpl(false, parser, locator, converter);
        source.addInvalidationListener(listener);

        assertSame(source.getTemplate(model, Locale.ENGLISH), template);

        // Check for updates (which won't be found).
        source.checkForUpdates();

        // A second pass will test the caching (the
        // parser is not invoked).

        assertSame(source.getTemplate(model, Locale.ENGLISH), template);

        verify();

        // Now, change the file and processInbound an UpdateEvent.

        touch(f);

        listener.objectWasInvalidated();

        replay();

        // Check for updates (which will be found).
        source.checkForUpdates();

        verify();

        // Check that the cache really is cleared.

        train_getComponentClassName(model, "baz.Biff");

        expect(locator.locateTemplate(model, english)).andReturn(localized);

        train_parseTemplate(parser, localized, template);

        replay();
View Full Code Here

    {
        Resource resource = mockResource();
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        ComponentResourceLocator locator = newMock(ComponentResourceLocator.class);

        train_getComponentClassName(model, PACKAGE + ".Fred");

        expect(locator.locateTemplate(model, english)).andReturn(resource).once();

        expect(resource.exists()).andReturn(true).anyTimes();
        expect(resource.toURL()).andReturn(null).anyTimes();

        expect(locator.locateTemplate(model, french)).andReturn(resource).once();

        train_parseTemplate(parser, resource, template);

        replay();
View Full Code Here

        Resource baseResource = mockResource();
        Resource missingResource = mockResource();

        train_getComponentClassName(model, PACKAGE + ".Barney");

        ComponentResourceLocator locator = mockLocator(model, english, null);

        train_getParentModel(model, null);

        train_getBaseResource(model, baseResource);
View Full Code Here

        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        ComponentModel parentModel = mockComponentModel();
        Resource resource = mockResource();
        ComponentResourceLocator locator = mockLocator(model, english, null);

        train_getComponentClassName(model, "foo.Bar");

        train_getParentModel(model, parentModel);

        expect(locator.locateTemplate(parentModel, english)).andReturn(resource).once();

        expect(resource.exists()).andReturn(true);
        expect(resource.toURL()).andReturn(null);

        train_parseTemplate(parser, resource, template);
View Full Code Here

    }

    private ComponentResourceLocator mockLocator(ComponentModel model, ComponentResourceSelector selector,
            Resource templateResource)
    {
        ComponentResourceLocator locator = newMock(ComponentResourceLocator.class);

        expect(locator.locateTemplate(model, selector)).andReturn(templateResource).once();

        return locator;
    }
View Full Code Here

    {
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        Resource resource = mockResource();
        ComponentResourceLocator locator = mockLocator(model, english, resource);

        train_getComponentClassName(model, PACKAGE + ".Fred");

        expect(resource.exists()).andReturn(true);
        expect(resource.toURL()).andReturn(null);
View Full Code Here

        ComponentTemplate template = mockComponentTemplate();
        InvalidationListener listener = mockInvalidationListener();

        train_getComponentClassName(model, "baz.Biff");

        ComponentResourceLocator locator = mockLocator(model, english, localized);

        train_parseTemplate(parser, localized, template);

        replay();

        ComponentTemplateSourceImpl source = new ComponentTemplateSourceImpl(false, parser, locator, converter);
        source.addInvalidationListener(listener);

        assertSame(source.getTemplate(model, Locale.ENGLISH), template);

        // Check for updates (which won't be found).
        source.checkForUpdates();

        // A second pass will test the caching (the
        // parser is not invoked).

        assertSame(source.getTemplate(model, Locale.ENGLISH), template);

        verify();

        // Now, change the file and processInbound an UpdateEvent.

        touch(f);

        listener.objectWasInvalidated();

        replay();

        // Check for updates (which will be found).
        source.checkForUpdates();

        verify();

        // Check that the cache really is cleared.

        train_getComponentClassName(model, "baz.Biff");

        expect(locator.locateTemplate(model, english)).andReturn(localized);

        train_parseTemplate(parser, localized, template);

        replay();
View Full Code Here

    {
        Resource resource = mockResource();
        TemplateParser parser = mockTemplateParser();
        ComponentTemplate template = mockComponentTemplate();
        ComponentModel model = mockComponentModel();
        ComponentResourceLocator locator = newMock(ComponentResourceLocator.class);

        train_getComponentClassName(model, PACKAGE + ".Fred");

        expect(locator.locateTemplate(model, english)).andReturn(resource).once();

        expect(resource.exists()).andReturn(true).anyTimes();
        expect(resource.toURL()).andReturn(null).anyTimes();

        expect(locator.locateTemplate(model, french)).andReturn(resource).once();

        train_parseTemplate(parser, resource, template);

        replay();
View Full Code Here

        Resource baseResource = mockResource();
        Resource missingResource = mockResource();

        train_getComponentClassName(model, PACKAGE + ".Barney");

        ComponentResourceLocator locator = mockLocator(model, english, null);

        train_getParentModel(model, null);

        train_getBaseResource(model, baseResource);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.services.pageload.ComponentResourceLocator

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.