Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Aug 5, 2021
1 parent eb009f3 commit 777abc1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
Expand All @@ -24,9 +25,10 @@ public class ProviderDisabledAutodiscoveryTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloResource.class, HelloClient.class, GlobalRequestFilter.class, GlobalResponseFilter.class)
.addClasses(HelloResource.class, HelloClient.class, HelloClient2.class, GlobalRequestFilter.class,
GlobalResponseFilter.class)
.addAsResource(
new StringAsset(setUrlForClass(HelloClient.class)
new StringAsset(setUrlForClass(HelloClient.class) + setUrlForClass(HelloClient2.class)
+ "quarkus.rest-client-reactive.provider-autodiscovery=false"),
"application.properties"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;

Expand All @@ -23,12 +24,13 @@ public class ProviderPriorityTest {
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloResource.class,
HelloClient.class,
HelloClient2.class,
HelloClientWithFilter.class,
ResponseFilterLowestPrio.class,
GlobalResponseFilter.class,
GlobalResponseFilterLowPrio.class)
.addAsResource(
new StringAsset(setUrlForClass(HelloClient.class)
new StringAsset(setUrlForClass(HelloClient.class) + setUrlForClass(HelloClient2.class)
+ setUrlForClass(HelloClientWithFilter.class)),
"application.properties"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
Expand All @@ -25,11 +26,11 @@ public class ProviderTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloResource.class, HelloClient.class, GlobalRequestFilter.class,
.addClasses(HelloResource.class, HelloClient.class, GlobalRequestFilter.class, HelloClient2.class,
GlobalResponseFilter.class, GlobalRequestFilterConstrainedToServer.class,
GlobalFeature.class)
.addAsResource(
new StringAsset(setUrlForClass(HelloClient.class)),
new StringAsset(setUrlForClass(HelloClient.class) + setUrlForClass(HelloClient2.class)),
"application.properties"));

@RestClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ public ClientResponseContextImpl getOrCreateClientResponseContext() {

@Override
protected Executor getContextExecutor() {
if (httpClientRequest != null) {
return ((ConnectionBase) httpClientRequest.connection()).getContext().nettyEventLoop();
}
if (Context.isOnEventLoopThread()) {
return ((ContextInternal) restClient.getVertx().getOrCreateContext()).nettyEventLoop();
}
if (httpClientRequest != null) {
return ((ConnectionBase) httpClientRequest.connection()).getContext().nettyEventLoop();
}
return null;
}

Expand Down Expand Up @@ -215,22 +215,20 @@ public HttpClientResponse getVertxClientResponse() {

@Override
protected Executor getEventLoop() {
if (httpClientRequest == null) {
// make sure we execute the client callbacks on the same context as the current thread
if (Context.isOnEventLoopThread()) {
Context context = restClient.getVertx().getOrCreateContext();
return new Executor() {
@Override
public void execute(Runnable command) {
context.runOnContext(v -> command.run());
}
};
} else if (httpClientRequest == null) {
//we are on a worker and have no bound event loop
//this should never really happen
return restClient.getVertx().nettyEventLoopGroup().next();
} else {
return new Executor() {
@Override
public void execute(Runnable command) {
command.run();
}
};
return ((ConnectionBase) httpClientRequest.connection()).channel().eventLoop();
}
}

Expand Down

0 comments on commit 777abc1

Please sign in to comment.