use of javax.servlet.ServletConfig 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;
}
});
}
use of javax.servlet.ServletConfig 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;
}
});
}
use of javax.servlet.ServletConfig 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);
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class AtmosphereInterceptorTest 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;
}
});
config = framework.getAtmosphereConfig();
processor = new AsynchronousProcessor(config) {
@Override
public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {
return action(req, res);
}
};
}
use of javax.servlet.ServletConfig in project atmosphere by Atmosphere.
the class AtmosphereInterceptorTest method configureTest.
@Test
public void configureTest() throws ServletException, IOException {
final AtomicInteger count = new AtomicInteger();
framework = new AtmosphereFramework();
framework.setAsyncSupport(mock(AsyncSupport.class));
framework.interceptor(new AtmosphereInterceptor() {
@Override
public void configure(AtmosphereConfig config) {
count.incrementAndGet();
}
@Override
public Action inspect(AtmosphereResource r) {
return Action.CREATED;
}
@Override
public void destroy() {
}
@Override
public void postInspect(AtmosphereResource r) {
}
});
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;
}
});
config = framework.getAtmosphereConfig();
processor = new AsynchronousProcessor(config) {
@Override
public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {
return action(req, res);
}
};
framework.addAtmosphereHandler("/*", handler);
assertEquals(Action.CREATED, processor.service(mock(AtmosphereRequestImpl.class), AtmosphereResponseImpl.newInstance()));
assertEquals(1, count.get());
}
Aggregations