Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Infrastructure


    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();
        builder.beginBodyScript(mw, cycle);
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();
        builder.writeExternalScript(mw, script1, cycle);
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();
        builder.writeInitializationScript(mw, script);
View Full Code Here

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

        trainGetPage(component, page);

        expect(page.getRequestCycle()).andReturn(cycle);

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

        expect(infrastructure.getClassResolver()).andReturn(resolver);

        expect(component.getNamespace()).andReturn(namespace);

        expect(namespace.getPropertyValue("org.apache.tapestry.bean-class-packages"))
        .andReturn("mypackage");

        expect(infrastructure.getClassFinder()).andReturn(classFinder);
    }
View Full Code Here

        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(cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        return cycle;
View Full Code Here

        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(cycle, TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, prs);

        return cycle;
View Full Code Here

    public BeanProvider(IComponent component)
    {
        _component = component;

        Infrastructure infrastructure = component.getPage().getRequestCycle().getInfrastructure();

        _resolver = infrastructure.getClassResolver();

        INamespace namespace = component.getNamespace();
        _packageList = namespace.getPropertyValue("org.apache.tapestry.bean-class-packages");

        _classFinder = infrastructure.getClassFinder();
    }
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

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.