From b97c7407d25e3b2543ab8a235c989ad0fcb8f6a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Fri, 30 Apr 2021 16:10:27 +0200 Subject: [PATCH] fix tests --- .../http/server/test/TransportLayerSecurityServerTest.java | 4 ++-- .../xbib/netty/http/server/test/http2/EncryptedTest.java | 6 +++--- .../org/xbib/netty/http/server/test/http2/FlushTest.java | 2 +- .../netty/http/server/test/http2/MixedProtocolTest.java | 6 +++--- .../org/xbib/netty/http/server/test/http2/PostTest.java | 4 ++-- .../java/org/xbib/netty/http/server/test/http2/PutTest.java | 4 ++-- .../org/xbib/netty/http/server/test/http2/StreamTest.java | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/TransportLayerSecurityServerTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/TransportLayerSecurityServerTest.java index 8284d3a..9c54b38 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/TransportLayerSecurityServerTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/TransportLayerSecurityServerTest.java @@ -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") diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java index 96f0634..3c1054d 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/EncryptedTest.java @@ -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(); diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/FlushTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/FlushTest.java index cf05dee..f37c413 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/FlushTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/FlushTest.java @@ -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) diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/MixedProtocolTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/MixedProtocolTest.java index d9cb4aa..4699a0d 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/MixedProtocolTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/MixedProtocolTest.java @@ -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) diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PostTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PostTest.java index b27f281..9682169 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PostTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PostTest.java @@ -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) diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PutTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PutTest.java index e9fe4a8..54df3c1 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PutTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/PutTest.java @@ -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(); diff --git a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/StreamTest.java b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/StreamTest.java index ea1d9bd..d788eef 100644 --- a/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/StreamTest.java +++ b/netty-http-server/src/test/java/org/xbib/netty/http/server/test/http2/StreamTest.java @@ -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);