org.apache.tapestry.junit.parse
Class TestTemplateParser

java.lang.Object
  extended by BaseComponentTestCase
      extended by org.apache.tapestry.junit.parse.TestTemplateParser

public class TestTemplateParser
extends BaseComponentTestCase

Tests for the Tapestry HTML template parser.

Author:
Howard Lewis Ship

Constructor Summary
TestTemplateParser()
           
 
Method Summary
protected  void assertCloseToken(TemplateToken token, int line)
           
protected  void assertLocalizationToken(TemplateToken token, String key, Map attributes, int line)
           
protected  void assertOpenToken(TemplateToken token, String id, String tag, int line)
           
protected  void assertOpenToken(TemplateToken token, String id, String componentType, String tag, int line)
           
protected  void assertTemplateAttributes(TemplateToken token, Map expected)
           
protected  void assertText(TextToken token, int offset, int length)
           
protected  void assertTextToken(TemplateToken token, int startIndex, int endIndex)
           
protected  void assertTokenCount(TemplateToken[] tokens, int count)
           
protected  void checkLine(TemplateToken token, int line)
           
protected  TemplateToken[] run(char[] templateData, ITemplateParserDelegate delegate, org.apache.hivemind.Resource location)
           
protected  TemplateToken[] run(InputStream stream, ITemplateParserDelegate delegate, org.apache.hivemind.Resource location)
           
protected  TemplateToken[] run(String file)
           
protected  TemplateToken[] run(String file, ITemplateParserDelegate delegate)
           
 void test_Basic_Localization()
           
 void test_Empty_Localization()
          Test that the abbreviated form (a tag with no body) works.
 void testAllStatic()
           
 void testBasicContent()
           
 void testBasicRemove()
           
 void testBodyRemove()
           
 void testComplex()
           
 void testComponentInsideLocalization()
          Test that the parser fails if a localization block contains a component.
 void testDuplicateTagAttributeFailure()
           
 void testDuplicateTagAttributeFailureSingleQuotes()
           
 void testEncodedExpressionCharacters()
          Test for encoded characters in an expression.
 void testIgnoredContentFailure()
           
 void testImplicitComponents()
          Tests for implicit components (both named and anonymous).
 void testIncompleteCloseFailure()
           
 void testInvalidDynamicNestingFailure()
           
 void testLocalizationAttributes()
          Test attributes in the span.
 void testMismatchedCloseTagsFailure()
           
 void testMissingAttributeValueFailure()
           
 void testMixedNesting()
           
 void testNamespaceAttributeName()
          Like testOverrideDefaultAttributeName(), but uses a more complicated attribute name (with a XML-style namespace prefix).
 void testNestedLocalizations()
          Test that the parser fails if an invisible localization is nested within another invisible localization.
 void testNestedRemoveFailure()
           
 void testOverrideDefaultAttributeName()
          Test ability to use a different attribute name than the default ("jwcid").
 void testRemovedComponentFailure()
           
 void testSimpleNested()
           
 void testSingleEmptyTag()
           
 void testSingleQuotes()
           
 void testSlashInComponentType()
           
 void testStartWithStaticTag()
           
 void testStringAttributes()
          Test ability to read string attributes.
 void testTagAttributes()
           
 void testUnclosedOpenTagFailure()
           
 void testUnknownComponentIdFailure()
           
 void testUnterminatedCommentFailure()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestTemplateParser

public TestTemplateParser()
Method Detail

run

protected TemplateToken[] run(char[] templateData,
                              ITemplateParserDelegate delegate,
                              org.apache.hivemind.Resource location)
                       throws TemplateParseException
Throws:
TemplateParseException

run

protected TemplateToken[] run(InputStream stream,
                              ITemplateParserDelegate delegate,
                              org.apache.hivemind.Resource location)
                       throws TemplateParseException
Throws:
TemplateParseException

run

protected TemplateToken[] run(String file)
                       throws TemplateParseException
Throws:
TemplateParseException

run

protected TemplateToken[] run(String file,
                              ITemplateParserDelegate delegate)
                       throws TemplateParseException
Throws:
TemplateParseException

assertTextToken

protected void assertTextToken(TemplateToken token,
                               int startIndex,
                               int endIndex)

assertText

protected void assertText(TextToken token,
                          int offset,
                          int length)

checkLine

protected void checkLine(TemplateToken token,
                         int line)
Since:
3.0 *

assertLocalizationToken

protected void assertLocalizationToken(TemplateToken token,
                                       String key,
                                       Map attributes,
                                       int line)
Since:
2.0.4 *

assertOpenToken

protected void assertOpenToken(TemplateToken token,
                               String id,
                               String tag,
                               int line)

