DefaultWebApplication implements WebApplication { @Override public void setSecurityManager(SecurityManager securityManager) { this.securityManager = securityManager; } DefaultWebApplication(); @Override FilterRegistration.Dynamic addFilter(String filterName, Class<? extends Filter> filterClass); @Override FilterRegistration.Dynamic addFilter(String filterName, String className); @Override FilterRegistration.Dynamic addFilter(String filterName, Filter filter); @Override Set<String> addFilterMapping(Set<DispatcherType> dispatcherTypes, String filterName, boolean isMatchAfter, String... urlPatterns); @Override void addInitializer(String className); @Override void addInitializer(ServletContainerInitializer servletContainerInitializer); @Override ServletRegistration.Dynamic addJspFile(String servletName, String jspFile); @SuppressWarnings("unchecked") @Override void addListener(String className); @Override void addListener(Class<? extends EventListener> type); @Override void addListener(T listener); @Override void addResource(Resource resource); @Override Dynamic addServlet(String servletName, Class<? extends Servlet> servletClass); @Override Dynamic addServlet(String servletName, String className); @Override Dynamic addServlet(String servletName, Servlet servlet); @Override Set<String> addServletMapping(String servletName, String... urlPatterns); @Override void addErrorPage(int code, String location); @Override void addErrorPage(String exception, String location); @Override T createFilter(Class<T> filterClass); @Override T createListener(Class<T> clazz); @Override T createServlet(Class<T> servletClass); @Override void declareRoles(String... roles); @Override void destroy(); @Override Object getAttribute(String name); @Override Enumeration<String> getAttributeNames(); @Override boolean getDenyUncoveredHttpMethods(); @Override ClassLoader getClassLoader(); @Override ServletContext getContext(String uripath); @Override String getContextPath(); @Override Set<SessionTrackingMode> getDefaultSessionTrackingModes(); @Override Servlet getDefaultServlet(); @Override ObjectInstanceManager getObjectInstanceManager(); @Override int getEffectiveMajorVersion(); @Override int getEffectiveMinorVersion(); @Override void setEffectiveMajorVersion(int effectiveMajorVersion); @Override void setEffectiveMinorVersion(int effectiveMinorVersion); @Override MultiPartManager getMultiPartManager(); @Override Set<SessionTrackingMode> getEffectiveSessionTrackingModes(); @Override FilterRegistration getFilterRegistration(String filterName); @Override Map<String, ? extends FilterRegistration> getFilterRegistrations(); @Override String getInitParameter(String name); @Override Enumeration<String> getInitParameterNames(); @Override List<ServletContainerInitializer> getInitializers(); @Override JspConfigDescriptor getJspConfigDescriptor(); @Override int getMajorVersion(); @Override Collection<String> getMappings(String servletName); @Override String getMimeType(String filename); @Override MimeTypeManager getMimeTypeManager(); @Override int getMinorVersion(); @Override String getRealPath(String path); @Override ServletRequest getRequest(ServletResponse response); @Override String getRequestCharacterEncoding(); @Override String getResponseCharacterEncoding(); @Override URL getResource(String location); @Override InputStream getResourceAsStream(String location); @Override Set<String> getResourcePaths(String path); @Override ServletResponse getResponse(ServletRequest request); @Override SecurityManager getSecurityManager(); @Override AnnotationManager getAnnotationManager(); @Override void setAnnotationManager(AnnotationManager annotationManager); @Override String getServerInfo(); @Deprecated @Override Servlet getServlet(String name); @Override String getServletContextName(); @Deprecated @Override Enumeration<String> getServletNames(); @Override ServletRegistration getServletRegistration(String servletName); @Override Map<String, ? extends ServletRegistration> getServletRegistrations(); @Deprecated @Override Enumeration<Servlet> getServlets(); @Override SessionCookieConfig getSessionCookieConfig(); @Override int getSessionTimeout(); @Override HttpSessionManager getHttpSessionManager(); @Override String getVirtualServerName(); @Override WelcomeFileManager getWelcomeFileManager(); @Override void initialize(); @Override void initializeDeclaredFinish(); @Override void initializeFinish(); @Override void initializeFilters(); @Override void initializeInitializers(); @Override void initializeServlets(); @Override boolean isDistributable(); @Override boolean isInitialized(); @Override void linkRequestAndResponse(ServletRequest request, ServletResponse response); @Deprecated @Override void log(Exception exception, String message); @Override void log(String message, Throwable throwable); @Override void log(String message); @Override void removeAttribute(String name); @Override void service(ServletRequest request, ServletResponse response); @Override void setAttribute(String name, Object value); @Override void setClassLoader(ClassLoader classLoader); @Override void setContextPath(String contextPath); @Override void setDefaultServlet(Servlet defaultServlet); @Override void setDenyUncoveredHttpMethods(boolean denyUncoveredHttpMethods); @Override void setDistributable(boolean distributable); @Override void setHttpSessionManager(HttpSessionManager httpSessionManager); @Override HttpRequestManager getHttpRequestManager(); @Override void setHttpRequestManager(HttpRequestManager httpRequestManager); @Override boolean setInitParameter(String name, String value); @Override void setJspManager(JspManager jspManager); @Override void setLoggingManager(LoggingManager loggingManager); @Override void setMimeTypeManager(MimeTypeManager mimeTypeManager); @Override void setMultiPartManager(MultiPartManager multiPartManager); @Override void setObjectInstanceManager(ObjectInstanceManager objectInstanceManager); @Override void setRequestCharacterEncoding(String requestCharacterEncoding); @Override void setResourceManager(ResourceManager resourceManager); @Override void setResponseCharacterEncoding(String responseCharacterEncoding); @Override void setSecurityManager(SecurityManager securityManager); @Override void setServletContextName(String servletContextName); @Override void setSessionTrackingModes(Set<SessionTrackingMode> sessionTrackingModes); @Override void setSessionTimeout(int sessionTimeout); void setVirtualServerName(String virtualServerName); @Override void setWebApplicationRequestMapper(WebApplicationRequestMapper webApplicationRequestMapper); @Override void setWelcomeFileManager(WelcomeFileManager welcomeFileManager); @Override void start(); @Override void stop(); @Override void unlinkRequestAndResponse(ServletRequest request, ServletResponse response); @Override LocaleEncodingManager getLocaleEncodingManager(); @Override void setLocaleEncodingManager(LocaleEncodingManager localeEncodingManager); @Override DefaultServletRequestDispatcher getRequestDispatcher(String path); @Override RequestDispatcher getNamedDispatcher(String name); @Override AsyncManager getAsyncManager();  }
@Test void testLogin() throws Exception { DefaultSecurityManager securityManager = new DefaultSecurityManager(); DefaultWebApplication webApp = new DefaultWebApplication(); webApp.setSecurityManager(securityManager); TestWebApplicationRequest request = new TestWebApplicationRequest(); request.setWebApplication(webApp); try { request.login("admin", "password"); } catch (ServletException exception) { } }
@Test void testLogout() throws Exception { DefaultSecurityManager securityManager = new DefaultSecurityManager(); DefaultWebApplication webApp = new DefaultWebApplication(); webApp.setSecurityManager(securityManager); TestWebApplicationRequest request = new TestWebApplicationRequest(); request.setWebApplication(webApp); try { request.logout(); } catch (ServletException exception) { } }