Search in sources :

Example 1 with ConsoleNotifier

use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project zulip-java-client by jamesnetherton.

the class ZulipApiTestBase method beforeAll.

@BeforeAll
public static void beforeAll() throws ZulipClientException {
    server = new WireMockServer(options().dynamicPort().stubRequestLoggingDisabled(false).notifier(new ConsoleNotifier(false)));
    server.start();
    zulip = new Zulip.Builder().email("test@test.com").apiKey("test-key").site("http://localhost:" + server.port()).build();
}
Also used : ConsoleNotifier(com.github.tomakehurst.wiremock.common.ConsoleNotifier) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with ConsoleNotifier

use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project PostExamples by deesebc.

the class FeignRetryableTest method setup.

@BeforeAll
public static void setup() {
    bookClient = Feign.builder().client(new OkHttpClient()).encoder(new GsonEncoder()).decoder(new GsonDecoder()).logger(new Slf4jLogger(BookClient.class)).logLevel(Logger.Level.FULL).retryer(new feign.Retryer.Default(100, 1000, 3)).errorDecoder(new CustomErrorDecode()).options(new Request.Options(2, TimeUnit.SECONDS, 4, TimeUnit.SECONDS, true)).target(BookClient.class, "http://localhost:57005/api/books");
    wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57005).notifier(new ConsoleNotifier(true)));
    wireMockServer.start();
}
Also used : CustomErrorDecode(es.home.example.feignexample.customize.CustomErrorDecode) ConsoleNotifier(com.github.tomakehurst.wiremock.common.ConsoleNotifier) OkHttpClient(feign.okhttp.OkHttpClient) GsonEncoder(feign.gson.GsonEncoder) Slf4jLogger(feign.slf4j.Slf4jLogger) GsonDecoder(feign.gson.GsonDecoder) Request(feign.Request) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with ConsoleNotifier

use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project PostExamples by deesebc.

the class FeignRibbon method setup.

@BeforeAll
public static void setup() {
    // config.properties include: discovery-client.ribbon.listOfServers=localhost:57010,localhost:57011
    bookClient = Feign.builder().client(RibbonClient.create()).decoder(new GsonDecoder()).logger(new Slf4jLogger(BookClient.class)).logLevel(Logger.Level.FULL).target(BookClient.class, "http://discovery-client/api/books");
    wireMockServer1 = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57010).notifier(new ConsoleNotifier(true)));
    wireMockServer1.start();
    wireMockServer1.stubFor(get(urlPathEqualTo("/api/books")).willReturn(aResponse().withBodyFile("books.json")));
    wireMockServer2 = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57011).notifier(new ConsoleNotifier(true)));
    wireMockServer2.start();
    wireMockServer2.stubFor(get(urlPathEqualTo("/api/books")).willReturn(aResponse().withBodyFile("books.json")));
}
Also used : ConsoleNotifier(com.github.tomakehurst.wiremock.common.ConsoleNotifier) Slf4jLogger(feign.slf4j.Slf4jLogger) GsonDecoder(feign.gson.GsonDecoder) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 4 with ConsoleNotifier

use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project PostExamples by deesebc.

the class FeignRibbonTest method setup.

@BeforeAll
public static void setup() {
    // config.properties include: discovery-client.ribbon.listOfServers=localhost:57010,localhost:57011
    // getConfigInstance().setProperty("discovery-client.ribbon.listOfServers", "localhost:57010,localhost:57011");
    bookClient = Feign.builder().client(RibbonClient.create()).encoder(new GsonEncoder()).decoder(new GsonDecoder()).logger(new Slf4jLogger(BookClient.class)).logLevel(Logger.Level.FULL).target(BookClient.class, "http://discovery-client/api/books");
    wireMockServer1 = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57010).notifier(new ConsoleNotifier(true)));
    wireMockServer1.start();
    wireMockServer1.stubFor(get(urlPathEqualTo("/api/books")).willReturn(aResponse().withBodyFile("books.json")));
    wireMockServer2 = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57011).notifier(new ConsoleNotifier(true)));
    wireMockServer2.start();
    wireMockServer2.stubFor(get(urlPathEqualTo("/api/books")).willReturn(aResponse().withBodyFile("books.json")));
}
Also used : ConsoleNotifier(com.github.tomakehurst.wiremock.common.ConsoleNotifier) GsonEncoder(feign.gson.GsonEncoder) Slf4jLogger(feign.slf4j.Slf4jLogger) GsonDecoder(feign.gson.GsonDecoder) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 5 with ConsoleNotifier

use of com.github.tomakehurst.wiremock.common.ConsoleNotifier in project PostExamples by deesebc.

the class FeignTest method setup.

@BeforeAll
public static void setup() {
    bookClient = Feign.builder().client(new OkHttpClient()).encoder(new GsonEncoder()).decoder(new GsonDecoder()).logger(new Slf4jLogger(BookClient.class)).logLevel(Logger.Level.FULL).target(BookClient.class, "http://localhost:57010/api/books");
    wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57010).notifier(// .httpsPort(57005).keystorePath(FOLDER + "/identity.jks")
    new ConsoleNotifier(true)));
    wireMockServer.start();
}
Also used : ConsoleNotifier(com.github.tomakehurst.wiremock.common.ConsoleNotifier) OkHttpClient(feign.okhttp.OkHttpClient) GsonEncoder(feign.gson.GsonEncoder) Slf4jLogger(feign.slf4j.Slf4jLogger) GsonDecoder(feign.gson.GsonDecoder) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ConsoleNotifier (com.github.tomakehurst.wiremock.common.ConsoleNotifier)20 WireMockServer (com.github.tomakehurst.wiremock.WireMockServer)9 BeforeEach (org.junit.jupiter.api.BeforeEach)8 BeforeAll (org.junit.jupiter.api.BeforeAll)7 GsonDecoder (feign.gson.GsonDecoder)5 Slf4jLogger (feign.slf4j.Slf4jLogger)5 GsonEncoder (feign.gson.GsonEncoder)4 OkHttpClient (feign.okhttp.OkHttpClient)3 Test (org.junit.jupiter.api.Test)3 ResponseTemplateTransformer (com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer)2 WireMockResponse (com.github.tomakehurst.wiremock.testsupport.WireMockResponse)2 SystemKeyAuthoriser (com.github.tomakehurst.wiremock.extension.responsetemplating.SystemKeyAuthoriser)1 CustomErrorDecode (es.home.example.feignexample.customize.CustomErrorDecode)1 CustomTokenGeneratorInterceptor (es.home.example.feignexample.customize.CustomTokenGeneratorInterceptor)1 Request (feign.Request)1 Credentials (io.jenkins.tools.pluginmanager.config.Credentials)1 File (java.io.File)1 Server (org.eclipse.jetty.server.Server)1 ServerConnector (org.eclipse.jetty.server.ServerConnector)1 HandlerCollection (org.eclipse.jetty.server.handler.HandlerCollection)1