Package org.apache.tapestry.ioc.services

Examples of org.apache.tapestry.ioc.services.ThreadLocale


    @Test
    public void get_classpath_asset()
    {
        AssetFactory factory = newAssetFactory();
        ThreadLocale threadLocale = newThreadLocale();
        Asset asset = newAsset();

        Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");

        train_getRootResource(factory, _rootResource);
View Full Code Here


    @Test
    public void get_classpath_asset_for_unspecified_locale()
    {
        AssetFactory factory = newAssetFactory();
        ThreadLocale threadLocale = newThreadLocale();
        Asset asset = newAsset();
        Locale locale = Locale.UK;

        Resource expectedResource = _baseResource.forFile("SimpleComponent_en_GB.properties");
View Full Code Here

    @Test
    public void absolute_asset_with_known_prefix()
    {
        AssetFactory factory = newAssetFactory();
        ThreadLocale threadLocale = newThreadLocale();
        Asset asset = newAsset();

        Resource expectedResource = _rootResource
                .forFile("org/apache/tapestry/internal/services/SimpleComponent_en_GB.properties");
View Full Code Here

    }

    @Test
    public void unknown_asset_prefix()
    {
        ThreadLocale threadLocale = newThreadLocale();

        Map<String, AssetFactory> configuration = Collections.emptyMap();

        replay();
View Full Code Here

    }

    @Test
    public void missing_resource()
    {
        ThreadLocale threadLocale = newThreadLocale();

        Map<String, AssetFactory> configuration = Collections.emptyMap();

        replay();
View Full Code Here

    }

    @Test
    public void known_locale()
    {
        ThreadLocale threadLocale = new ThreadLocaleImpl();
        threadLocale.setLocale(Locale.FRENCH);
        LocalizationSetter setter = new LocalizationSetterImpl(_nullPersistentLocale, threadLocale,
                "en,fr");
        setter.setThreadLocale(Locale.CANADA_FRENCH);
        assertEquals(threadLocale.getLocale(), Locale.FRENCH);

    }
View Full Code Here

    }

    @Test
    public void unknown_locale_uses_default_locale()
    {
        ThreadLocale threadLocale = new ThreadLocaleImpl();
        threadLocale.setLocale(Locale.FRENCH);
        LocalizationSetter setter = new LocalizationSetterImpl(_nullPersistentLocale, threadLocale,
                "en,fr");
        setter.setThreadLocale(Locale.JAPANESE);
        assertEquals(threadLocale.getLocale(), Locale.ENGLISH);
    }
View Full Code Here

    }

    @Test
    public void use_persistent_locale()
    {
        ThreadLocale threadLocale = new ThreadLocaleImpl();
        LocalizationSetter setter = new LocalizationSetterImpl(_frenchPersistentLocale,
                threadLocale, "en,fr");
        setter.setThreadLocale(Locale.ENGLISH);
        assertEquals(threadLocale.getLocale(), Locale.FRENCH);
    }
View Full Code Here

    @Test
    public void checkout_when_page_list_is_null()
    {
        PageLoader loader = newPageLoader();
        Page page = newPage();
        ThreadLocale tl = newThreadLocale();

        train_getLocale(tl, _locale);

        train_loadPage(loader, PAGE_NAME, _locale, page);
View Full Code Here

                }
                return null;
            }

        };
        ThreadLocale threadLocale = new ThreadLocaleImpl();
        threadLocale.setLocale(_locale);
        PagePool pool = new PagePoolImpl(null, loader, threadLocale);
        pool.release(page1);
        assertSame(page1, pool.checkout(PAGE_NAME));
        // Now the list is empty, but not null.
        assertSame(page2, pool.checkout(PAGE_NAME));
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.services.ThreadLocale

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.