use of com.github.tomakehurst.wiremock.core.WireMockApp in project wiremock by wiremock.
the class WireMockWebContextListener method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
boolean verboseLoggingEnabled = Boolean.parseBoolean(firstNonNull(context.getInitParameter("verboseLoggingEnabled"), "true"));
WireMockApp wireMockApp = new WireMockApp(new WarConfiguration(context), new NotImplementedContainer());
context.setAttribute(APP_CONTEXT_KEY, wireMockApp);
context.setAttribute(StubRequestHandler.class.getName(), wireMockApp.buildStubRequestHandler());
context.setAttribute(AdminRequestHandler.class.getName(), wireMockApp.buildAdminRequestHandler());
context.setAttribute(Notifier.KEY, new Slf4jNotifier(verboseLoggingEnabled));
}
use of com.github.tomakehurst.wiremock.core.WireMockApp in project styx by ExpediaGroup.
the class MockOriginServer method create.
public static MockOriginServer create(String appId, String originId, int adminPort, HttpConnectorConfig httpConfig) {
WireMockApp wireMockApp = wireMockApp();
InetServer adminServer = createAdminServer(originId, adminPort, wireMockApp);
InetServer mockServer = HttpServers.createHttpServer("mock-stub-" + originId, httpConfig, mockHandler(originId, wireMockApp, new WireMockConfiguration()));
int serverPort = httpConfig.port();
return new MockOriginServer(appId, originId, adminPort, serverPort, adminServer, mockServer);
}
use of com.github.tomakehurst.wiremock.core.WireMockApp in project styx by ExpediaGroup.
the class MockOriginServer method create.
public static MockOriginServer create(String appId, String originId, int adminPort, HttpsConnectorConfig httpsConfig) {
WireMockApp wireMockApp = wireMockApp();
InetServer adminServer = createAdminServer(originId, adminPort, wireMockApp);
InetServer mockServer = HttpServers.createHttpsServer("mock-stub-" + originId, httpsConfig, mockHandler(originId, wireMockApp, new WireMockConfiguration()));
int serverPort = httpsConfig.port();
return new MockOriginServer(appId, originId, adminPort, serverPort, adminServer, mockServer);
}
Aggregations