Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Infrastructure


    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


        IComponent comp1 = newMock(IComponent.class);
        IRequestCycle cycle = newMock(IRequestCycle.class);
        IMarkupWriter writer = newMock(IMarkupWriter.class);
        NestedMarkupWriter nested = newMock(NestedMarkupWriter.class);

        Infrastructure infra = newMock(Infrastructure.class);

        List parts = new ArrayList();
        parts.add("id1");

        DojoAjaxResponseBuilder builder = new DojoAjaxResponseBuilder(cycle, writer, parts);

        render.render(NullWriter.getSharedInstance(), cycle);

        expect(comp1.getClientId()).andReturn("id1").anyTimes();

        expect(comp1.peekClientId()).andReturn("id1").anyTimes();

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

        expect(infra.getOutputEncoding()).andReturn("UTF-8");

        writer.printRaw("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        writer.printRaw("<!DOCTYPE html "
                        + "PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
                        + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" [\n"
View Full Code Here

            throws IOException
    {
        IPage page = newMock(IPage.class);
        checkOrder(page, false);
        IRequestCycle cycle = newMock(IRequestCycle.class);
        Infrastructure infra = newMock(Infrastructure.class);
        IMarkupWriter writer = newBufferWriter();
        NestedMarkupWriter nwriter = newNestedWriter();

        ILink link = newMock(ILink.class);
        Location l = newLocation();
       
        RequestLocaleManager rlm = newMock(RequestLocaleManager.class);
        MarkupWriterSource mrs = newMock(MarkupWriterSource.class);
        WebResponse resp = newMock(WebResponse.class);
        AssetFactory assetFactory = newMock(AssetFactory.class);
        IEngineService pageService = newEngineService();

        List errorPages = new ArrayList();

        List parts = new ArrayList();
        parts.add("id1");

        DojoAjaxResponseBuilder builder =  new DojoAjaxResponseBuilder(cycle, rlm, mrs, resp, errorPages, assetFactory, "", pageService);

        PrintWriter pw = newPrintWriter();

        rlm.persistLocale();
        expect(cycle.getInfrastructure()).andReturn(infra).anyTimes();
        expect(infra.getOutputEncoding()).andReturn(("UTF-8")).anyTimes();
        expect(cycle.getParameters("updateParts")).andReturn((String[])parts.toArray(new String[parts.size()]));
        expect(resp.getPrintWriter(isA(ContentType.class))).andReturn(pw);
        expect(mrs.newMarkupWriter(eq(pw), isA(ContentType.class))).andReturn(writer);

        expect(cycle.getPage()).andReturn(page);
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();
        builder.beginBodyScript(mw, cycle);
View Full Code Here

    }

    public void testSuccessfulInfrastructureLookup()
    {
        MockControl ifrControl = newControl(Infrastructure.class);
        Infrastructure ifr = (Infrastructure) ifrControl.getMock();

        ResetEventCoordinator coord = (ResetEventCoordinator) newMock(ResetEventCoordinator.class);

        ifr.getResetEventCoordinator();
        ifrControl.setReturnValue(coord);

        replayControls();

        InfrastructureObjectProvider p = new InfrastructureObjectProvider();
View Full Code Here

        }
    }

    private void setupServices()
    {
        Infrastructure infra = _registry
                .getService("tapestry.Infrastructure", Infrastructure.class);
        infra.setMode(_infrastructureMode);

        ComponentClassResolver resolver = _registry.getService(
                "tapestry.ComponentClassResolver",
                ComponentClassResolver.class);
View Full Code Here

        InfrastructureManager manager = newInfrastructureManager();
        ServiceLocator locator = newServiceLocator();

        replay();

        Infrastructure infra = new InfrastructureImpl(manager);

        // Do not assume that infra and provider are the same;
        // that's an implementation choice.

        ObjectProvider provider = infra.getObjectProvider();

        try
        {
            provider.provide("expression", Runnable.class, locator);
            unreachable();
View Full Code Here

        train_getContributionsForMode(manager, "papyrus", configuration);

        replay();

        Infrastructure infra = new InfrastructureImpl(manager);

        infra.setMode("papyrus");

        // Do not assume that infra and provider are the same;
        // that's an implementation choice.

        ObjectProvider provider = infra.getObjectProvider();

        Runnable actual = provider.provide("myrunnable", Runnable.class, locator);

        assertSame(actual, r);
View Full Code Here

        train_getContributionsForMode(manager, "clay", configuration);

        replay();

        Infrastructure infra = new InfrastructureImpl(manager);

        infra.setMode("clay");

        // Do not assume that infra and provider are the same;
        // that's an implementation choice.

        ObjectProvider provider = infra.getObjectProvider();

        Runnable actual1 = provider.provide("myrunnable", Runnable.class, locator);
        Runnable actual2 = provider.provide("myrunnable", Runnable.class, locator);

        assertSame(actual1, r);
View Full Code Here

        train_getContributionsForMode(manager, "clay", configuration);

        replay();

        Infrastructure infra = new InfrastructureImpl(manager);

        infra.setMode("clay");

        ObjectProvider provider = infra.getObjectProvider();

        try
        {
            provider.provide("someexpression", Runnable.class, locator);
            unreachable();
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.