Package org.apache.tiles.context

Examples of org.apache.tiles.context.TilesContextFactory


     * Tests {@link AbstractBaseAttributeRenderer#getRequestContext(Object...)}.
     */
    public void testGetRequestContext() {
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        EasyMock.replay(applicationContext, contextFactory, requestContext);
        renderer.setApplicationContext(applicationContext);
        renderer.setContextFactory(contextFactory);
        assertTrue("This is not the expected request",
View Full Code Here


     * {@link AbstractBaseAttributeRenderer#isPermitted(TilesRequestContext, Set)}.
     */
    public void testIsPermitted() {
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        EasyMock.expect(requestContext.isUserInRole("first")).andReturn(
                Boolean.TRUE).anyTimes();
        EasyMock.expect(requestContext.isUserInRole("second")).andReturn(
                Boolean.FALSE).anyTimes();
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createContextFactory(Object)}.
     */
    public void testCreateContextFactory() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        assertTrue("The class of the context factory is not correct",
                contextFactory instanceof ChainedTilesContextFactory);
    }
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createDefinitionsFactory(Object,
     * TilesApplicationContext, TilesContextFactory, LocaleResolver)}.
     */
    public void testCreateDefinitionsFactory() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        LocaleResolver resolver = factory.createLocaleResolver(context,
                applicationContext, contextFactory);
        DefinitionsFactory defsFactory = factory.createDefinitionsFactory(
                context, applicationContext, contextFactory, resolver);
View Full Code Here

    /**
     * Tests {@link BasicTilesContainerFactory#createLocaleResolver(Object,
     * TilesApplicationContext, TilesContextFactory)}.
     */
    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

    /**
     * Tests {@link BasicTilesContainerFactory#createDefinitionsReader(Object,
     * TilesApplicationContext, TilesContextFactory)}.
     */
    public void testCreateDefinitionsReader() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        DefinitionsReader reader = factory.createDefinitionsReader(context,
                applicationContext, contextFactory);
        assertTrue("The class of the reader is not correct",
                reader instanceof DigesterDefinitionsReader);
View Full Code Here

    /**
     * Tests
     * {@link BasicTilesContainerFactory#getSourceURLs(Object, TilesApplicationContext, TilesContextFactory)}.
     */
    public void testGetSourceURLs() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        List<URL> urls = factory.getSourceURLs(context, applicationContext,
                contextFactory);
        assertEquals("The urls list is not one-sized", 1, urls.size());
        assertEquals("The URL is not correct", url, urls.get(0));
View Full Code Here

     * Tests
     * {@link BasicTilesContainerFactory#createEvaluator(Object,
     * TilesApplicationContext, TilesContextFactory, LocaleResolver)}.
     */
    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);
View Full Code Here

    /**
     * Tests
     * {@link BasicTilesContainerFactory#createPreparerFactory(Object, TilesApplicationContext, TilesContextFactory)}.
     */
    public void testCreatePreparerFactory() {
        TilesContextFactory contextFactory = factory
                .createContextFactory(context);
        TilesApplicationContext applicationContext = contextFactory
                .createApplicationContext(context);
        PreparerFactory preparerFactory = factory.createPreparerFactory(
                context, applicationContext, contextFactory);
        assertTrue("The class of the preparer factory is not correct",
                preparerFactory instanceof BasicPreparerFactory);
View Full Code Here

    public void testWrite() throws IOException {
        StringWriter writer = new StringWriter();
        Attribute attribute = new Attribute("my.definition", null, "definition");
        TilesApplicationContext applicationContext = EasyMock
                .createMock(TilesApplicationContext.class);
        TilesContextFactory contextFactory = EasyMock
                .createMock(TilesContextFactory.class);
        TilesContainer container = EasyMock.createMock(TilesContainer.class);
        TilesRequestContext requestContext = EasyMock
                .createMock(TilesRequestContext.class);
        EasyMock.expect(contextFactory.createRequestContext(applicationContext))
                .andReturn(requestContext);
        container.render("my.definition");
        EasyMock.replay(applicationContext, contextFactory, requestContext,
                container);
        renderer.setApplicationContext(applicationContext);
View Full Code Here

TOP

Related Classes of org.apache.tiles.context.TilesContextFactory

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.