assertOpenToken

protected void assertOpenToken(TemplateToken token,
                               String id,
                               String componentType,
                               String tag,
                               int line)

assertTemplateAttributes

protected void assertTemplateAttributes(TemplateToken token,
                                        Map expected)

assertCloseToken

protected void assertCloseToken(TemplateToken token,
                                int line)

assertTokenCount

protected void assertTokenCount(TemplateToken[] tokens,
                                int count)

testAllStatic

public void testAllStatic()
                   throws TemplateParseException
Throws:
TemplateParseException

testSingleEmptyTag

public void testSingleEmptyTag()
                        throws TemplateParseException
Throws:
TemplateParseException

testSimpleNested

public void testSimpleNested()
                      throws TemplateParseException
Throws:
TemplateParseException

testMixedNesting

public void testMixedNesting()
                      throws TemplateParseException
Throws:
TemplateParseException

testSingleQuotes

public void testSingleQuotes()
                      throws TemplateParseException
Throws:
TemplateParseException

testComplex

public void testComplex()
                 throws TemplateParseException
Throws:
TemplateParseException

testStartWithStaticTag

public void testStartWithStaticTag()
                            throws TemplateParseException
Throws:
TemplateParseException

testUnterminatedCommentFailure

public void testUnterminatedCommentFailure()

testUnclosedOpenTagFailure

public void testUnclosedOpenTagFailure()

testMissingAttributeValueFailure

public void testMissingAttributeValueFailure()

testIncompleteCloseFailure

public void testIncompleteCloseFailure()

testMismatchedCloseTagsFailure

public void testMismatchedCloseTagsFailure()

testInvalidDynamicNestingFailure

public void testInvalidDynamicNestingFailure()

testUnknownComponentIdFailure

public void testUnknownComponentIdFailure()

testBasicRemove

public void testBasicRemove()
                     throws TemplateParseException
Throws:
TemplateParseException

testBodyRemove

public void testBodyRemove()
                    throws TemplateParseException
Throws:
TemplateParseException

testRemovedComponentFailure

public void testRemovedComponentFailure()

testNestedRemoveFailure

public void testNestedRemoveFailure()

testBasicContent

public void testBasicContent()
                      throws TemplateParseException
Throws:
TemplateParseException

testIgnoredContentFailure

public void testIgnoredContentFailure()

testTagAttributes

public void testTagAttributes()
                       throws TemplateParseException
Throws:
TemplateParseException

test_Basic_Localization

public void test_Basic_Localization()
                             throws TemplateParseException
Throws:
TemplateParseException
Since:
2.0.4

testComponentInsideLocalization

public void testComponentInsideLocalization()
Test that the parser fails if a localization block contains a component.

Since:
2.0.4

testNestedLocalizations

public void testNestedLocalizations()
Test that the parser fails if an invisible localization is nested within another invisible localization.

Since:
2.0.4

test_Empty_Localization

public void test_Empty_Localization()
                             throws TemplateParseException
Test that the abbreviated form (a tag with no body) works.

Throws:
TemplateParseException
Since:
2.0.4

testLocalizationAttributes

public void testLocalizationAttributes()
                                throws TemplateParseException
Test attributes in the span. Also, checks that the parser caselessly identifies the "key" attribute and the tag name ("span").

Throws:
TemplateParseException
Since:
2.0.4

testImplicitComponents

public void testImplicitComponents()
                            throws TemplateParseException
Tests for implicit components (both named and anonymous).

Throws:
TemplateParseException
Since:
3.0

testEncodedExpressionCharacters

public void testEncodedExpressionCharacters()
                                     throws TemplateParseException
Test for encoded characters in an expression.

Throws:
TemplateParseException
Since:
3.0

testStringAttributes

public void testStringAttributes()
                          throws TemplateParseException
Test ability to read string attributes.

Throws:
TemplateParseException

testOverrideDefaultAttributeName

public void testOverrideDefaultAttributeName()
                                      throws Exception
Test ability to use a different attribute name than the default ("jwcid").

Throws:
Exception
Since:
4.0

testNamespaceAttributeName

public void testNamespaceAttributeName()
                                throws Exception
Like testOverrideDefaultAttributeName(), but uses a more complicated attribute name (with a XML-style namespace prefix).

Throws:
Exception

testDuplicateTagAttributeFailure

public void testDuplicateTagAttributeFailure()
Since:
4.0

testDuplicateTagAttributeFailureSingleQuotes

public void testDuplicateTagAttributeFailureSingleQuotes()
Since:
4.0

testSlashInComponentType

public void testSlashInComponentType()
                              throws Exception
Throws:
Exception
Since:
4.0


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.