use of jakarta.servlet.ServletContext in project atmosphere by Atmosphere.
the class SimpleRestInterceptorTest method setupAtmosphere.
private void setupAtmosphere() throws Exception {
framework = new AtmosphereFramework();
framework.setAsyncSupport(Mockito.mock(AsyncSupport.class));
framework.init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return Mockito.mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
config = framework.getAtmosphereConfig();
}
use of jakarta.servlet.ServletContext in project atmosphere by Atmosphere.
the class MeteorTest 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 jakarta.servlet.ServletContext in project atmosphere by Atmosphere.
the class UrlMappingTest 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 new Action(Action.TYPE.CREATED);
}
};
}
use of jakarta.servlet.ServletContext in project atmosphere by Atmosphere.
the class WebSocketHandlerTest method create.
@BeforeMethod
public void create() throws Throwable {
framework = new AtmosphereFramework();
framework.setAsyncSupport(new BlockingIOCometSupport(framework.getAtmosphereConfig()));
framework.addInitParameter(RECYCLE_ATMOSPHERE_REQUEST_RESPONSE, "false");
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;
}
});
framework.setDefaultBroadcasterClassName(SimpleBroadcaster.class.getName());
}
use of jakarta.servlet.ServletContext in project atmosphere by Atmosphere.
the class AtmosphereFrameworkTest method testAtmosphereFrameworkListener.
@Test
public void testAtmosphereFrameworkListener() throws ServletException {
AtmosphereServlet s = new MyAtmosphereServlet();
final AtomicInteger count = new AtomicInteger();
s.framework().frameworkListener(new AtmosphereFrameworkListener() {
@Override
public void onPreInit(AtmosphereFramework f) {
count.incrementAndGet();
}
@Override
public void onPostInit(AtmosphereFramework f) {
count.incrementAndGet();
}
@Override
public void onPreDestroy(AtmosphereFramework f) {
count.incrementAndGet();
}
@Override
public void onPostDestroy(AtmosphereFramework f) {
count.incrementAndGet();
}
});
s.init(new ServletConfig() {
@Override
public String getServletName() {
return "void";
}
@Override
public ServletContext getServletContext() {
return mock(ServletContext.class);
}
@Override
public String getInitParameter(String name) {
if (ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356.equals(name)) {
return "true";
}
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return null;
}
});
s.destroy();
assertEquals(count.get(), 4);
}
Aggregations