Search in sources :

Example 6 with JspConfigDescriptor

use of jakarta.servlet.descriptor.JspConfigDescriptor in project tomcat by apache.

the class TestJspCServletContext method testWebapp.

@Test
public void testWebapp() throws Exception {
    File appDir = new File("test/webapp");
    JspCServletContext context = new JspCServletContext(null, appDir.toURI().toURL(), null, false, false);
    Assert.assertEquals(6, context.getEffectiveMajorVersion());
    Assert.assertEquals(0, context.getEffectiveMinorVersion());
    JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
    Assert.assertTrue(jspConfigDescriptor.getTaglibs().isEmpty());
    Collection<JspPropertyGroupDescriptor> propertyGroups = jspConfigDescriptor.getJspPropertyGroups();
    Assert.assertEquals(6, propertyGroups.size());
    Iterator<JspPropertyGroupDescriptor> groupIterator = propertyGroups.iterator();
    JspPropertyGroupDescriptor groupDescriptor;
    groupDescriptor = groupIterator.next();
    Assert.assertEquals("text/plain", groupDescriptor.getDefaultContentType());
    Collection<String> urlPatterns = groupDescriptor.getUrlPatterns();
    Assert.assertEquals(2, urlPatterns.size());
    Iterator<String> iterator = urlPatterns.iterator();
    Assert.assertEquals("/bug49nnn/bug49726a.jsp", iterator.next());
    Assert.assertEquals("/bug49nnn/bug49726b.jsp", iterator.next());
    groupDescriptor = groupIterator.next();
    Assert.assertEquals(2, groupDescriptor.getIncludePreludes().size());
    Assert.assertEquals(2, groupDescriptor.getIncludeCodas().size());
}
Also used : JspConfigDescriptor(jakarta.servlet.descriptor.JspConfigDescriptor) File(java.io.File) JspPropertyGroupDescriptor(jakarta.servlet.descriptor.JspPropertyGroupDescriptor) Test(org.junit.Test)

Aggregations

JspConfigDescriptor (jakarta.servlet.descriptor.JspConfigDescriptor)6 JspPropertyGroupDescriptor (jakarta.servlet.descriptor.JspPropertyGroupDescriptor)5 Test (org.junit.Test)4 TaglibDescriptor (jakarta.servlet.descriptor.TaglibDescriptor)3 ArrayList (java.util.ArrayList)2 ServletContext (jakarta.servlet.ServletContext)1 File (java.io.File)1 URL (java.net.URL)1 Tomcat (org.apache.catalina.startup.Tomcat)1 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)1 TaglibXml (org.apache.tomcat.util.descriptor.tld.TaglibXml)1 TldResourcePath (org.apache.tomcat.util.descriptor.tld.TldResourcePath)1