Package mondrian.tui

Class MockServletContext

java.lang.Object
mondrian.tui.MockServletContext
All Implemented Interfaces:
jakarta.servlet.ServletContext

public class MockServletContext extends Object implements jakarta.servlet.ServletContext
Partial implementation of the ServletContext where just enough is present to allow for communication between Mondrian's XMLA code and other code in the same JVM.

Currently it is used in both the CmdRunner and in XMLA JUnit tests. If you need to add to this implementation, please do so.

Author:
Richard M. Emberson
  • Field Details

  • Constructor Details

    • MockServletContext

      public MockServletContext()
  • Method Details

    • getContextPath

      public String getContextPath()
      Specified by:
      getContextPath in interface jakarta.servlet.ServletContext
    • getContext

      public jakarta.servlet.ServletContext getContext(String s)
      Returns a ServletContext object that corresponds to a specified URL on the server.
      Specified by:
      getContext in interface jakarta.servlet.ServletContext
    • getMajorVersion

      public int getMajorVersion()
      Returns the major version of the Java Servlet API that this servlet container supports.
      Specified by:
      getMajorVersion in interface jakarta.servlet.ServletContext
    • getMinorVersion

      public int getMinorVersion()
      Returns the minor version of the Servlet API that this servlet container supports.
      Specified by:
      getMinorVersion in interface jakarta.servlet.ServletContext
    • getEffectiveMajorVersion

      public int getEffectiveMajorVersion()
      Specified by:
      getEffectiveMajorVersion in interface jakarta.servlet.ServletContext
    • getEffectiveMinorVersion

      public int getEffectiveMinorVersion()
      Specified by:
      getEffectiveMinorVersion in interface jakarta.servlet.ServletContext
    • getMimeType

      public String getMimeType(String s)
      Returns the MIME type of the specified file, or null if the MIME type is not known.
      Specified by:
      getMimeType in interface jakarta.servlet.ServletContext
    • getResourcePaths

      public Set getResourcePaths(String s)
      Specified by:
      getResourcePaths in interface jakarta.servlet.ServletContext
    • getResource

      public URL getResource(String name) throws MalformedURLException
      Returns a URL to the resource that is mapped to a specified path.
      Specified by:
      getResource in interface jakarta.servlet.ServletContext
      Throws:
      MalformedURLException
    • getResourceAsStream

      public InputStream getResourceAsStream(String s)
      Returns the resource located at the named path as an InputStream object.
      Specified by:
      getResourceAsStream in interface jakarta.servlet.ServletContext
    • getRequestDispatcher

      public jakarta.servlet.RequestDispatcher getRequestDispatcher(String s)
      Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path.
      Specified by:
      getRequestDispatcher in interface jakarta.servlet.ServletContext
    • getNamedDispatcher

      public jakarta.servlet.RequestDispatcher getNamedDispatcher(String s)
      Returns a RequestDispatcher object that acts as a wrapper for the named servlet.
      Specified by:
      getNamedDispatcher in interface jakarta.servlet.ServletContext
    • getServlet

      public jakarta.servlet.Servlet getServlet(String s) throws jakarta.servlet.ServletException
      Throws:
      jakarta.servlet.ServletException
    • getServlets

      public Enumeration getServlets()
    • getServletNames

      public Enumeration getServletNames()
    • log

      public void log(String s)
      Writes the specified message to a servlet log file, usually an event log.
      Specified by:
      log in interface jakarta.servlet.ServletContext
    • log

      public void log(Exception exception, String s)
      Deprecated.
      Method log is deprecated
      Deprecated. As of Java Servlet API 2.1, use log(String message, Throwable throwable) instead. This method was originally defined to write an exception's stack trace and an explanatory error message to the servlet log file.
    • log

      public void log(String s, Throwable throwable)
      Writes an explanatory message and a stack trace for a given Throwable exception to the servlet log file.
      Specified by:
      log in interface jakarta.servlet.ServletContext
    • getRealPath

      public String getRealPath(String path)
      Returns a String containing the real path for a given virtual path.
      Specified by:
      getRealPath in interface jakarta.servlet.ServletContext
    • getServerInfo

      public String getServerInfo()
      Returns the name and version of the servlet container on which the servlet is running.
      Specified by:
      getServerInfo in interface jakarta.servlet.ServletContext
    • getInitParameter

      public String getInitParameter(String name)
      Returns a String containing the value of the named context-wide initialization parameter, or null if the parameter does not exist.
      Specified by:
      getInitParameter in interface jakarta.servlet.ServletContext
    • getInitParameterNames

      public Enumeration getInitParameterNames()
      Returns the names of the context's initialization parameters as an Enumeration of String objects, or an empty Enumeration if the context has no initialization parameters.
      Specified by:
      getInitParameterNames in interface jakarta.servlet.ServletContext
    • setInitParameter

      public boolean setInitParameter(String s, String s1)
      Specified by:
      setInitParameter in interface jakarta.servlet.ServletContext
    • getAttribute

      public Object getAttribute(String s)
      Specified by:
      getAttribute in interface jakarta.servlet.ServletContext
    • getAttributeNames

      public Enumeration getAttributeNames()
      Returns an Enumeration containing the attribute names available within this servlet context.
      Specified by:
      getAttributeNames in interface jakarta.servlet.ServletContext
    • setAttribute

      public void setAttribute(String s, Object obj)
      Binds an object to a given attribute name in this servlet context.
      Specified by:
      setAttribute in interface jakarta.servlet.ServletContext
    • removeAttribute

      public void removeAttribute(String s)
      Removes the attribute with the given name from the servlet context.
      Specified by:
      removeAttribute in interface jakarta.servlet.ServletContext
    • getServletContextName

      public String getServletContextName()
      Specified by:
      getServletContextName in interface jakarta.servlet.ServletContext
    • addServlet

      public jakarta.servlet.ServletRegistration.Dynamic addServlet(String s, String s1)
      Specified by:
      addServlet in interface jakarta.servlet.ServletContext
    • addServlet

      public jakarta.servlet.ServletRegistration.Dynamic addServlet(String s, jakarta.servlet.Servlet servlet)
      Specified by:
      addServlet in interface jakarta.servlet.ServletContext
    • addServlet

      public jakarta.servlet.ServletRegistration.Dynamic addServlet(String s, Class<? extends jakarta.servlet.Servlet> aClass)
      Specified by:
      addServlet in interface jakarta.servlet.ServletContext
    • addJspFile

      public jakarta.servlet.ServletRegistration.Dynamic addJspFile(String s, String s1)
      Specified by:
      addJspFile in interface jakarta.servlet.ServletContext
    • createServlet

      public <T extends jakarta.servlet.Servlet> T createServlet(Class<T> aClass) throws jakarta.servlet.ServletException
      Specified by:
      createServlet in interface jakarta.servlet.ServletContext
      Throws:
      jakarta.servlet.ServletException
    • getServletRegistration

      public jakarta.servlet.ServletRegistration getServletRegistration(String s)
      Specified by:
      getServletRegistration in interface jakarta.servlet.ServletContext
    • getServletRegistrations

      public Map<String,? extends jakarta.servlet.ServletRegistration> getServletRegistrations()
      Specified by:
      getServletRegistrations in interface jakarta.servlet.ServletContext
    • addFilter

      public jakarta.servlet.FilterRegistration.Dynamic addFilter(String s, String s1)
      Specified by:
      addFilter in interface jakarta.servlet.ServletContext
    • addFilter

      public jakarta.servlet.FilterRegistration.Dynamic addFilter(String s, jakarta.servlet.Filter filter)
      Specified by:
      addFilter in interface jakarta.servlet.ServletContext
    • addFilter

      public jakarta.servlet.FilterRegistration.Dynamic addFilter(String s, Class<? extends jakarta.servlet.Filter> aClass)
      Specified by:
      addFilter in interface jakarta.servlet.ServletContext
    • createFilter

      public <T extends jakarta.servlet.Filter> T createFilter(Class<T> aClass) throws jakarta.servlet.ServletException
      Specified by:
      createFilter in interface jakarta.servlet.ServletContext
      Throws:
      jakarta.servlet.ServletException
    • getFilterRegistration

      public jakarta.servlet.FilterRegistration getFilterRegistration(String s)
      Specified by:
      getFilterRegistration in interface jakarta.servlet.ServletContext
    • getFilterRegistrations

      public Map<String,? extends jakarta.servlet.FilterRegistration> getFilterRegistrations()
      Specified by:
      getFilterRegistrations in interface jakarta.servlet.ServletContext
    • getSessionCookieConfig

      public jakarta.servlet.SessionCookieConfig getSessionCookieConfig()
      Specified by:
      getSessionCookieConfig in interface jakarta.servlet.ServletContext
    • setSessionTrackingModes

      public void setSessionTrackingModes(Set<jakarta.servlet.SessionTrackingMode> set)
      Specified by:
      setSessionTrackingModes in interface jakarta.servlet.ServletContext
    • getDefaultSessionTrackingModes

      public Set<jakarta.servlet.SessionTrackingMode> getDefaultSessionTrackingModes()
      Specified by:
      getDefaultSessionTrackingModes in interface jakarta.servlet.ServletContext
    • getEffectiveSessionTrackingModes

      public Set<jakarta.servlet.SessionTrackingMode> getEffectiveSessionTrackingModes()
      Specified by:
      getEffectiveSessionTrackingModes in interface jakarta.servlet.ServletContext
    • addListener

      public void addListener(String s)
      Specified by:
      addListener in interface jakarta.servlet.ServletContext
    • addListener

      public <T extends EventListener> void addListener(T t)
      Specified by:
      addListener in interface jakarta.servlet.ServletContext
    • addListener

      public void addListener(Class<? extends EventListener> aClass)
      Specified by:
      addListener in interface jakarta.servlet.ServletContext
    • createListener

      public <T extends EventListener> T createListener(Class<T> aClass) throws jakarta.servlet.ServletException
      Specified by:
      createListener in interface jakarta.servlet.ServletContext
      Throws:
      jakarta.servlet.ServletException
    • getJspConfigDescriptor

      public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
      Specified by:
      getJspConfigDescriptor in interface jakarta.servlet.ServletContext
    • getClassLoader

      public ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface jakarta.servlet.ServletContext
    • declareRoles

      public void declareRoles(String... strings)
      Specified by:
      declareRoles in interface jakarta.servlet.ServletContext
    • getVirtualServerName

      public String getVirtualServerName()
      Specified by:
      getVirtualServerName in interface jakarta.servlet.ServletContext
    • getSessionTimeout

      public int getSessionTimeout()
      Specified by:
      getSessionTimeout in interface jakarta.servlet.ServletContext
    • setSessionTimeout

      public void setSessionTimeout(int i)
      Specified by:
      setSessionTimeout in interface jakarta.servlet.ServletContext
    • getRequestCharacterEncoding

      public String getRequestCharacterEncoding()
      Specified by:
      getRequestCharacterEncoding in interface jakarta.servlet.ServletContext
    • setRequestCharacterEncoding

      public void setRequestCharacterEncoding(String s)
      Specified by:
      setRequestCharacterEncoding in interface jakarta.servlet.ServletContext
    • getResponseCharacterEncoding

      public String getResponseCharacterEncoding()
      Specified by:
      getResponseCharacterEncoding in interface jakarta.servlet.ServletContext
    • setResponseCharacterEncoding

      public void setResponseCharacterEncoding(String s)
      Specified by:
      setResponseCharacterEncoding in interface jakarta.servlet.ServletContext
    • setMajorVersion

      public void setMajorVersion(int majorVersion)
    • setMinorVersion

      public void setMinorVersion(int minorVersion)
    • addResource

      public void addResource(String name, URL url)
    • addInitParameter

      public void addInitParameter(String name, String value)