Package org.apache.tapestry.web

Examples of org.apache.tapestry.web.WebContext


    public void testCreateAbsoluteAsset()
    {
        Location l = newLocation();
        URL url = newURL();
        WebContext context = newMock(WebContext.class);

        trainGetResource(context, "/asset_fr.png", url);

        replay();
View Full Code Here


    }

    public void testCreateAbsoluteAssetMissing()
    {
        Location l = newLocation();
        WebContext context = newMock(WebContext.class);

        trainGetResource(context, "/asset_fr.png", null);
        trainGetResource(context, "/asset.png", null);

        replay();
View Full Code Here

   
    public void testCreateAssetEncodeURL()
    {
        Location l = newLocation();
        URL url = newURL();
        WebContext context = newMock(WebContext.class);
        IRequestCycle rc = newMock(IRequestCycle.class);

        trainGetResource(context, "/asset_fr.png", url);

        trainEncodeURL(rc, "/context/asset_fr.png", "/context/asset_fr.png?encoded");
View Full Code Here

    public void testFoundInSubdir() throws Exception
    {
        PortletConfig config = newConfig("myportlet");
       
        WebContext context = newMock(WebContext.class);

        IApplicationSpecification specification = newSpecification();

        // Any arbitrary file will work here.

        URL fakeURL = getClass().getResource("hivemodule.xml");

        expect(context.getResource("/WEB-INF/myportlet/myportlet.application")).andReturn(fakeURL);
       
        Resource expectedResource = new WebContextResource(context,
                "/WEB-INF/myportlet/myportlet.application");

        ISpecificationParser parser = newParser(expectedResource, specification);
View Full Code Here

    public void testFoundInRootDir() throws Exception
    {
        PortletConfig config = newConfig("myportlet");

        WebContext context = newMock(WebContext.class);

        IApplicationSpecification specification = newSpecification();

        // Any arbitrary file will work here.

        URL fakeURL = getClass().getResource("hivemodule.xml");

        expect(context.getResource("/WEB-INF/myportlet/myportlet.application")).andReturn(null);

        expect(context.getResource("/WEB-INF/myportlet.application")).andReturn(fakeURL);

        Resource expectedResource = new WebContextResource(context,
                "/WEB-INF/myportlet.application");

        ISpecificationParser parser = newParser(expectedResource, specification);
View Full Code Here

    public void testNotFound() throws Exception
    {
        PortletConfig config = newConfig("myportlet");

        WebContext context = newMock(WebContext.class);

        expect(context.getResource("/WEB-INF/myportlet/myportlet.application")).andReturn(null);
       
        expect(context.getResource("/WEB-INF/myportlet.application")).andReturn(null);
       
        replay();

        ApplicationGlobals globals = new ApplicationGlobalsImpl();
View Full Code Here

        expect(context.getInitParameterNames()).andReturn(newEnumeration());

        replay();

        WebContext wc = new PortletWebContext(context);

        List l = wc.getInitParameterNames();

        checkList(l);

        verify();
    }
View Full Code Here

       
        expect(context.getInitParameter("artist")).andReturn(value);

        replay();

        WebContext wc = new PortletWebContext(context);

        assertSame(value, wc.getInitParameterValue("artist"));

        verify();
    }
View Full Code Here

        expect(context.getAttributeNames()).andReturn(newEnumeration());
       
        replay();

        WebContext wc = new PortletWebContext(context);
       
        List l = wc.getAttributeNames();

        checkList(l);

        verify();
    }
View Full Code Here

        expect(context.getAttribute("attr")).andReturn(attribute);

        replay();

        WebContext wc = new PortletWebContext(context);

        assertSame(attribute, wc.getAttribute("attr"));

        verify();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry.web.WebContext

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.