Skip to content

Commit

Permalink
refactor: minor refinements to the MockWebServer
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Sep 25, 2023
1 parent 007abfa commit 0e54a28
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 66 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.fabric8.mockwebserver.Context;
import io.fabric8.mockwebserver.MockServerException;
import io.fabric8.mockwebserver.dsl.Emitable;
import io.fabric8.mockwebserver.dsl.EventDoneable;
import io.fabric8.mockwebserver.dsl.Function;
import io.fabric8.mockwebserver.dsl.TimesOrOnceable;
import io.fabric8.mockwebserver.dsl.WebSocketSessionBuilder;

Expand All @@ -31,17 +29,16 @@
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.function.Function;

public class InlineWebSocketSessionBuilder<T> implements WebSocketSessionBuilder<T>, EventDoneable<T> {

private static final ObjectMapper MAPPER = new ObjectMapper();

private final Context context;
private final Function<WebSocketSession, T> function;
private WebSocketSession session;

public InlineWebSocketSessionBuilder(Context context, Function<WebSocketSession, T> function) {
this.context = context;
public InlineWebSocketSessionBuilder(Function<WebSocketSession, T> function) {
this.function = function;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.fabric8.mockwebserver.ServerRequest;
import io.fabric8.mockwebserver.ServerResponse;
import io.fabric8.mockwebserver.dsl.DelayPathable;
import io.fabric8.mockwebserver.dsl.Function;
import io.fabric8.mockwebserver.dsl.HttpMethod;
import io.fabric8.mockwebserver.dsl.MockServerExpectation;
import io.fabric8.mockwebserver.dsl.Pathable;
Expand All @@ -43,6 +42,7 @@
import java.util.Queue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -193,15 +193,15 @@ public Pathable<ReturnOrWebsocketable<TimesOnceableOrHttpHeaderable<Void>>> dela

@Override
public WebSocketSessionBuilder<TimesOnceableOrHttpHeaderable<Void>> andUpgradeToWebSocket() {
return new InlineWebSocketSessionBuilder<>(context, new WebSocketSessionConverter(this));
return new InlineWebSocketSessionBuilder<>(new WebSocketSessionConverter(this));
}

/**
* {@inheritDoc}
*/
@Override
public WebSocketSessionBuilder<TimesOnceableOrHttpHeaderable<Void>> andUpgradeToWebSocket(ScheduledExecutorService executor) {
return new InlineWebSocketSessionBuilder<>(context, new WebSocketSessionConverter(this));
return new InlineWebSocketSessionBuilder<>(new WebSocketSessionConverter(this));
}

@Override
Expand Down

This file was deleted.

0 comments on commit 0e54a28

Please sign in to comment.