Search in sources :

Example 6 with JspPropertyGroupDescriptor

use of jakarta.servlet.descriptor.JspPropertyGroupDescriptor 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

JspPropertyGroupDescriptor (jakarta.servlet.descriptor.JspPropertyGroupDescriptor)6 JspConfigDescriptor (jakarta.servlet.descriptor.JspConfigDescriptor)5 Test (org.junit.Test)4 TaglibDescriptor (jakarta.servlet.descriptor.TaglibDescriptor)3 ArrayList (java.util.ArrayList)3 ServletContext (jakarta.servlet.ServletContext)1 File (java.io.File)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Tomcat (org.apache.catalina.startup.Tomcat)1 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)1