From c314fde78f5117a7ce58f7a5714d1ea97b75b8b0 Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Tue, 17 Dec 2024 11:39:05 +0100 Subject: [PATCH] Adapt to deprecation removals --- .../ext/web/validation/builder/Parameters.java | 12 +++--------- .../ext/web/tests/handler/CookieHandlerTest.java | 14 ++++++-------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/vertx-web-validation/src/main/java/io/vertx/ext/web/validation/builder/Parameters.java b/vertx-web-validation/src/main/java/io/vertx/ext/web/validation/builder/Parameters.java index 19be23121b..c6c20451ec 100644 --- a/vertx-web-validation/src/main/java/io/vertx/ext/web/validation/builder/Parameters.java +++ b/vertx-web-validation/src/main/java/io/vertx/ext/web/validation/builder/Parameters.java @@ -6,13 +6,7 @@ import io.vertx.ext.web.validation.impl.parameter.ParameterProcessorImpl; import io.vertx.ext.web.validation.impl.parameter.SingleValueParameterParser; import io.vertx.ext.web.validation.impl.parser.ValueParser; -import io.vertx.json.schema.common.dsl.ArraySchemaBuilder; -import io.vertx.json.schema.common.dsl.BooleanSchemaBuilder; -import io.vertx.json.schema.common.dsl.NumberSchemaBuilder; -import io.vertx.json.schema.common.dsl.ObjectSchemaBuilder; -import io.vertx.json.schema.common.dsl.SchemaBuilder; -import io.vertx.json.schema.common.dsl.StringSchemaBuilder; -import io.vertx.json.schema.common.dsl.TupleSchemaBuilder; +import io.vertx.json.schema.common.dsl.*; /** * In this interface you can find all available {@link ParameterProcessorFactory} to use in @@ -40,7 +34,7 @@ static ParameterProcessorFactory param(String parameterName, NumberSchemaBuilder false, new SingleValueParameterParser( location.lowerCaseIfNeeded(parameterName), - schemaBuilder.isIntegerSchema() ? ValueParser.LONG_PARSER : ValueParser.DOUBLE_PARSER + schemaBuilder.getType() == SchemaType.INTEGER ? ValueParser.LONG_PARSER : ValueParser.DOUBLE_PARSER ), schemaRepository, schemaBuilder.toJson() @@ -63,7 +57,7 @@ static ParameterProcessorFactory optionalParam(String parameterName, NumberSchem true, new SingleValueParameterParser( location.lowerCaseIfNeeded(parameterName), - schemaBuilder.isIntegerSchema() ? ValueParser.LONG_PARSER : ValueParser.DOUBLE_PARSER + schemaBuilder.getType() == SchemaType.INTEGER ? ValueParser.LONG_PARSER : ValueParser.DOUBLE_PARSER ), schemaRepository, schemaBuilder.toJson() diff --git a/vertx-web/src/test/java/io/vertx/ext/web/tests/handler/CookieHandlerTest.java b/vertx-web/src/test/java/io/vertx/ext/web/tests/handler/CookieHandlerTest.java index 77e11bbb12..ca5aaf63c5 100644 --- a/vertx-web/src/test/java/io/vertx/ext/web/tests/handler/CookieHandlerTest.java +++ b/vertx-web/src/test/java/io/vertx/ext/web/tests/handler/CookieHandlerTest.java @@ -50,16 +50,14 @@ public void testSimpleCookie() throws Exception { public void testGetCookies() throws Exception { router.route().handler(rc -> { assertEquals(3, rc.request().cookieCount()); - Map cookies = rc.request().cookieMap(); - assertTrue(cookies.containsKey("foo")); - assertTrue(cookies.containsKey("wibble")); - assertTrue(cookies.containsKey("plop")); + assertNotNull(rc.request().getCookie("foo")); + assertNotNull(rc.request().getCookie("wibble")); + assertNotNull(rc.request().getCookie("plop")); Cookie removed = rc.response().removeCookie("foo"); - cookies = rc.request().cookieMap(); // removed cookies, need to be sent back with an expiration date - assertTrue(cookies.containsKey("foo")); - assertTrue(cookies.containsKey("wibble")); - assertTrue(cookies.containsKey("plop")); + assertNotNull(rc.request().getCookie("foo")); + assertNotNull(rc.request().getCookie("wibble")); + assertNotNull(rc.request().getCookie("plop")); rc.response().end(); }); testRequest(HttpMethod.GET, "/", req -> req.headers().set("Cookie", "foo=bar; wibble=blibble; plop=flop"), resp -> {