org.evosuite.runtime.javaee.javax.servlet.EvoServletContext Maven / Gradle / Ivy
/**
* Copyright (C) 2010-2016 Gordon Fraser, Andrea Arcuri and EvoSuite
* contributors
*
* This file is part of EvoSuite.
*
* EvoSuite is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3.0 of the License, or
* (at your option) any later version.
*
* EvoSuite is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with EvoSuite. If not, see .
*/
package org.evosuite.runtime.javaee.javax.servlet;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.evosuite.runtime.javaee.TestDataJavaEE;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.EventListener;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.FilterRegistration.Dynamic;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
import javax.servlet.descriptor.JspConfigDescriptor;
@EvoSuiteClassExclude
public class EvoServletContext implements ServletContext{
private final Map dispatchers;
public EvoServletContext(){
dispatchers = new ConcurrentHashMap<>();
}
//------------ EvoSuite test methods -----------------
public void createDispatcher(String name){
if(name==null || name.trim().isEmpty()){
return; //do nothing
}
RequestDispatcher dis = new EvoRequestDispatcher(name);
dispatchers.put(name,dis);
TestDataJavaEE.getInstance().accessedDispatcher(name);
}
//------------ overriden methods --------------------
@Override
public RequestDispatcher getRequestDispatcher(String arg0) {
return dispatchers.get(arg0);
}
@Override
public Dynamic addFilter(String arg0, String arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public Dynamic addFilter(String arg0, Filter arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public Dynamic addFilter(String arg0, Class extends Filter> arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public void addListener(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void addListener(T arg0) {
// TODO Auto-generated method stub
}
@Override
public void addListener(Class extends EventListener> arg0) {
// TODO Auto-generated method stub
}
@Override
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
String arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
Servlet arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
Class extends Servlet> arg1) {
// TODO Auto-generated method stub
return null;
}
@Override
public T createFilter(Class arg0)
throws ServletException {
// TODO Auto-generated method stub
return null;
}
@Override
public T createListener(Class arg0)
throws ServletException {
// TODO Auto-generated method stub
return null;
}
@Override
public T createServlet(Class arg0)
throws ServletException {
// TODO Auto-generated method stub
return null;
}
@Override
public void declareRoles(String... arg0) {
// TODO Auto-generated method stub
}
@Override
public Object getAttribute(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Enumeration getAttributeNames() {
// TODO Auto-generated method stub
return null;
}
@Override
public ClassLoader getClassLoader() {
// TODO Auto-generated method stub
return null;
}
@Override
public ServletContext getContext(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getContextPath() {
// TODO Auto-generated method stub
return null;
}
@Override
public Set getDefaultSessionTrackingModes() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getEffectiveMajorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getEffectiveMinorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Set getEffectiveSessionTrackingModes() {
// TODO Auto-generated method stub
return null;
}
@Override
public FilterRegistration getFilterRegistration(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Map getFilterRegistrations() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getInitParameter(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Enumeration getInitParameterNames() {
// TODO Auto-generated method stub
return null;
}
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
// TODO Auto-generated method stub
return null;
}
@Override
public int getMajorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public String getMimeType(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public int getMinorVersion() {
// TODO Auto-generated method stub
return 0;
}
@Override
public RequestDispatcher getNamedDispatcher(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getRealPath(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public URL getResource(String arg0) throws MalformedURLException {
// TODO Auto-generated method stub
return null;
}
@Override
public InputStream getResourceAsStream(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Set getResourcePaths(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getServerInfo() {
// TODO Auto-generated method stub
return null;
}
@Override
public Servlet getServlet(String arg0) throws ServletException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getServletContextName() {
// TODO Auto-generated method stub
return null;
}
@Override
public Enumeration getServletNames() {
// TODO Auto-generated method stub
return null;
}
@Override
public ServletRegistration getServletRegistration(String arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Map getServletRegistrations() {
// TODO Auto-generated method stub
return null;
}
@Override
public Enumeration getServlets() {
// TODO Auto-generated method stub
return null;
}
@Override
public SessionCookieConfig getSessionCookieConfig() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getVirtualServerName() {
// TODO Auto-generated method stub
return null;
}
@Override
public void log(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void log(Exception arg0, String arg1) {
// TODO Auto-generated method stub
}
@Override
public void log(String arg0, Throwable arg1) {
// TODO Auto-generated method stub
}
@Override
public void removeAttribute(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void setAttribute(String arg0, Object arg1) {
// TODO Auto-generated method stub
}
@Override
public boolean setInitParameter(String arg0, String arg1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void setSessionTrackingModes(Set arg0) {
// TODO Auto-generated method stub
}
}