use of jakarta.servlet.jsp.tagext.FunctionInfo in project tomcat by apache.
the class TagLibraryInfoImpl method toString.
@Override
public String toString() {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
print("tlibversion", tlibversion, out);
print("jspversion", jspversion, out);
print("shortname", shortname, out);
print("urn", urn, out);
print("info", info, out);
print("uri", uri, out);
print("tagLibraryValidator", "" + tagLibraryValidator, out);
for (TagInfo tag : tags) {
out.println(tag.toString());
}
for (TagFileInfo tagFile : tagFiles) {
out.println(tagFile.toString());
}
for (FunctionInfo function : functions) {
out.println(function.toString());
}
return sw.toString();
}
use of jakarta.servlet.jsp.tagext.FunctionInfo in project tomcat by apache.
the class TestTldParser method testTld.
@Test
public void testTld() throws Exception {
TaglibXml xml = parse("test/tld/test.tld");
Assert.assertEquals("1.0", xml.getTlibVersion());
Assert.assertEquals("2.1", xml.getJspVersion());
Assert.assertEquals("test", xml.getShortName());
Assert.assertEquals("http://tomcat.apache.org/TldTests", xml.getUri());
Assert.assertEquals(1, xml.getFunctions().size());
ValidatorXml validator = xml.getValidator();
Assert.assertEquals("com.example.Validator", validator.getValidatorClass());
Assert.assertEquals(1, validator.getInitParams().size());
Assert.assertEquals("value", validator.getInitParams().get("name"));
Assert.assertEquals(1, xml.getTags().size());
TagXml tag = xml.getTags().get(0);
Assert.assertEquals("org.apache.jasper.compiler.TestValidator$Echo", tag.getTagClass());
Assert.assertEquals("empty", tag.getBodyContent());
Assert.assertTrue(tag.hasDynamicAttributes());
Assert.assertEquals(1, tag.getVariables().size());
TagVariableInfo variableInfo = tag.getVariables().get(0);
Assert.assertEquals("var", variableInfo.getNameGiven());
Assert.assertEquals("java.lang.Object", variableInfo.getClassName());
Assert.assertTrue(variableInfo.getDeclare());
Assert.assertEquals(VariableInfo.AT_END, variableInfo.getScope());
Assert.assertEquals(4, tag.getAttributes().size());
TagAttributeInfo attributeInfo = tag.getAttributes().get(0);
Assert.assertEquals("Echo Tag", tag.getInfo());
Assert.assertEquals("Echo", tag.getDisplayName());
Assert.assertEquals("small", tag.getSmallIcon());
Assert.assertEquals("large", tag.getLargeIcon());
Assert.assertEquals("echo", attributeInfo.getName());
Assert.assertTrue(attributeInfo.isRequired());
Assert.assertTrue(attributeInfo.canBeRequestTime());
attributeInfo = tag.getAttributes().get(1);
Assert.assertEquals("fragment", attributeInfo.getName());
Assert.assertTrue(attributeInfo.isFragment());
Assert.assertTrue(attributeInfo.canBeRequestTime());
Assert.assertEquals("jakarta.servlet.jsp.tagext.JspFragment", attributeInfo.getTypeName());
attributeInfo = tag.getAttributes().get(2);
Assert.assertEquals("deferredValue", attributeInfo.getName());
Assert.assertEquals("jakarta.el.ValueExpression", attributeInfo.getTypeName());
Assert.assertEquals("java.util.Date", attributeInfo.getExpectedTypeName());
attributeInfo = tag.getAttributes().get(3);
Assert.assertEquals("deferredMethod", attributeInfo.getName());
Assert.assertEquals("jakarta.el.MethodExpression", attributeInfo.getTypeName());
Assert.assertEquals("java.util.Date getDate()", attributeInfo.getMethodSignature());
Assert.assertEquals(1, xml.getTagFiles().size());
TagFileXml tagFile = xml.getTagFiles().get(0);
Assert.assertEquals("Echo", tag.getDisplayName());
Assert.assertEquals("small", tag.getSmallIcon());
Assert.assertEquals("large", tag.getLargeIcon());
Assert.assertEquals("Echo2", tagFile.getName());
Assert.assertEquals("/echo.tag", tagFile.getPath());
Assert.assertEquals(1, xml.getFunctions().size());
FunctionInfo fn = xml.getFunctions().get(0);
Assert.assertEquals("trim", fn.getName());
Assert.assertEquals("org.apache.el.TesterFunctions", fn.getFunctionClass());
Assert.assertEquals("java.lang.String trim(java.lang.String)", fn.getFunctionSignature());
}
Aggregations