Package org.apache.cactus.extension.jsp

Examples of org.apache.cactus.extension.jsp.JspTagLifecycle


     */
    public void testOutTagDefaultAttribute()
        throws JspException, IOException
    {
        OutTag tag = new OutTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setValue(null);
        tag.setDefault("Default");
        lifecycle.expectBodySkipped();
        lifecycle.invoke();
    }
View Full Code Here


     */
    public void testOutTagDefaultAttributeIgnored()
        throws JspException, IOException
    {
        OutTag tag = new OutTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setValue("Value");
        tag.setDefault("Default");
        lifecycle.expectBodySkipped();
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testOutTagDefaultBody()
        throws JspException, IOException
    {
        OutTag tag = new OutTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setValue(null);
        lifecycle.addNestedText("Default");
        lifecycle.expectBodyEvaluated();
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testOutTagDefaultBodyIgnored()
        throws JspException, IOException
    {
        OutTag tag = new OutTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setValue("Value");
        lifecycle.addNestedText("Default");
        lifecycle.expectBodySkipped();
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testSetTag()
        throws JspException, IOException
    {
        SetTag tag = new SetTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setVar("Var");
        tag.setValue("Value");
        lifecycle.invoke();
        assertEquals("Value", pageContext.findAttribute("Var"));
    }
View Full Code Here

     */
    public void testForEachTag()
        throws JspException, IOException
    {
        ForEachTag tag = new ForEachTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setVar("Item");
        tag.setItems("One,Two,Three");
        lifecycle.expectBodyEvaluated(3);
        lifecycle.expectScopedVariableExposed(
            "Item", new Object[] {"One", "Two", "Three"});
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testForEachTagStatus()
        throws JspException, IOException
    {
        ForEachTag tag = new ForEachTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setVarStatus("status");
        tag.setBegin("0");
        tag.setEnd("2");
        lifecycle.expectBodyEvaluated(3);
        lifecycle.addInterceptor(new JspTagLifecycle.Interceptor()
        {
            public void evalBody(int theIteration, BodyContent theBody)
            {
                LoopTagStatus status = (LoopTagStatus)
                    pageContext.findAttribute("status");
                assertNotNull(status);
                if (theIteration == 0)
                {
                    assertEquals(0, status.getIndex());
                    assertEquals(1, status.getCount());
                    assertTrue(status.isFirst());
                    assertTrue(!status.isLast());
                }
                else if (theIteration == 1)
                {
                    assertEquals(1, status.getIndex());
                    assertEquals(2, status.getCount());
                    assertTrue(!status.isFirst());
                    assertTrue(!status.isLast());
                }
                else if (theIteration == 2)
                {
                    assertEquals(2, status.getIndex());
                    assertEquals(3, status.getCount());
                    assertTrue(!status.isFirst());
                    assertTrue(status.isLast());
                }
            }
        });
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testIfTagTrue()
        throws JspException, IOException
    {
        IfTag tag = new IfTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setTest("true");
        lifecycle.addNestedText("Value");
        lifecycle.expectBodyEvaluated();
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testIfTagFalse()
        throws JspException, IOException
    {
        IfTag tag = new IfTag();
        JspTagLifecycle lifecycle = new JspTagLifecycle(pageContext, tag);
        tag.setTest("false");
        lifecycle.addNestedText("Value");
        lifecycle.expectBodySkipped();
        lifecycle.invoke();
    }
View Full Code Here

     */
    public void testWhenTag()
        throws JspException, IOException
    {
        ChooseTag chooseTag = new ChooseTag();
        JspTagLifecycle chooseLifecycle =
            new JspTagLifecycle(pageContext, chooseTag);
       
        WhenTag whenTag = new WhenTag();
        JspTagLifecycle whenLifecycle =
            chooseLifecycle.addNestedTag(whenTag);
        whenTag.setTest("true");
        whenLifecycle.expectBodyEvaluated();
       
        chooseLifecycle.invoke();
    }
View Full Code Here

TOP

Related Classes of org.apache.cactus.extension.jsp.JspTagLifecycle

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.