Package org.apache.tiles.locale

Examples of org.apache.tiles.locale.LocaleResolver


    public void testCreateLocaleResolver() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver localeResolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        assertTrue("The class of the locale resolver is not correct",
                localeResolver instanceof DefaultLocaleResolver);
    }
View Full Code Here


    public void testCreateEvaluator() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        AttributeEvaluator evaluator = factory.createEvaluator(context,
                applicationContext, contextFactory, resolver);
        assertTrue("The class of the evaluator is not correct",
                evaluator instanceof DirectAttributeEvaluator);
View Full Code Here

        TilesContainer container = factory.createContainer(context);
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        AttributeEvaluator evaluator = factory.createEvaluator(context,
                applicationContext, contextFactory, resolver);
        RendererFactory rendererFactory = factory.createRendererFactory(
                context, applicationContext, contextFactory, container,
View Full Code Here

        TilesContainer container = factory.createContainer(context);
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        AttributeEvaluator evaluator = factory.createEvaluator(context,
                applicationContext, contextFactory, resolver);
        AttributeRenderer renderer = factory.createDefaultAttributeRenderer(
                context, applicationContext, contextFactory, container,
View Full Code Here

     * .
     */
    @Test
    public void testCreateAttributeEvaluatorFactory() {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        LocaleResolver resolver = createMock(LocaleResolver.class);
        ServletContext servletContext = createMock(ServletContext.class);
        JspFactory jspFactory = createMock(JspFactory.class);
        JspApplicationContext jspApplicationContext = createMock(JspApplicationContext.class);
        ExpressionFactory expressionFactory = createMock(ExpressionFactory.class);

View Full Code Here

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testGetDefinition() {
        DefinitionDAO<Locale> dao = createMock(DefinitionDAO.class);
        LocaleResolver localeResolver = createMock(LocaleResolver.class);
        Request request = createMock(Request.class);
        Attribute templateAttribute = Attribute.createTemplateAttribute("/mytemplate.jsp");
        Definition definition = new Definition("myDefinition", null, null);
        definition.setExtends("anotherDefinition");
        Map<String, Attribute> attributes = new HashMap<String, Attribute>();
        attributes.put("first", new Attribute("myValue"));
        Definition anotherDefinition = new Definition("anotherDefinition", templateAttribute, attributes);
        Locale locale = Locale.ITALY;

        expect(localeResolver.resolveLocale(request)).andReturn(locale);
        expect(dao.getDefinition("myDefinition", locale)).andReturn(definition);
        expect(dao.getDefinition("anotherDefinition", locale)).andReturn(anotherDefinition);

        LocaleDefinitionsFactory factory = new LocaleDefinitionsFactory();

View Full Code Here

     */
    @SuppressWarnings("unchecked")
    @Test(expected = NoSuchDefinitionException.class)
    public void testGetDefinitionNoParent() {
        DefinitionDAO<Locale> dao = createMock(DefinitionDAO.class);
        LocaleResolver localeResolver = createMock(LocaleResolver.class);
        Request request = createMock(Request.class);
        Definition definition = new Definition("myDefinition", null, null);
        definition.setExtends("anotherDefinition");
        Map<String, Attribute> attributes = new HashMap<String, Attribute>();
        attributes.put("first", new Attribute("myValue"));
        Locale locale = Locale.ITALY;

        expect(localeResolver.resolveLocale(request)).andReturn(locale);
        expect(dao.getDefinition("myDefinition", locale)).andReturn(definition);
        expect(dao.getDefinition("anotherDefinition", locale)).andReturn(null);

        LocaleDefinitionsFactory factory = new LocaleDefinitionsFactory();

View Full Code Here

     */
    @SuppressWarnings("unchecked")
    @Test
    public void testGetDefinition() {
        DefinitionDAO<Locale> dao = createMock(DefinitionDAO.class);
        LocaleResolver localeResolver = createMock(LocaleResolver.class);
        UnresolvingLocaleDefinitionsFactory factory = new UnresolvingLocaleDefinitionsFactory();
        Request request = createMock(Request.class);
        Definition definition = createMock(Definition.class);
        Locale locale = Locale.ITALY;

        expect(localeResolver.resolveLocale(request)).andReturn(locale);
        expect(dao.getDefinition("myDefinition", locale)).andReturn(definition);

        replay(dao, localeResolver, request, definition);
        factory.setDefinitionDAO(dao);
        factory.setLocaleResolver(localeResolver);
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createDefinitionsFactory(
     * ApplicationContext, LocaleResolver)}.
     */
    public void testCreateDefinitionsFactory() {
        LocaleResolver resolver = factory.createLocaleResolver(applicationContext);
        DefinitionsFactory defsFactory = factory.createDefinitionsFactory(applicationContext, resolver);
        assertTrue("The class of the definitions factory is not correct",
                defsFactory instanceof UnresolvingLocaleDefinitionsFactory);
    }
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createLocaleResolver(
     * ApplicationContext)}.
     */
    public void testCreateLocaleResolver() {
        LocaleResolver localeResolver = factory.createLocaleResolver(applicationContext);
        assertTrue("The class of the locale resolver is not correct", localeResolver instanceof DefaultLocaleResolver);
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.locale.LocaleResolver

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.