Search in sources :

Example 6 with JspConfigDescriptor

use of javax.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(4, context.getEffectiveMajorVersion());
    Assert.assertEquals(0, context.getEffectiveMinorVersion());
    JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
    Assert.assertTrue(jspConfigDescriptor.getTaglibs().isEmpty());
    Collection<JspPropertyGroupDescriptor> propertyGroups = jspConfigDescriptor.getJspPropertyGroups();
    Assert.assertEquals(4, 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(javax.servlet.descriptor.JspConfigDescriptor) File(java.io.File) JspPropertyGroupDescriptor(javax.servlet.descriptor.JspPropertyGroupDescriptor) Test(org.junit.Test)

Aggregations

JspConfigDescriptor (javax.servlet.descriptor.JspConfigDescriptor)6 JspPropertyGroupDescriptor (javax.servlet.descriptor.JspPropertyGroupDescriptor)5 Test (org.junit.Test)4 TaglibDescriptor (javax.servlet.descriptor.TaglibDescriptor)3 ArrayList (java.util.ArrayList)2 File (java.io.File)1 URL (java.net.URL)1 ServletContext (javax.servlet.ServletContext)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