fix tests

This commit is contained in:
Jörg Prante 2021-04-30 16:10:27 +02:00
parent 3b5001dbcc
commit b97c7407d2
7 changed files with 14 additions and 14 deletions

View file

@ -29,7 +29,7 @@ class TransportLayerSecurityServerTest {
Server server = Server.builder(HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).setContentType("text/plain").build()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).setContentType("text/plain").build()
.write(request.getContent().toString(StandardCharsets.UTF_8)))
.build())
.setTransportLayerSecurityProtocols("TLSv1.2")
@ -66,7 +66,7 @@ class TransportLayerSecurityServerTest {
Server server = Server.builder(HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).setContentType("text/plain").build()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).setContentType("text/plain").build()
.write(request.getContent().toString(StandardCharsets.UTF_8)))
.build())
.setTransportLayerSecurityProtocols("TLSv1.3")

View file

@ -33,7 +33,7 @@ class EncryptedTest {
Server server = Server.builder(HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).setContentType("text/plain").build()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).setContentType("text/plain").build()
.write(request.getContent().toString(StandardCharsets.UTF_8)))
.build())
.build();
@ -73,7 +73,7 @@ class EncryptedTest {
HttpServerDomain domain = HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).setContentType("text/plain").build()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).setContentType("text/plain").build()
.write(request.getContent().toString(StandardCharsets.UTF_8)))
.build();
Server server = Server.builder(domain)
@ -126,7 +126,7 @@ class EncryptedTest {
Server server = Server.builder(HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).setContentType("text/plain").build()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).setContentType("text/plain").build()
.write(request.getContent().toString(StandardCharsets.UTF_8)))
.build())
.build();

View file

@ -34,7 +34,7 @@ class FlushTest {
.singleEndpoint("/flush", "/**", (req, resp) -> {
HttpParameters parameters = req.getParameters();
logger.log(Level.INFO, "got request " + parameters.toString() + ", sending 302 Found");
resp.getBuilder().setStatus(HttpResponseStatus.FOUND).build().flush();
resp.getBuilder().setStatus(HttpResponseStatus.FOUND.code()).build().flush();
})
.build();
Server server = Server.builder(domain)

View file

@ -21,7 +21,7 @@ class MixedProtocolTest {
void testHttp1ClientHttp2Server() throws Exception {
HttpAddress httpAddress = HttpAddress.http2("localhost", 8008);
HttpServerDomain domain = HttpServerDomain.builder(httpAddress)
.singleEndpoint("/", (request, response) -> response.getBuilder().setStatus(HttpResponseStatus.OK).build().flush())
.singleEndpoint("/", (request, response) -> response.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush())
.build();
Server server = Server.builder(domain)
.build();
@ -54,7 +54,7 @@ class MixedProtocolTest {
HttpAddress httpAddress = HttpAddress.http1("localhost", 8008);
HttpServerDomain domain = HttpServerDomain.builder(httpAddress)
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).build().flush())
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush())
.build();
Server server = Server.builder(domain)
.build();
@ -91,7 +91,7 @@ class MixedProtocolTest {
HttpServerDomain domain = HttpServerDomain.builder(httpAddress)
.setSelfCert()
.singleEndpoint("/", (request, response) ->
response.getBuilder().setStatus(HttpResponseStatus.OK).build().flush()
response.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush()
)
.build();
Server server = Server.builder(domain)

View file

@ -42,7 +42,7 @@ class PostTest {
if ("Jörg".equals(parameters.get("name"))) {
success3.set(true);
}
resp.getBuilder().setStatus(HttpResponseStatus.OK).build().flush();
resp.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush();
}, "POST")
.build();
Server server = Server.builder(domain)
@ -92,7 +92,7 @@ class PostTest {
if ("Jörg".equals(parameters.get("name"))) {
success3.set(true);
}
resp.getBuilder().setStatus(HttpResponseStatus.OK).build().flush();
resp.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush();
}, "POST")
.build();
Server server = Server.builder(domain)

View file

@ -34,7 +34,7 @@ class PutTest {
.singleEndpoint("/put", "/**", (req, resp) -> {
logger.log(Level.INFO, "got request " +
req.getContent().toString(StandardCharsets.UTF_8));
resp.getBuilder().setStatus(HttpResponseStatus.OK).build().flush();
resp.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush();
success1.set(true);
}, "PUT")
.build();
@ -83,7 +83,7 @@ class PutTest {
.singleEndpoint("/put", "/**", (req, resp) -> {
logger.log(Level.INFO, "got request, length = " +
req.getContent().readableBytes());
resp.getBuilder().setStatus(HttpResponseStatus.OK).build().flush();
resp.getBuilder().setStatus(HttpResponseStatus.OK.code()).build().flush();
success1.set(true);
}, "PUT")
.build();

View file

@ -28,7 +28,7 @@ class StreamTest {
assertEquals("my body parameter", content);
ByteBufOutputStream outputStream = response.getOutputStream();
outputStream.writeBytes("Hello World");
response.getBuilder().setStatus(HttpResponseStatus.OK)
response.getBuilder().setStatus(HttpResponseStatus.OK.code())
.setContentType("text/plain")
.build()
.write(outputStream);