Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix: fix httpjson executor #1448

Merged
merged 1 commit into from Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -153,7 +153,7 @@ public static class Builder {
private Builder() {}

public Builder setExecutor(Executor executor) {
this.executor = Preconditions.checkNotNull(executor);
this.executor = executor == null ? DEFAULT_EXECUTOR : executor;
return this;
}

Expand Down
Expand Up @@ -62,6 +62,13 @@ public void basicTest() throws IOException {
provider = provider.withEndpoint(endpoint);
assertThat(provider.needsEndpoint()).isFalse();

assertThat(provider.needsHeaders()).isTrue();
provider = provider.withHeaders(Collections.<String, String>emptyMap());
assertThat(provider.needsHeaders()).isFalse();

// Make sure getTransportChannel works without setting executor
assertThat(provider.getTransportChannel()).isInstanceOf(HttpJsonTransportChannel.class);

assertThat(provider.needsExecutor()).isTrue();
provider = provider.withExecutor((Executor) executor);
assertThat(provider.needsExecutor()).isFalse();
Expand All @@ -71,10 +78,6 @@ public void basicTest() throws IOException {
provider = provider.withExecutor(executor);
assertThat(provider.needsExecutor()).isFalse();

assertThat(provider.needsHeaders()).isTrue();
provider = provider.withHeaders(Collections.<String, String>emptyMap());
assertThat(provider.needsHeaders()).isFalse();

assertThat(provider.acceptsPoolSize()).isFalse();
Exception thrownException = null;
try {
Expand Down