use of org.springframework.mock.web.MockServletConfig in project druid by alibaba.
the class StatViewServletTest_resetEnable method test_resetEnable_error.
public void test_resetEnable_error() throws Exception {
Assert.assertTrue(DruidStatService.getInstance().isResetEnable());
MockServletConfig servletConfig = new MockServletConfig();
servletConfig.addInitParameter(StatViewServlet.PARAM_NAME_RESET_ENABLE, "xxx");
StatViewServlet servlet = new StatViewServlet();
servlet.init(servletConfig);
Assert.assertFalse(DruidStatService.getInstance().isResetEnable());
}
use of org.springframework.mock.web.MockServletConfig in project druid by alibaba.
the class StatViewServletTest_resetEnable method test_resetEnable_none.
public void test_resetEnable_none() throws Exception {
Assert.assertTrue(DruidStatService.getInstance().isResetEnable());
MockServletConfig servletConfig = new MockServletConfig();
StatViewServlet servlet = new StatViewServlet();
servlet.init(servletConfig);
Assert.assertTrue(DruidStatService.getInstance().isResetEnable());
}
use of org.springframework.mock.web.MockServletConfig in project druid by alibaba.
the class StatViewServletTest_resetEnable method test_resetEnable_false.
public void test_resetEnable_false() throws Exception {
Assert.assertTrue(DruidStatService.getInstance().isResetEnable());
MockServletConfig servletConfig = new MockServletConfig();
servletConfig.addInitParameter(StatViewServlet.PARAM_NAME_RESET_ENABLE, "false");
StatViewServlet servlet = new StatViewServlet();
servlet.init(servletConfig);
Assert.assertFalse(DruidStatService.getInstance().isResetEnable());
}
use of org.springframework.mock.web.MockServletConfig in project pinpoint by naver.
the class SpringWebMvcIT method testRequest.
@Test
public void testRequest() throws Exception {
MockServletConfig config = new MockServletConfig();
MockHttpServletRequest req = new MockHttpServletRequest();
MockHttpServletResponse res = new MockHttpServletResponse();
config.addInitParameter("contextConfigLocation", "classpath:spring-web-test.xml");
req.setMethod("GET");
req.setRequestURI("/");
req.setRemoteAddr("1.2.3.4");
DispatcherServlet servlet = new DispatcherServlet();
servlet.init(config);
servlet.service(req, res);
Method method = FrameworkServlet.class.getDeclaredMethod("doGet", HttpServletRequest.class, HttpServletResponse.class);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(Expectations.event(SPRING_MVC, method));
verifier.verifyTraceCount(0);
}
use of org.springframework.mock.web.MockServletConfig in project spring-security by spring-projects.
the class AbstractSecurityWebSocketMessageBrokerConfigurerDocTests method loadConfig.
private void loadConfig(Class<?>... configs) {
context = new AnnotationConfigWebApplicationContext();
context.register(configs);
context.register(WebSocketConfig.class, SyncExecutorConfig.class);
context.setServletConfig(new MockServletConfig());
context.refresh();
}
Aggregations