Skip to content

Commit

Permalink
Add test to ensure that HttpServerRequestWrapper and VertxWrapper can…
Browse files Browse the repository at this point in the history
… be extended without declaring any method of the wrapper's interfaces.
  • Loading branch information
vietj committed Oct 31, 2023
1 parent 689a76f commit 446a85a
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 200 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ default long setPeriodic(long delay, Handler<Long> handler) {
*/
@Deprecated
default TimeoutStream periodicStream(long delay) {
return periodicStream(0, delay);
return periodicStream(0L, delay);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public String absoluteURI() {

@Override
public SocketAddress remoteAddress() {
return conn.remoteAddress();
return super.remoteAddress();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedExceptio

@Override
public SocketAddress remoteAddress() {
return stream.conn.remoteAddress();
return super.remoteAddress();
}

@Override
Expand Down
106 changes: 1 addition & 105 deletions src/main/java/io/vertx/core/http/impl/HttpServerRequestWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ public HttpMethod method() {
}

@Override
public boolean isSSL() {
return delegate.isSSL();
}

@Override
@Nullable
public String scheme() {
return delegate.scheme();
}
Expand All @@ -110,19 +104,17 @@ public String uri() {
}

@Override
@Nullable
public String path() {
return delegate.path();
}

@Override
@Nullable
public String query() {
return delegate.query();
}

@Override
public @Nullable HostAndPort authority() {
public HostAndPort authority() {
return delegate.authority();
}

Expand All @@ -137,31 +129,16 @@ public long bytesRead() {
}

@Override
@CacheReturn
public HttpServerResponse response() {
return delegate.response();
}

@Override
@CacheReturn
public MultiMap headers() {
return delegate.headers();
}

@Override
@Nullable
public String getHeader(String headerName) {
return delegate.getHeader(headerName);
}

@Override
@GenIgnore(GenIgnore.PERMITTED_TYPE)
public String getHeader(CharSequence headerName) {
return delegate.getHeader(headerName);
}

@Override
@Fluent
public HttpServerRequest setParamsCharset(String charset) {
return delegate.setParamsCharset(charset);
}
Expand All @@ -172,40 +149,10 @@ public String getParamsCharset() {
}

@Override
@CacheReturn
public MultiMap params() {
return delegate.params();
}

@Override
@Nullable
public String getParam(String paramName) {
return delegate.getParam(paramName);
}

@Override
public String getParam(String paramName, String defaultValue) {
return delegate.getParam(paramName, defaultValue);
}

@Override
@CacheReturn
public SocketAddress remoteAddress() {
return delegate.remoteAddress();
}

@Override
@CacheReturn
public SocketAddress localAddress() {
return delegate.localAddress();
}

@Override
@GenIgnore(GenIgnore.PERMITTED_TYPE)
public SSLSession sslSession() {
return delegate.sslSession();
}

@Override
@GenIgnore
public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException {
Expand All @@ -217,37 +164,16 @@ public String absoluteURI() {
return delegate.absoluteURI();
}

@Override
@Fluent
public HttpServerRequest bodyHandler(@Nullable Handler<Buffer> bodyHandler) {
return delegate.bodyHandler(bodyHandler);
}

@Override
public HttpServerRequest body(Handler<AsyncResult<Buffer>> handler) {
return delegate.body(handler);
}

@Override
public Future<Buffer> body() {
return delegate.body();
}

@Override
public void end(Handler<AsyncResult<Void>> handler) {
delegate.end(handler);
}

@Override
public Future<Void> end() {
return delegate.end();
}

@Override
public void toNetSocket(Handler<AsyncResult<NetSocket>> handler) {
delegate.toNetSocket(handler);
}

@Override
public Future<NetSocket> toNetSocket() {
return delegate.toNetSocket();
Expand Down Expand Up @@ -288,11 +214,6 @@ public int streamId() {
return delegate.streamId();
}

@Override
public void toWebSocket(Handler<AsyncResult<ServerWebSocket>> handler) {
delegate.toWebSocket(handler);
}

@Override
public Future<ServerWebSocket> toWebSocket() {
return delegate.toWebSocket();
Expand Down Expand Up @@ -342,17 +263,6 @@ public DecoderResult decoderResult() {
return delegate.getCookie(name, domain, path);
}

@Override
public int cookieCount() {
return delegate.cookieCount();
}

@Override
@Deprecated
public Map<String, Cookie> cookieMap() {
return delegate.cookieMap();
}

@Override
public Set<Cookie> cookies(String name) {
return delegate.cookies(name);
Expand All @@ -379,18 +289,4 @@ public Object metric() {
return delegate.metric();
}

@Override
public Pipe<Buffer> pipe() {
return delegate.pipe();
}

@Override
public Future<Void> pipeTo(WriteStream<Buffer> dst) {
return delegate.pipeTo(dst);
}

@Override
public void pipeTo(WriteStream<Buffer> dst, Handler<AsyncResult<Void>> handler) {
delegate.pipeTo(dst, handler);
}
}
Loading

0 comments on commit 446a85a

Please sign in to comment.