Search in sources :

Example 1 with EnableKubernetesMockClient

use of io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient in project kubernetes-client by fabric8io.

the class KubernetesMockServerExtension method initializeKubernetesClientAndMockServer.

protected void initializeKubernetesClientAndMockServer(Class<?> testClass) {
    EnableKubernetesMockClient a = testClass.getAnnotation(EnableKubernetesMockClient.class);
    final Map<ServerRequest, Queue<ServerResponse>> responses = new HashMap<>();
    mock = a.crud() ? new KubernetesMockServer(new Context(), new MockWebServer(), responses, new KubernetesMixedDispatcher(responses), a.https()) : new KubernetesMockServer(a.https());
    mock.init();
    mock.setAdaptableOverride(this::extensionMatches);
    client = mock.createClient();
    this.extensions = a.extensions();
}
Also used : Context(io.fabric8.mockwebserver.Context) ExtensionContext(org.junit.jupiter.api.extension.ExtensionContext) HashMap(java.util.HashMap) MockWebServer(okhttp3.mockwebserver.MockWebServer) ServerRequest(io.fabric8.mockwebserver.ServerRequest) Queue(java.util.Queue)

Aggregations

Context (io.fabric8.mockwebserver.Context)1 ServerRequest (io.fabric8.mockwebserver.ServerRequest)1 HashMap (java.util.HashMap)1 Queue (java.util.Queue)1 MockWebServer (okhttp3.mockwebserver.MockWebServer)1 ExtensionContext (org.junit.jupiter.api.extension.ExtensionContext)1