use of org.apache.tomcat.util.descriptor.web.WebXml in project tomcat by apache.
the class TestContextConfigAnnotation method testNoMapping.
@Test
public void testNoMapping() throws Exception {
WebXml webxml = new WebXml();
Map<String, JavaClassCacheEntry> javaClassCache = new HashMap<>();
ContextConfig config = new ContextConfig();
File pFile = paramClassResource("org/apache/catalina/startup/NoMappingParamServlet");
assertTrue(pFile.exists());
config.processAnnotationsFile(pFile, webxml, false, javaClassCache);
ServletDef servletDef = webxml.getServlets().get("param1");
assertNull(servletDef);
webxml.addServletMapping("/param", "param1");
config.processAnnotationsFile(pFile, webxml, false, javaClassCache);
servletDef = webxml.getServlets().get("param1");
assertNull(servletDef);
}
use of org.apache.tomcat.util.descriptor.web.WebXml in project tomcat by apache.
the class TestContextConfigAnnotation method testDuplicateFilterMapping.
@Test
public void testDuplicateFilterMapping() throws Exception {
WebXml webxml = new WebXml();
Map<String, JavaClassCacheEntry> javaClassCache = new HashMap<>();
ContextConfig config = new ContextConfig();
File pFile = paramClassResource("org/apache/catalina/startup/DuplicateMappingParamFilter");
assertTrue(pFile.exists());
try {
config.processAnnotationsFile(pFile, webxml, false, javaClassCache);
fail();
} catch (IllegalArgumentException ex) {
// ignore
}
FilterDef filterDef = webxml.getFilters().get("paramD");
assertNull(filterDef);
}
Aggregations