Search in sources :

Example 41 with ServletContext

use of javax.servlet.ServletContext in project atmosphere by Atmosphere.

the class AtmosphereResourceFactoryTest method create.

@BeforeMethod
public void create() throws Throwable {
    framework = new AtmosphereFramework();
    framework.setAsyncSupport(mock(AsyncSupport.class));
    framework.init(new ServletConfig() {

        @Override
        public String getServletName() {
            return "void";
        }

        @Override
        public ServletContext getServletContext() {
            return mock(ServletContext.class);
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return null;
        }
    });
}
Also used : Enumeration(java.util.Enumeration) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 42 with ServletContext

use of javax.servlet.ServletContext in project atmosphere by Atmosphere.

the class AtmosphereResourceListenerTest method create.

@BeforeMethod
public void create() throws Throwable {
    framework = new AtmosphereFramework();
    framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig()));
    framework.init(new ServletConfig() {

        @Override
        public String getServletName() {
            return "void";
        }

        @Override
        public ServletContext getServletContext() {
            return mock(ServletContext.class);
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return null;
        }
    });
}
Also used : BlockingIOCometSupport(org.atmosphere.container.BlockingIOCometSupport) Enumeration(java.util.Enumeration) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 43 with ServletContext

use of javax.servlet.ServletContext in project atmosphere by Atmosphere.

the class QueryStringTest method create.

@BeforeMethod
public void create() throws Throwable {
    framework = new AtmosphereFramework();
    framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig()));
    framework.init(new ServletConfig() {

        @Override
        public String getServletName() {
            return "void";
        }

        @Override
        public ServletContext getServletContext() {
            return mock(ServletContext.class);
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return null;
        }
    });
}
Also used : BlockingIOCometSupport(org.atmosphere.container.BlockingIOCometSupport) Enumeration(java.util.Enumeration) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 44 with ServletContext

use of javax.servlet.ServletContext in project atmosphere by Atmosphere.

the class TrackMessageSizeInterceptorTest method create.

@BeforeMethod
public void create() throws Throwable {
    framework = new AtmosphereFramework();
    framework.setAsyncSupport(new AsynchronousProcessor(framework.getAtmosphereConfig()) {

        @Override
        public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {
            return action(req, res);
        }
    });
    framework.init(new ServletConfig() {

        @Override
        public String getServletName() {
            return "void";
        }

        @Override
        public ServletContext getServletContext() {
            return mock(ServletContext.class);
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return null;
        }
    });
}
Also used : ServletException(javax.servlet.ServletException) Enumeration(java.util.Enumeration) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) IOException(java.io.IOException) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 45 with ServletContext

use of javax.servlet.ServletContext in project atmosphere by Atmosphere.

the class AtmosphereFrameworkTest method testAtmosphereServlet.

@Test
public void testAtmosphereServlet() throws ServletException {
    AtmosphereServlet s = new MyAtmosphereServlet();
    s.init(new ServletConfig() {

        @Override
        public String getServletName() {
            return "void";
        }

        @Override
        public ServletContext getServletContext() {
            return mock(ServletContext.class);
        }

        @Override
        public String getInitParameter(String name) {
            return null;
        }

        @Override
        public Enumeration<String> getInitParameterNames() {
            return null;
        }
    });
    assertNotNull(s);
}
Also used : Enumeration(java.util.Enumeration) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) Test(org.testng.annotations.Test)

Aggregations

ServletContext (javax.servlet.ServletContext)1111 Test (org.junit.Test)259 HttpServletRequest (javax.servlet.http.HttpServletRequest)186 HttpServletResponse (javax.servlet.http.HttpServletResponse)143 IOException (java.io.IOException)136 ServletException (javax.servlet.ServletException)101 ServletConfig (javax.servlet.ServletConfig)79 File (java.io.File)78 FilterConfig (javax.servlet.FilterConfig)66 HashMap (java.util.HashMap)64 Enumeration (java.util.Enumeration)52 InputStream (java.io.InputStream)51 ArrayList (java.util.ArrayList)50 URL (java.net.URL)48 HttpSession (javax.servlet.http.HttpSession)43 Map (java.util.Map)39 Locale (java.util.Locale)38 List (java.util.List)33 PrintWriter (java.io.PrintWriter)32 LinkedHashMap (java.util.LinkedHashMap)30