use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project wiremock by wiremock.
the class HandlebarsCurrentDateHelperTest method init.
@BeforeEach
public void init() {
helper = new HandlebarsCurrentDateHelper();
transformer = new ResponseTemplateTransformer(true);
LocalNotifier.set(new ConsoleNotifier(true));
}
use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project wiremock by wiremock.
the class HandlebarsRandomValuesHelperTest method init.
@BeforeEach
public void init() {
helper = new HandlebarsRandomValuesHelper();
transformer = new ResponseTemplateTransformer(true);
LocalNotifier.set(new ConsoleNotifier(true));
}
use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project wiremock by wiremock.
the class AltHttpServerFactory method buildHttpServer.
@Override
public HttpServer buildHttpServer(Options options, AdminRequestHandler adminRequestHandler, StubRequestHandler stubRequestHandler) {
final Server jettyServer = new Server(0);
ConsoleNotifier notifier = new ConsoleNotifier(false);
ServletContextHandler adminContext = addAdminContext(jettyServer, adminRequestHandler, notifier);
ServletContextHandler mockServiceContext = addMockServiceContext(jettyServer, stubRequestHandler, options.filesRoot(), notifier);
HandlerCollection handlers = new HandlerCollection();
handlers.setHandlers(new Handler[] { adminContext, mockServiceContext });
jettyServer.setHandler(handlers);
return new HttpServer() {
@Override
public void start() {
try {
jettyServer.start();
} catch (Exception e) {
throwUnchecked(e);
}
}
@Override
public void stop() {
try {
jettyServer.stop();
} catch (Exception e) {
throwUnchecked(e);
}
}
@Override
public boolean isRunning() {
return jettyServer.isRunning();
}
@Override
public int port() {
return ((ServerConnector) jettyServer.getConnectors()[0]).getLocalPort();
}
@Override
public int httpsPort() {
return 0;
}
};
}
use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project wiremock by wiremock.
the class PostServeActionExtensionTest method canBeSpecifiedAsAJsonObject.
@Test
public void canBeSpecifiedAsAJsonObject() {
initWithOptions(options().dynamicPort().notifier(new ConsoleNotifier(true)).extensions(new NamedCounterAction()));
WireMockResponse response = client.postJson("/__admin/mappings", "{\n" + " \"request\" : {\n" + " \"urlPath\" : \"/count-me\",\n" + " \"method\" : \"GET\"\n" + " },\n" + " \"response\" : {\n" + " \"status\" : 200\n" + " },\n" + " \"postServeActions\": {\n" + " \"count-request\": {\n" + " \"counterName\": \"things\"\n" + " } \n" + " }\n" + "}");
assertThat(response.content(), response.statusCode(), is(201));
client.get("/count-me");
client.get("/count-me");
await().atMost(5, SECONDS).until(getContent("/__admin/named-counter/things"), is("2"));
}
use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project wiremock by wiremock.
the class PostServeActionExtensionTest method multipleActionsOfTheSameNameCanBeSpecifiedViaTheDSL.
@Test
public void multipleActionsOfTheSameNameCanBeSpecifiedViaTheDSL() {
initWithOptions(options().dynamicPort().notifier(new ConsoleNotifier(true)).extensions(new NamedCounterAction()));
wm.stubFor(get(urlPathEqualTo("/count-me")).willReturn(ok()).withPostServeAction("count-request", counterNameParameter().withName("one")).withPostServeAction("count-request", counterNameParameter().withName("two")));
client.get("/count-me");
client.get("/count-me");
client.get("/count-me");
await().atMost(5, SECONDS).until(getContent("/__admin/named-counter/one"), is("3"));
await().atMost(5, SECONDS).until(getContent("/__admin/named-counter/two"), is("3"));
}
Aggregations