Skip to content

Commit

Permalink
fix: remove smells
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed Nov 3, 2021
1 parent fbf9241 commit 953b80d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static okhttp3.TlsVersion.TLS_1_2;

public class VerticalPodAutoscalerMockServer extends KubernetesMockServer {
private boolean disableApiGroupCheck = true;

public VerticalPodAutoscalerMockServer() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@

import io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher;
import io.fabric8.mockwebserver.Context;
import io.fabric8.mockwebserver.ServerRequest;
import io.fabric8.mockwebserver.ServerResponse;
import io.fabric8.mockwebserver.dsl.MockServerExpectation;
import io.fabric8.verticalpodautoscaler.client.VerticalPodAutoscalerClient;
import okhttp3.mockwebserver.MockWebServer;
import org.junit.rules.ExternalResource;

import java.util.HashMap;
import java.util.Queue;

public class VerticalPodAutoscalerServer extends ExternalResource {

protected VerticalPodAutoscalerMockServer mock;
private VerticalPodAutoscalerClient client;

private boolean https;
private final boolean https;
// In this mode the mock web server will store, read, update and delete
// kubernetes resources using an in memory map and will appear as a real api
// server.
private boolean crudMode;
private final boolean crudMode;

public VerticalPodAutoscalerServer() {
this(true, false);
Expand All @@ -51,14 +48,16 @@ public VerticalPodAutoscalerServer(boolean https, boolean crudMode) {
this.crudMode = crudMode;
}

@Override
public void before() {
mock = crudMode
? new VerticalPodAutoscalerMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), true)
? new VerticalPodAutoscalerMockServer(new Context(), new MockWebServer(), new HashMap<>(), new KubernetesCrudDispatcher(), true)
: new VerticalPodAutoscalerMockServer(https);
mock.init();
client = mock.createVerticalPodAutoscaler();
}

@Override
public void after() {
mock.destroy();
client.close();
Expand Down

0 comments on commit 953b80d

Please sign in to comment.