Skip to content

Commit

Permalink
[RESTEASY-3298] Updates required for the io.projectreactor upgrade.
Browse files Browse the repository at this point in the history
https://issues.redhat.com/browse/RESTEASY-3298
Signed-off-by: James R. Perkins <jperkins@redhat.com>
  • Loading branch information
jamezp committed Mar 10, 2023
1 parent a1b4e38 commit bcfa451
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 24 deletions.
Expand Up @@ -166,8 +166,8 @@ public void testSubscriberContext() {
.flatMap(
resp1 -> getFn.get()
.flatMap(resp2 -> getFn.get().map(resp3 -> String.join("-", Arrays.asList(resp1, resp2, resp3)))
.subscriberContext(Context.of(ctxKey, 24))))
.subscriberContext(ctx -> ctx.put(ctxKey, 42));
.contextWrite(Context.of(ctxKey, 24))))
.contextWrite(ctx -> ctx.put(ctxKey, 42));

assertThat(mono.block(), equalTo("got it-got it-got it"));
assertThat(secrets, equalTo(Arrays.asList(42, 42, 24)));
Expand Down
13 changes: 13 additions & 0 deletions server-adapters/resteasy-reactor-netty/pom.xml
Expand Up @@ -127,6 +127,19 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<reactor.logging.fallback>JDK</reactor.logging.fallback>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>i18n</id>
Expand Down
Expand Up @@ -4,6 +4,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.List;
Expand Down Expand Up @@ -325,6 +326,51 @@ public String uri() {
public HttpVersion version() {
return null;
}

@Override
public HttpServerResponse trailerHeaders(final Consumer<? super HttpHeaders> trailerHeaders) {
return null;
}

@Override
public SocketAddress hostAddress() {
return null;
}

@Override
public SocketAddress connectionHostAddress() {
return null;
}

@Override
public SocketAddress remoteAddress() {
return null;
}

@Override
public SocketAddress connectionRemoteAddress() {
return null;
}

@Override
public String scheme() {
return null;
}

@Override
public String connectionScheme() {
return null;
}

@Override
public String hostName() {
return null;
}

@Override
public int hostPort() {
return 0;
}
}

static class DiscardingHttpServerResponse extends TestHttpServerResponse {
Expand Down
Expand Up @@ -25,6 +25,7 @@
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import reactor.netty.http.server.HttpServerRequest;
Expand Down Expand Up @@ -69,13 +70,15 @@ public void testNoHostHeader() throws Exception {
}

@Test
@Ignore("https://github.com/reactor/reactor-netty/issues/2723")
public void testEmptyStringHostHeader() throws Exception {
final Map<String, String> additionalHeaders = new HashMap<>();
additionalHeaders.put("Host", "");
testProblematicHostHeader(additionalHeaders);
}

@Test
@Ignore("https://github.com/reactor/reactor-netty/issues/2723")
public void testOnlySpacesHostHeader() throws Exception {
final Map<String, String> additionalHeaders = new HashMap<>();
additionalHeaders.put("Host", " ");
Expand Down
Expand Up @@ -71,9 +71,6 @@ public void testLongHeader() throws Exception {
// .tcpConfiguration(this::configure)
// .port(configuredPort)
// .httpRequestDecoder(spec -> spec.maxHeaderSize(Integer.MAX_VALUE));
//
// The problem though.. Shouldn't it be 431 (Request Header Fields Too Large)
// instead of 413 (Payload Too Large)?
Assert.assertEquals(413, response.getStatus());
Assert.assertEquals(431, response.getStatus());
}
}
Expand Up @@ -82,7 +82,7 @@ private Optional<String> mkCall(final String path) throws IOException {
try (PrintWriter out = new PrintWriter(client.getOutputStream(), true)) {
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
out.printf("GET %s HTTP/1.1\r\n", path);
out.print("Host: \r\n");
out.print(String.format("Host: %s\r\n", TestPortProvider.getHost()));
out.print("Connection: close\r\n");
out.print("DUMMY-KEY: dummyValue\r\n");
out.print("\r\n");
Expand Down

This file was deleted.

@@ -0,0 +1,40 @@
#
# JBoss, Home of Professional Open Source.
#
# Copyright 2017 Red Hat, Inc., and individual contributors
# as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

loggers=org.jboss.resteasy,reactor.netty

logger.level=INFO
logger.handlers=CONSOLE

logger.org.jboss.resteasy.level=DEBUG
logger.reactor.netty.level=TRACE

handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.formatter=COLOR-PATTERN
handler.CONSOLE.properties=autoFlush,target
handler.CONSOLE.autoFlush=true
handler.CONSOLE.target=SYSTEM_OUT

formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.COLOR-PATTERN.properties=pattern
formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n

formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n

0 comments on commit bcfa451

Please sign in to comment.