Fix formatting

This commit is contained in:
Tyler Benson 2019-07-10 14:18:54 -06:00
parent 53ef8f020f
commit e692605a3b
2 changed files with 63 additions and 59 deletions

View File

@ -13,7 +13,7 @@ class VertxRxWebClientTest extends HttpClientTest<NettyHttpClientDecorator> {
@Shared @Shared
Vertx vertx = Vertx.vertx(new VertxOptions()) Vertx vertx = Vertx.vertx(new VertxOptions())
@Shared @Shared
WebClient client = WebClient.create(vertx); WebClient client = WebClient.create(vertx)
@Override @Override
int doRequest(String method, URI uri, Map<String, String> headers, Closure callback) { int doRequest(String method, URI uri, Map<String, String> headers, Closure callback) {

View File

@ -44,17 +44,20 @@ public class VertxRxWebTestServer extends AbstractVerticle {
@Override @Override
public void start(final Future<Void> startFuture) { public void start(final Future<Void> startFuture) {
// final io.vertx.reactivex.core.Vertx vertx = new io.vertx.reactivex.core.Vertx(this.vertx); // final io.vertx.reactivex.core.Vertx vertx = new io.vertx.reactivex.core.Vertx(this.vertx);
final WebClient client = WebClient.create(vertx); final WebClient client = WebClient.create(vertx);
final int port = config().getInteger(CONFIG_HTTP_SERVER_PORT); final int port = config().getInteger(CONFIG_HTTP_SERVER_PORT);
final Router router = Router.router(vertx); final Router router = Router.router(vertx);
final CircuitBreaker breaker = CircuitBreaker.create("my-circuit-breaker", vertx, final CircuitBreaker breaker =
CircuitBreaker.create(
"my-circuit-breaker",
vertx,
new CircuitBreakerOptions() new CircuitBreakerOptions()
.setMaxFailures(5) // number of failure before opening the circuit .setMaxFailures(5) // number of failure before opening the circuit
.setTimeout(2000) // consider a failure if the operation does not succeed in time .setTimeout(2000) // consider a failure if the operation does not succeed in time
// .setFallbackOnFailure(true) // do we call the fallback on failure // .setFallbackOnFailure(true) // do we call the fallback on failure
.setResetTimeout(10000) // time spent in open state before attempting to re-try .setResetTimeout(10000) // time spent in open state before attempting to re-try
); );
@ -76,8 +79,10 @@ public class VertxRxWebTestServer extends AbstractVerticle {
routingContext -> { routingContext -> {
breaker.execute( breaker.execute(
ctx -> { ctx -> {
client.get(port, "localhost", "/test") client
.rxSendBuffer(Optional.ofNullable(routingContext.getBody()).orElse(Buffer.buffer())) .get(port, "localhost", "/test")
.rxSendBuffer(
Optional.ofNullable(routingContext.getBody()).orElse(Buffer.buffer()))
.subscribe( .subscribe(
response -> { response -> {
routingContext routingContext
@ -107,6 +112,5 @@ public class VertxRxWebTestServer extends AbstractVerticle {
} }
@Trace @Trace
private void tracedMethod() { private void tracedMethod() {}
}
} }