Search in sources :

Example 1 with CustomTokenGeneratorInterceptor

use of es.home.example.feignexample.customize.CustomTokenGeneratorInterceptor in project PostExamples by deesebc.

the class FeignInterceptor 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).requestInterceptor(new CustomTokenGeneratorInterceptor("123456", "654321")).target(BookClient.class, "http://localhost:57010/api/books");
    wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig().withRootDirectory(FOLDER).port(57010).notifier(new ConsoleNotifier(true)));
    wireMockServer.start();
}
Also used : CustomTokenGeneratorInterceptor(es.home.example.feignexample.customize.CustomTokenGeneratorInterceptor) 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

WireMockServer (com.github.tomakehurst.wiremock.WireMockServer)1 ConsoleNotifier (com.github.tomakehurst.wiremock.common.ConsoleNotifier)1 CustomTokenGeneratorInterceptor (es.home.example.feignexample.customize.CustomTokenGeneratorInterceptor)1 GsonDecoder (feign.gson.GsonDecoder)1 GsonEncoder (feign.gson.GsonEncoder)1 OkHttpClient (feign.okhttp.OkHttpClient)1 Slf4jLogger (feign.slf4j.Slf4jLogger)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1