Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Infrastructure


        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        ClassResolver cr = (ClassResolver) newMock(ClassResolver.class);

        MockControl infrac = newControl(Infrastructure.class);
        Infrastructure infra = (Infrastructure) infrac.getMock();

        PageRenderSupport prs = (PageRenderSupport) newMock(PageRenderSupport.class);

        cycle.getInfrastructure();
        cyclec.setReturnValue(infra);

        infra.getClassResolver();
        infrac.setReturnValue(cr);

        trainGetAttribute(cyclec, cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        return cycle;
View Full Code Here


    }

    private Infrastructure newInfrastructure(ClassResolver resolver)
    {
        MockControl control = newControl(Infrastructure.class);
        Infrastructure inf = (Infrastructure) control.getMock();

        inf.getClassResolver();
        control.setReturnValue(resolver);

        return inf;
    }
View Full Code Here

        ClassResolver resolver = newResolver();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        Infrastructure inf = newInfrastructure(resolver);

        cycle.getInfrastructure();
        cyclec.setReturnValue(inf);

        PageRenderSupport prs = newSupport();
View Full Code Here

        ClassResolver resolver = newResolver();

        MockControl cyclec = newControl(IRequestCycle.class);
        IRequestCycle cycle = (IRequestCycle) cyclec.getMock();

        Infrastructure inf = newInfrastructure(resolver);

        cycle.getInfrastructure();
        cyclec.setReturnValue(inf);

        PageRenderSupport prs = newSupport();
View Full Code Here

    private void trainForConstructor(IPage page, IComponent component, ClassResolver resolver,
            ClassFinder classFinder)
    {
        IRequestCycle cycle = newCycle();
        Infrastructure infrastructure = (Infrastructure) newMock(Infrastructure.class);
        INamespace namespace = (INamespace) newMock(INamespace.class);

        trainGetPage(component, page);

        page.getRequestCycle();
        getControl(page).setReturnValue(cycle);

        cycle.getInfrastructure();
        getControl(cycle).setReturnValue(infrastructure);

        infrastructure.getClassResolver();
        getControl(infrastructure).setReturnValue(resolver);

        component.getNamespace();
        getControl(component).setReturnValue(namespace);

        namespace.getPropertyValue("org.apache.tapestry.bean-class-packages");
        getControl(namespace).setReturnValue("mypackage");

        infrastructure.getClassFinder();
        getControl(infrastructure).setReturnValue(classFinder);
    }
View Full Code Here

    public void test_Write_Body_Script()
    {
        MarkupFilter filter = new UTFMarkupFilter();
        PrintWriter writer = newPrintWriter();
        IRequestCycle cycle = newMock(IRequestCycle.class);
        Infrastructure inf = newMock(Infrastructure.class);
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        DojoAjaxResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, mw, null);
       
        String bscript = "var e=4;";
        String imageInit = "image initializations";
        String preload = "preloadedvarname";
       
        verify();
       
        expect(cycle.getInfrastructure()).andReturn(inf);
        expect(inf.getOutputEncoding()).andReturn("UTF-8");
       
        replay();
       
        builder.beginResponse();
       
View Full Code Here

    public void test_Write_External_Scripts()
    {
        MarkupFilter filter = new UTFMarkupFilter();
        PrintWriter writer = newPrintWriter();
        IRequestCycle cycle = newMock(IRequestCycle.class);
        Infrastructure inf = newMock(Infrastructure.class);
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        DojoAjaxResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, mw, null);
       
        String script1 = "http://noname/js/package.js";
        String script2 = "http://noname/js/package2.js";
       
        verify();
       
        expect(cycle.getInfrastructure()).andReturn(inf);
        expect(inf.getOutputEncoding()).andReturn("UTF-8");
       
        replay();
       
        builder.beginResponse();
       
View Full Code Here

    public void test_Write_Initialization_Script()
    {
        IRequestCycle cycle = newMock(IRequestCycle.class);
        MarkupFilter filter = new UTFMarkupFilter();
        PrintWriter writer = newPrintWriter();
        Infrastructure inf = newMock(Infrastructure.class);
       
        replay();
       
        IMarkupWriter mw = new MarkupWriterImpl("text/html", writer, filter);
        DojoAjaxResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, mw, null);
       
        String script = "doThisInInit();";
       
        verify();
       
        expect(cycle.getInfrastructure()).andReturn(inf);
        expect(inf.getOutputEncoding()).andReturn("UTF-8");
       
        replay();
       
        builder.beginResponse();
       
View Full Code Here

    private IRequestCycle newCycle(IComponent component)
    {
        IRequestCycle cycle = newCycle();

        ClassResolver cr = newMock(ClassResolver.class);
        Infrastructure infra = newMock(Infrastructure.class);

        PageRenderSupport prs = newMock(PageRenderSupport.class);

        expect(cycle.getInfrastructure()).andReturn(infra);

        expect(infra.getClassResolver()).andReturn(cr);

        trainGetAttribute(cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        return cycle;
    }
View Full Code Here

        return newMock(IEngineService.class);
    }

    public void testGetters()
    {
        Infrastructure infrastructure = newMock(Infrastructure.class);
        PageSource pageSource = new PageSource();
       
        expect(infrastructure.getPageSource()).andReturn(pageSource);
       
        IEngineService service = newService();
        ServiceMap map = newServiceMap("fred", service);
       
        expect(infrastructure.getServiceMap()).andReturn(map);
       
        RequestCycleEnvironment env = new RequestCycleEnvironment(newErrorHandler(),
                infrastructure, newStrategySource(), newBuilder());
       
        IEngine engine = newEngine();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.Infrastructure

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.