Package org.apache.tapestry

Examples of org.apache.tapestry.IScript


     * @since 3.0
     */

    public void testUnique() throws Exception
    {
        IScript script = read("unique.script");

        IRequestCycle cycle = new RequestCycle();

        script.execute(cycle, _processor, null);
        script.execute(cycle, _processor, null);

        assertEquals("Block1\nBlock2\nNotUnique\n\n\n\nNotUnique", _processor.getBody().trim());
    }
View Full Code Here


        assertSymbol(symbols, "id3", "form1_field_last_name");
    }

    public void testIncludeScript() throws Exception
    {
        IScript script = execute("include-script.script", null);

        Resource scriptLocation = script.getScriptResource();

        Resource[] expected = new Resource[]
        { scriptLocation.getRelativeResource("first"),
                scriptLocation.getRelativeResource("second"),
                scriptLocation.getRelativeResource("third") };
View Full Code Here

    /**
     * A bunch of quickies to push up the code coverage numbers.
     */
    public void testCheats() throws Exception
    {
        IScript script = execute("simple.script", null);

        ScriptSession session = new ScriptSessionImpl(script.getScriptResource(), null, null,
                createExpressionEvaluator(), null, null);
        assertEquals("ScriptSession[" + script.getScriptResource() + "]", session.toString());
    }
View Full Code Here

        verify();
    }

    public void test_SubmitType_OnClick()
    {
        IScript script = newMock(IScript.class);
        Submit submit = newInstance(Submit.class,
                new Object[] {"submitType", "cancel", "submitScript", script});
       
        IValidationDelegate delegate = newDelegate();
        IForm form = newForm();
View Full Code Here

        verify();
    }
   
    public void test_SubmitType_Script_OnClick()
    {
        IScript script = newMock(IScript.class);
        IForm form = newForm();
        IBinding binding = newMock(IBinding.class);
       
        Submit submit = newInstance(Submit.class,
                new Object[] {"submitType", "cancel",
            "submitScript", script, "form", form});
       
        submit.setBinding("onClick", binding);
       
        IRequestCycle cycle = newCycle();
        IMarkupWriter writer = newWriter();
       
        PageRenderSupport prs = newPageRenderSupport();
        trainGetPageRenderSupport(cycle, prs);
       
        script.execute(eq(submit), eq(cycle), eq(prs), isA(Map.class));
       
        replay();
       
        submit.renderSubmitBindings(writer, cycle);
View Full Code Here

    public void test_Submit_Async()
    {
        List updates = new ArrayList();
        updates.add("bsComponent");
       
        IScript script = newMock(IScript.class);
        IForm form = newForm();
        IBinding binding = newMock(IBinding.class);
       
        IEngineService engine = newEngineService();
        ILink link = newMock(ILink.class);
       
        Submit submit = newInstance(Submit.class,
                                    "submitType", "cancel",
                                    "submitScript", script, "form", form,
                                    "async", true, "updateComponents", updates,
                                    "directService", engine);
       
        submit.setBinding("onClick", binding);
       
        IRequestCycle cycle = newCycle();
        IMarkupWriter writer = newWriter();
       
        expect(engine.getLink(eq(true), isA(DirectServiceParameter.class))).andReturn(link);
        expect(link.getURL()).andReturn("/test/url");
       
        PageRenderSupport prs = newPageRenderSupport();
        trainGetPageRenderSupport(cycle, prs);
       
        script.execute(eq(submit), eq(cycle), eq(prs), isA(Map.class));
       
        replay();
       
        submit.renderSubmitBindings(writer, cycle);
View Full Code Here

        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);
       
        Resource location = new ClasspathResource(new DefaultClassResolver(), scriptPath);
       
        IScript script = _scriptSource.getScript(location);

        // If there's an error, report it against the field (this validator object doesn't
        // have a location).

        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);

        script.execute(field, cycle, pageRenderSupport, finalSymbols);
    }
View Full Code Here

        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);

        Resource location = new ClasspathResource(engine.getClassResolver(), scriptPath);

        IScript script = source.getScript(location);

        // If there's an error, report it against the field (this validator object doesn't
        // have a location).

        PageRenderSupport pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);

        script.execute(cycle, pageRenderSupport, finalSymbols);
    }
View Full Code Here

    public void testRenderNormal()
    {
        IMarkupWriter writer = newBufferWriter();
        IRequestCycle cycle = newCycle();
        IScript script = new ScriptFixture();
        PageRenderSupport support = newPageRenderSupport();

        IForm form = newForm();

        LinkSubmit linkSubmit = (LinkSubmit) newInstance(LinkSubmit.class, new Object[]
View Full Code Here

        event.collection("parsed scripts", _cache.keySet());
    }

    public synchronized IScript getScript(Resource resource)
    {
        IScript result = (IScript) _cache.get(resource);

        if (result != null)
            return result;

        result = parse(resource);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.IScript

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.