diff --git a/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterApplication.java b/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterApplication.java index 8beaa12938..468d100464 100644 --- a/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterApplication.java +++ b/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterApplication.java @@ -96,7 +96,6 @@ import com.github.benmanes.caffeine.cache.Caffeine; import io.smallrye.config.ConfigMapping; -import io.vertx.core.CompositeFuture; import io.vertx.core.DeploymentOptions; import io.vertx.core.Future; import io.vertx.core.buffer.Buffer; @@ -317,7 +316,7 @@ protected void doStart() { }) .onFailure(t -> LOG.error("failed to deploy notification receiver verticle(s)", t)); - CompositeFuture.all(adapterTracker, notificationReceiverTracker) + Future.all(adapterTracker, notificationReceiverTracker) .map(deploymentResult) .onComplete(deploymentCheck); } diff --git a/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterBase.java b/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterBase.java index 054179a3fe..ce82a8b54f 100644 --- a/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterBase.java +++ b/adapter-base/src/main/java/org/eclipse/hono/adapter/AbstractProtocolAdapterBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -58,7 +58,6 @@ import io.micrometer.core.instrument.Timer.Sample; import io.netty.handler.codec.http.HttpResponseStatus; import io.opentracing.SpanContext; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Promise; @@ -367,15 +366,14 @@ protected final Future stopInternal() { private Future closeServiceClients() { - @SuppressWarnings("rawtypes") - final List results = new ArrayList<>(); + final List> results = new ArrayList<>(); results.add(tenantClient.stop()); results.add(registrationClient.stop()); results.add(credentialsClient.stop()); results.add(commandConsumerFactory.stop()); results.add(commandRouterClient.stop()); results.add(messagingClientProviders.stop()); - return CompositeFuture.all(results).mapEmpty(); + return Future.all(results).mapEmpty(); } /** @@ -459,7 +457,7 @@ protected Future checkConnectionLimit(final TenantObject tenantConfig, fin } }); - return CompositeFuture.all( + return Future.all( connectionLimitCheckResult, checkConnectionDurationLimit(tenantConfig, spanContext), messageLimitCheckResult).mapEmpty(); @@ -923,7 +921,7 @@ public final Future sendTtdEvent( context); final Future tenantConfigTracker = getTenantConfiguration(tenant, context); - return CompositeFuture.all(tokenTracker, tenantConfigTracker).compose(ok -> { + return Future.all(tokenTracker, tenantConfigTracker).compose(ok -> { if (tenantConfigTracker.result().isAdapterEnabled(getTypeName())) { final Map props = new HashMap<>(); props.put(MessageHelper.APP_PROPERTY_ORIG_ADAPTER, getTypeName()); diff --git a/adapter-base/src/main/java/org/eclipse/hono/adapter/MessagingClientProviders.java b/adapter-base/src/main/java/org/eclipse/hono/adapter/MessagingClientProviders.java index 6beb30040a..952a9046b8 100644 --- a/adapter-base/src/main/java/org/eclipse/hono/adapter/MessagingClientProviders.java +++ b/adapter-base/src/main/java/org/eclipse/hono/adapter/MessagingClientProviders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -26,7 +26,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.ext.healthchecks.HealthCheckHandler; @@ -141,7 +140,7 @@ public MessagingClientProvider getCommandResponseSenderPr @Override public Future start() { - return CompositeFuture.all( + return Future.all( telemetrySenderProvider.start(), eventSenderProvider.start(), commandResponseSenderProvider.start()).mapEmpty(); @@ -149,7 +148,7 @@ public Future start() { @Override public Future stop() { - return CompositeFuture.all( + return Future.all( telemetrySenderProvider.stop(), eventSenderProvider.stop(), commandResponseSenderProvider.stop()).mapEmpty(); diff --git a/adapters/amqp/src/main/java/org/eclipse/hono/adapter/amqp/VertxBasedAmqpProtocolAdapter.java b/adapters/amqp/src/main/java/org/eclipse/hono/adapter/amqp/VertxBasedAmqpProtocolAdapter.java index 338a1c1cd2..e0d5d64297 100644 --- a/adapters/amqp/src/main/java/org/eclipse/hono/adapter/amqp/VertxBasedAmqpProtocolAdapter.java +++ b/adapters/amqp/src/main/java/org/eclipse/hono/adapter/amqp/VertxBasedAmqpProtocolAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2018, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -90,7 +90,6 @@ import io.opentracing.log.Fields; import io.opentracing.tag.Tags; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -200,7 +199,7 @@ protected void doStart(final Promise startPromise) { } return Future.succeededFuture(); }) - .compose(success -> CompositeFuture.all(bindSecureServer(), bindInsecureServer())) + .compose(success -> Future.all(bindSecureServer(), bindInsecureServer())) .map(ok -> (Void) null) .onComplete(startPromise); } @@ -291,7 +290,7 @@ protected void doStop(final Promise stopPromise) { log.trace("stop already called"); return; } - CompositeFuture.all(stopSecureServer(), stopInsecureServer()) + Future.all(stopSecureServer(), stopInsecureServer()) .map(ok -> (Void) null) .onComplete(ar -> log.info("AMQP server(s) closed")) .onComplete(stopPromise); @@ -487,8 +486,7 @@ void onConnectionLoss(final ProtonConnection con) { private Future handleConnectionLossInternal(final ProtonConnection con, final Span span, final boolean sendDisconnectedEvent, final boolean closeCommandConsumers) { authenticatedDeviceConnections.remove(con); - @SuppressWarnings("rawtypes") - final List handlerResults; + final List> handlerResults; if (closeCommandConsumers) { handlerResults = getCommandSubscriptions(con).stream() .map(commandSubscription -> closeCommandConsumer(commandSubscription.getConsumer(), @@ -498,7 +496,7 @@ private Future handleConnectionLossInternal(final ProtonConnection con, fi handlerResults = Collections.emptyList(); } decrementConnectionCount(con, span.context(), sendDisconnectedEvent); - return CompositeFuture.join(handlerResults) + return Future.join(handlerResults) .recover(thr -> { Tags.ERROR.set(span, true); return Future.failedFuture(thr); @@ -578,10 +576,10 @@ private Future checkAuthorizationAndResourceLimits( // the device/gateway exists and is enabled and // that the connection limit for the tenant is not exceeded. - CompositeFuture.all( + Future.all( checkDeviceRegistration(authenticatedDevice, span.context()), getTenantConfiguration(authenticatedDevice.getTenantId(), span.context()) - .compose(tenantConfig -> CompositeFuture.all( + .compose(tenantConfig -> Future.all( isAdapterEnabled(tenantConfig), checkConnectionLimit(tenantConfig, span.context())))) .map(ok -> { @@ -1284,12 +1282,12 @@ private Future doUploadMessage( final Future tenantTracker = getTenantConfiguration(resource.getTenantId(), currentSpan.context()); final Future tenantValidationTracker = tenantTracker - .compose(tenantObject -> CompositeFuture + .compose(tenantObject -> Future .all(isAdapterEnabled(tenantObject), checkMessageLimit(tenantObject, context.getPayloadSize(), currentSpan.context())) .map(success -> tenantObject)); - return CompositeFuture.all(tenantValidationTracker, tokenFuture) + return Future.all(tenantValidationTracker, tokenFuture) .compose(ok -> { final Map props = getDownstreamMessageProperties(context); @@ -1370,7 +1368,7 @@ private Future doUploadCommandResponseMessage( final Future tenantTracker = getTenantConfiguration(resource.getTenantId(), currentSpan.context()); - return CompositeFuture.all(tenantTracker, responseTracker) + return Future.all(tenantTracker, responseTracker) .compose(ok -> { final CommandResponse commandResponse = responseTracker.result(); log.trace("sending command response [device-id: {}, status: {}, correlation-id: {}, reply-to: {}]", @@ -1388,13 +1386,13 @@ private Future doUploadCommandResponseMessage( resource.getResourceId(), context.getAuthenticatedDevice(), currentSpan.context()); - final Future tenantValidationTracker = CompositeFuture + final Future tenantValidationTracker = Future .all(isAdapterEnabled(tenantTracker.result()), checkMessageLimit(tenantTracker.result(), context.getPayloadSize(), currentSpan.context())) .map(success -> tenantTracker.result()); - return CompositeFuture.all(tenantValidationTracker, tokenFuture) + return Future.all(tenantValidationTracker, tokenFuture) .compose(success -> sendCommandResponse( tenantTracker.result(), tokenFuture.result(), diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractHonoResource.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractHonoResource.java index 0967591ae8..835f2f4e13 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractHonoResource.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractHonoResource.java @@ -57,7 +57,6 @@ import io.opentracing.Tracer; import io.opentracing.tag.Tags; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -292,14 +291,14 @@ protected final Future doUploadMessage( currentSpan.context()); final Future tenantTracker = getAdapter().getTenantClient().get(tenantId, currentSpan.context()); final Future tenantValidationTracker = tenantTracker - .compose(tenantObject -> CompositeFuture.all( + .compose(tenantObject -> Future.all( getAdapter().isAdapterEnabled(tenantObject), getAdapter().checkMessageLimit(tenantObject, payload.length(), currentSpan.context())) .map(tenantObject)); // we only need to consider TTD if the device and tenant are enabled and the adapter // is enabled for the tenant - final Future ttdTracker = CompositeFuture.all(tenantValidationTracker, tokenTracker) + final Future ttdTracker = Future.all(tenantValidationTracker, tokenTracker) .compose(ok -> { final Integer ttdParam = context.getTimeUntilDisconnect(); return getAdapter().getTimeUntilDisconnect(tenantTracker.result(), ttdParam) @@ -346,7 +345,7 @@ protected final Future doUploadMessage( props, currentSpan.context()); } - return CompositeFuture.all(sendResult, responseReady.future()).mapEmpty(); + return Future.all(sendResult, responseReady.future()).mapEmpty(); }).compose(proceed -> { // downstream message sent and (if ttd was set) command was received or ttd has timed out diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java index 2624cb0c5f..f56859b603 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/AbstractVertxBasedCoapAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2018, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2018, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -25,7 +25,6 @@ import org.eclipse.hono.util.Constants; import org.eclipse.hono.util.Futures; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -211,7 +210,7 @@ protected Resource createRoot() { this.insecureEndpoint = ep; }); - return CompositeFuture.any(insecureEndpointFuture, secureEndpointFuture) + return Future.any(insecureEndpointFuture, secureEndpointFuture) .map(ok -> { this.server = newServer; return newServer; diff --git a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CommandResponseResource.java b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CommandResponseResource.java index c21636b65e..4c4d7fd146 100644 --- a/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CommandResponseResource.java +++ b/adapters/coap/src/main/java/org/eclipse/hono/adapter/coap/CommandResponseResource.java @@ -35,7 +35,6 @@ import io.opentracing.Span; import io.opentracing.Tracer; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; @@ -170,8 +169,8 @@ public final Future uploadCommandResponseMessage(final CoapContext context String.format("command-request-id [%s] or status code [%s] is missing/invalid", commandRequestId, responseStatus)))); - return CompositeFuture.all(tenantTracker, commandResponseTracker, deviceRegistrationTracker) - .compose(ok -> CompositeFuture.all( + return Future.all(tenantTracker, commandResponseTracker, deviceRegistrationTracker) + .compose(ok -> Future.all( getAdapter().isAdapterEnabled(tenantTracker.result()), getAdapter().checkMessageLimit(tenantTracker.result(), payload.length(), currentSpan.context())) .mapEmpty()) diff --git a/adapters/http-base/src/main/java/org/eclipse/hono/adapter/http/AbstractVertxBasedHttpProtocolAdapter.java b/adapters/http-base/src/main/java/org/eclipse/hono/adapter/http/AbstractVertxBasedHttpProtocolAdapter.java index 9000e9b19a..44de8dda88 100644 --- a/adapters/http-base/src/main/java/org/eclipse/hono/adapter/http/AbstractVertxBasedHttpProtocolAdapter.java +++ b/adapters/http-base/src/main/java/org/eclipse/hono/adapter/http/AbstractVertxBasedHttpProtocolAdapter.java @@ -54,7 +54,6 @@ import io.opentracing.Span; import io.opentracing.noop.NoopSpan; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -188,7 +187,7 @@ public final void doStart(final Promise startPromise) { System.setProperty(HttpUtils.SYSTEM_PROPERTY_ROUTER_SETUP_LENIENT, "true"); addRoutes(router); - return CompositeFuture.all(bindSecureHttpServer(router), bindInsecureHttpServer(router)); + return Future.all(bindSecureHttpServer(router), bindInsecureHttpServer(router)); } }) .compose(ok -> { @@ -473,7 +472,7 @@ public final void doStop(final Promise stopPromise) { insecureServerStopTracker.complete(); } - CompositeFuture.all(serverStopTracker.future(), insecureServerStopTracker.future()) + Future.all(serverStopTracker.future(), insecureServerStopTracker.future()) .compose(v -> postShutdown()) .onComplete(stopPromise); } @@ -617,14 +616,14 @@ private void doUploadMessage( .orElse(0); final Future tenantTracker = getTenantConfiguration(tenant, currentSpan.context()); final Future tenantValidationTracker = tenantTracker - .compose(tenantObject -> CompositeFuture + .compose(tenantObject -> Future .all(isAdapterEnabled(tenantObject), checkMessageLimit(tenantObject, payloadSize, currentSpan.context())) .map(success -> tenantObject)); // we only need to consider TTD if the device and tenant are enabled and the adapter // is enabled for the tenant - final Future ttdTracker = CompositeFuture.all(tenantValidationTracker, tokenTracker) + final Future ttdTracker = Future.all(tenantValidationTracker, tokenTracker) .compose(ok -> { final Integer ttdParam = getTimeUntilDisconnectFromRequest(ctx); return getTimeUntilDisconnect(tenantTracker.result(), ttdParam) @@ -656,7 +655,7 @@ private void doUploadMessage( if (EndpointType.EVENT.equals(endpoint)) { ctx.getTimeToLive() .ifPresent(ttl -> props.put(MessageHelper.SYS_HEADER_PROPERTY_TTL, ttl.toSeconds())); - return CompositeFuture.all( + return Future.all( getEventSender(tenantValidationTracker.result()).sendEvent( tenantTracker.result(), tokenTracker.result(), @@ -668,7 +667,7 @@ private void doUploadMessage( .map(s -> (Void) null); } else { // unsettled - return CompositeFuture.all( + return Future.all( getTelemetrySender(tenantValidationTracker.result()).sendTelemetry( tenantTracker.result(), tokenTracker.result(), @@ -1244,19 +1243,19 @@ public final void uploadCommandResponseMessage( commandRequestId, responseStatus))); final int payloadSize = Optional.ofNullable(payload).map(Buffer::length).orElse(0); - CompositeFuture.all(tenantTracker, commandResponseTracker) + Future.all(tenantTracker, commandResponseTracker) .compose(commandResponse -> { final Future deviceRegistrationTracker = getRegistrationAssertion( tenant, deviceId, authenticatedDevice, currentSpan.context()); - final Future tenantValidationTracker = CompositeFuture + final Future tenantValidationTracker = Future .all(isAdapterEnabled(tenantTracker.result()), checkMessageLimit(tenantTracker.result(), payloadSize, currentSpan.context())) .map(ok -> null); - return CompositeFuture.all(tenantValidationTracker, deviceRegistrationTracker) + return Future.all(tenantValidationTracker, deviceRegistrationTracker) .compose(ok -> sendCommandResponse( tenantTracker.result(), deviceRegistrationTracker.result(), diff --git a/adapters/lora/src/main/java/org/eclipse/hono/adapter/lora/LoraCommandSubscriptions.java b/adapters/lora/src/main/java/org/eclipse/hono/adapter/lora/LoraCommandSubscriptions.java index cbd9f8cef2..93b09e2c49 100644 --- a/adapters/lora/src/main/java/org/eclipse/hono/adapter/lora/LoraCommandSubscriptions.java +++ b/adapters/lora/src/main/java/org/eclipse/hono/adapter/lora/LoraCommandSubscriptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -31,7 +31,6 @@ import io.opentracing.Span; import io.opentracing.Tracer; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Promise; @@ -105,7 +104,6 @@ private void closeConsumersForGateway(final String tenantId, final String gatewa }); } - @SuppressWarnings("rawtypes") private void closeConsumersForTenant(final String tenantId) { if (!commandSubscriptions.entrySet().stream().anyMatch(e -> e.getKey().getTenant().equals(tenantId))) { return; @@ -120,7 +118,7 @@ private void closeConsumersForTenant(final String tenantId) { .withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT) .start(); TracingHelper.setDeviceTags(span, tenantId, null); - final List consumerCloseFutures = Collections.synchronizedList(new ArrayList<>()); + final List> consumerCloseFutures = Collections.synchronizedList(new ArrayList<>()); final var iter = commandSubscriptions.entrySet().iterator(); while (iter.hasNext()) { final var subscription = iter.next(); @@ -138,7 +136,7 @@ private void closeConsumersForTenant(final String tenantId) { iter.remove(); } - CompositeFuture.join(consumerCloseFutures).onComplete(x -> { + Future.join(consumerCloseFutures).onComplete(x -> { currentCtx.runOnContext(s -> span.finish()); }); } diff --git a/adapters/mqtt-base/src/main/java/org/eclipse/hono/adapter/mqtt/AbstractVertxBasedMqttProtocolAdapter.java b/adapters/mqtt-base/src/main/java/org/eclipse/hono/adapter/mqtt/AbstractVertxBasedMqttProtocolAdapter.java index d69074db82..d35eafd549 100644 --- a/adapters/mqtt-base/src/main/java/org/eclipse/hono/adapter/mqtt/AbstractVertxBasedMqttProtocolAdapter.java +++ b/adapters/mqtt-base/src/main/java/org/eclipse/hono/adapter/mqtt/AbstractVertxBasedMqttProtocolAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -93,7 +93,6 @@ import io.opentracing.SpanContext; import io.opentracing.log.Fields; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -375,7 +374,7 @@ protected final void doStart(final Promise startPromise) { setConnectionLimitManager(connectionLimitManager); checkPortConfiguration() - .compose(ok -> CompositeFuture.all(bindSecureMqttServer(), bindInsecureMqttServer())) + .compose(ok -> Future.all(bindSecureMqttServer(), bindInsecureMqttServer())) .compose(ok -> { if (authHandler == null) { authHandler = createAuthHandler(); @@ -460,7 +459,7 @@ protected final void doStop(final Promise stopPromise) { insecureServerTracker.complete(); } - CompositeFuture.all(serverTracker.future(), insecureServerTracker.future()) + Future.all(serverTracker.future(), insecureServerTracker.future()) .map(ok -> (Void) null) .onComplete(ar -> log.info("MQTT server(s) closed")) .onComplete(stopPromise); @@ -626,9 +625,9 @@ private Future handleEndpointConnectionWithAuthentication(final Mqtt final Future authAttempt = authHandler.authenticateDevice(context); return authAttempt - .compose(authenticatedDevice -> CompositeFuture.all( + .compose(authenticatedDevice -> Future.all( getTenantConfiguration(authenticatedDevice.getTenantId(), currentSpan.context()) - .compose(tenantObj -> CompositeFuture.all( + .compose(tenantObj -> Future.all( isAdapterEnabled(tenantObj), checkConnectionLimit(tenantObj, currentSpan.context()))), checkDeviceRegistration(authenticatedDevice, currentSpan.context())) @@ -855,18 +854,18 @@ public final Future uploadCommandResponseMessage(final MqttContext ctx) { final int payloadSize = ctx.payload().length(); final Future tenantTracker = getTenantConfiguration(tenantId, ctx.getTracingContext()); - return CompositeFuture.all(tenantTracker, commandResponseTracker) + return Future.all(tenantTracker, commandResponseTracker) .compose(success -> { final Future deviceRegistrationTracker = getRegistrationAssertion( tenantId, deviceId, ctx.authenticatedDevice(), currentSpan.context()); - final Future tenantValidationTracker = CompositeFuture.all( + final Future tenantValidationTracker = Future.all( isAdapterEnabled(tenantTracker.result()), checkMessageLimit(tenantTracker.result(), payloadSize, currentSpan.context())) .mapEmpty(); - return CompositeFuture.all(deviceRegistrationTracker, tenantValidationTracker) + return Future.all(deviceRegistrationTracker, tenantValidationTracker) .compose(ok -> sendCommandResponse( tenantTracker.result(), deviceRegistrationTracker.result(), @@ -930,12 +929,12 @@ private Future uploadMessage( deviceId, ctx.authenticatedDevice(), currentSpan.context()); - final Future tenantValidationTracker = CompositeFuture.all( + final Future tenantValidationTracker = Future.all( isAdapterEnabled(tenantObject), checkMessageLimit(tenantObject, payload.length(), currentSpan.context())) .map(tenantObject); - return CompositeFuture.all(tokenTracker, tenantValidationTracker).compose(ok -> { + return Future.all(tokenTracker, tenantValidationTracker).compose(ok -> { final Map props = getDownstreamMessageProperties(ctx); Optional.ofNullable(ctx.getRequestedQos()) @@ -1413,7 +1412,7 @@ protected final void onSubscribe(final MqttSubscribeMessage subscribeMsg) { }); // wait for all futures to complete before sending SUBACK - CompositeFuture.join(new ArrayList<>(subscriptionOutcomes)).onComplete(v -> { + Future.join(new ArrayList<>(subscriptionOutcomes)).onComplete(v -> { if (endpoint.isConnected()) { // return a status code for each topic filter contained in the SUBSCRIBE packet @@ -1786,8 +1785,7 @@ protected final void onUnsubscribe(final MqttUnsubscribeMessage unsubscribeMsg) } final Span span = newSpan("UNSUBSCRIBE"); - @SuppressWarnings("rawtypes") - final List removalDoneFutures = new ArrayList<>(unsubscribeMsg.topics().size()); + final List> removalDoneFutures = new ArrayList<>(unsubscribeMsg.topics().size()); unsubscribeMsg.topics().forEach(topic -> { final AtomicReference removedSubscription = new AtomicReference<>(); @@ -1820,7 +1818,7 @@ protected final void onUnsubscribe(final MqttUnsubscribeMessage unsubscribeMsg) if (endpoint.isConnected()) { endpoint.unsubscribeAcknowledge(unsubscribeMsg.messageId()); } - CompositeFuture.join(removalDoneFutures).onComplete(r -> span.finish()); + Future.join(removalDoneFutures).onComplete(r -> span.finish()); } private Future closeCommandConsumer( @@ -1895,7 +1893,7 @@ private Future onCloseInternal(final Span span, final String reason, final final boolean closeCommandConsumers) { AbstractVertxBasedMqttProtocolAdapter.this.onBeforeEndpointClose(this); AbstractVertxBasedMqttProtocolAdapter.this.onClose(endpoint); - final CompositeFuture removalDoneFuture = removeAllCommandSubscriptions(span, sendDisconnectedEvent, closeCommandConsumers); + final Future removalDoneFuture = removeAllCommandSubscriptions(span, sendDisconnectedEvent, closeCommandConsumers); if (sendDisconnectedEvent) { sendDisconnectedEvent(endpoint.clientIdentifier(), authenticatedDevice, span.context()); } @@ -1932,10 +1930,9 @@ private Future onCloseInternal(final Span span, final String reason, final return removalDoneFuture.mapEmpty(); } - private CompositeFuture removeAllCommandSubscriptions(final Span span, final boolean sendDisconnectedEvent, + private Future removeAllCommandSubscriptions(final Span span, final boolean sendDisconnectedEvent, final boolean closeCommandConsumers) { - @SuppressWarnings("rawtypes") - final List removalFutures = new ArrayList<>(commandSubscriptions.size()); + final List> removalFutures = new ArrayList<>(commandSubscriptions.size()); for (final var iter = commandSubscriptions.values().iterator(); iter.hasNext();) { final Pair pair = iter.next(); pair.one().logUnsubscribe(span); @@ -1946,7 +1943,7 @@ private CompositeFuture removeAllCommandSubscriptions(final Span span, final boo } iter.remove(); } - return CompositeFuture.join(removalFutures); + return Future.join(removalFutures).mapEmpty(); } private Span newSpan(final String operationName) { diff --git a/cli/src/main/java/org/eclipse/hono/cli/app/TelemetryAndEvent.java b/cli/src/main/java/org/eclipse/hono/cli/app/TelemetryAndEvent.java index 496bad5b1f..0999d5d5c6 100644 --- a/cli/src/main/java/org/eclipse/hono/cli/app/TelemetryAndEvent.java +++ b/cli/src/main/java/org/eclipse/hono/cli/app/TelemetryAndEvent.java @@ -24,13 +24,13 @@ import org.eclipse.hono.application.client.ApplicationClient; import org.eclipse.hono.application.client.DownstreamMessage; +import org.eclipse.hono.application.client.MessageConsumer; import org.eclipse.hono.application.client.MessageContext; import org.eclipse.hono.cli.util.CommandUtils; import org.eclipse.hono.cli.util.PropertiesVersionProvider; import org.eclipse.hono.util.Constants; import io.quarkus.runtime.Quarkus; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Vertx; @@ -103,8 +103,7 @@ private Future createConsumers(final ApplicationClient consumerFutures = new ArrayList<>(); + final List> consumerFutures = new ArrayList<>(); if (supportedMessageTypes.contains(MESSAGE_TYPE_EVENT)) { consumerFutures.add( client.createEventConsumer( @@ -121,7 +120,7 @@ private Future createConsumers(final ApplicationClient> checkAdapterInstanceIds(final String tenantId, final Map deviceToInstanceIdMap, final Span span) { - @SuppressWarnings("rawtypes") - final List mappingFutures = new ArrayList<>(); + final List> mappingFutures = new ArrayList<>(); final Map deviceToInstanceIdMapResult = new HashMap<>(); deviceToInstanceIdMap.entrySet().forEach(entry -> { final Future mappingFuture = checkAdapterInstanceId(entry.getValue(), tenantId, entry.getKey(), span) @@ -579,7 +577,7 @@ private Future> checkAdapterInstanceIds(final String tenantI mappingFutures.add(mappingFuture); }); - return CompositeFuture.join(mappingFutures).map(deviceToInstanceIdMapResult); + return Future.join(mappingFutures).map(deviceToInstanceIdMapResult); } private Future checkAdapterInstanceId( diff --git a/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaApplicationClientImpl.java b/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaApplicationClientImpl.java index cc4901fdca..2f39992bf5 100644 --- a/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaApplicationClientImpl.java +++ b/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaApplicationClientImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -36,7 +36,6 @@ import io.opentracing.Tracer; import io.opentracing.noop.NoopTracerFactory; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -108,16 +107,15 @@ public void addOnClientReadyHandler(final Handler> handler) { addOnKafkaProducerReadyHandler(handler); } - @SuppressWarnings("rawtypes") @Override public Future stop() { // stop created consumers - final List closeKafkaClientsTracker = consumersToCloseOnStop.stream() + final List> closeKafkaClientsTracker = consumersToCloseOnStop.stream() .map(MessageConsumer::close) .collect(Collectors.toList()); // add command sender related clients closeKafkaClientsTracker.add(super.stop()); - return CompositeFuture.join(closeKafkaClientsTracker) + return Future.join(closeKafkaClientsTracker) .mapEmpty(); } diff --git a/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaBasedCommandSender.java b/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaBasedCommandSender.java index 12b2bb7fef..0be1204e0c 100644 --- a/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaBasedCommandSender.java +++ b/clients/application-kafka/src/main/java/org/eclipse/hono/application/client/kafka/impl/KafkaBasedCommandSender.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -49,7 +49,6 @@ import io.opentracing.Tracer; import io.opentracing.tag.Tags; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -109,19 +108,18 @@ public KafkaBasedCommandSender( this.consumerConfig = Objects.requireNonNull(consumerConfig); } - @SuppressWarnings("rawtypes") @Override public Future stop() { return lifecycleStatus.runStopAttempt(() -> { // assemble futures for closing the command response consumers - final List stopConsumersTracker = commandResponseConsumers.values().stream() + final List> stopConsumersTracker = commandResponseConsumers.values().stream() .map(HonoKafkaConsumer::stop) .collect(Collectors.toList()); commandResponseConsumers.clear(); - return CompositeFuture.join( + return Future.join( stopProducer(), - CompositeFuture.join(stopConsumersTracker)) + Future.join(stopConsumersTracker)) .mapEmpty(); }); } diff --git a/clients/client-common/src/main/java/org/eclipse/hono/client/util/MessagingClientProvider.java b/clients/client-common/src/main/java/org/eclipse/hono/client/util/MessagingClientProvider.java index bcba6f244b..7b521049a6 100644 --- a/clients/client-common/src/main/java/org/eclipse/hono/client/util/MessagingClientProvider.java +++ b/clients/client-common/src/main/java/org/eclipse/hono/client/util/MessagingClientProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -28,7 +28,6 @@ import org.eclipse.hono.util.TenantConstants; import org.eclipse.hono.util.TenantObject; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.json.JsonObject; import io.vertx.ext.healthchecks.HealthCheckHandler; @@ -175,12 +174,11 @@ public Future start() { } requireClientsConfigured(); - @SuppressWarnings("rawtypes") - final List futures = clientImplementations.values() + final List> futures = clientImplementations.values() .stream() .map(Lifecycle::start) .collect(Collectors.toList()); - return CompositeFuture.all(futures).mapEmpty(); + return Future.all(futures).mapEmpty(); } @Override @@ -188,11 +186,10 @@ public Future stop() { if (!stopCalled.compareAndSet(false, true)) { return Future.succeededFuture(); } - @SuppressWarnings("rawtypes") - final List futures = clientImplementations.values() + final List> futures = clientImplementations.values() .stream() .map(Lifecycle::stop) .collect(Collectors.toList()); - return CompositeFuture.all(futures).mapEmpty(); + return Future.all(futures).mapEmpty(); } } diff --git a/clients/command-amqp/src/main/java/org/eclipse/hono/client/command/amqp/ProtonBasedCommandRouterClient.java b/clients/command-amqp/src/main/java/org/eclipse/hono/client/command/amqp/ProtonBasedCommandRouterClient.java index 6619e2948b..287ec7a645 100644 --- a/clients/command-amqp/src/main/java/org/eclipse/hono/client/command/amqp/ProtonBasedCommandRouterClient.java +++ b/clients/command-amqp/src/main/java/org/eclipse/hono/client/command/amqp/ProtonBasedCommandRouterClient.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -50,7 +50,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.DecodeException; @@ -247,12 +246,11 @@ private void processLastKnownGatewaysWorkQueue(final Instant processingStartPara } } } - @SuppressWarnings("rawtypes") - final List resultFutures = new ArrayList<>(); + final List> resultFutures = new ArrayList<>(); deviceToGatewayMapPerTenant.forEach((tenantId, deviceToGatewayMap) -> { resultFutures.add(setLastKnownGateways(tenantId, deviceToGatewayMap, currentSpan.context())); }); - CompositeFuture.join(resultFutures) + Future.join(resultFutures) .onComplete(ar -> { if (ar.failed()) { TracingHelper.logError(currentSpan, ar.cause()); diff --git a/clients/command-kafka/src/main/java/org/eclipse/hono/client/command/kafka/KafkaBasedInternalCommandConsumer.java b/clients/command-kafka/src/main/java/org/eclipse/hono/client/command/kafka/KafkaBasedInternalCommandConsumer.java index 990573d77a..1b91c1ba23 100644 --- a/clients/command-kafka/src/main/java/org/eclipse/hono/client/command/kafka/KafkaBasedInternalCommandConsumer.java +++ b/clients/command-kafka/src/main/java/org/eclipse/hono/client/command/kafka/KafkaBasedInternalCommandConsumer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -58,7 +58,6 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -380,7 +379,7 @@ public Future stop() { Optional.ofNullable(retryCreateTopicTimerId) .ifPresent(vertx::cancelTimer); - return CompositeFuture.all(closeAdminClient(), stopConsumer()) + return Future.all(closeAdminClient(), stopConsumer()) .mapEmpty(); }); } diff --git a/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandConsumer.java b/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandConsumer.java index 966c3372ff..946ef3da7d 100644 --- a/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandConsumer.java +++ b/clients/command-pubsub/src/main/java/org/eclipse/hono/client/command/pubsub/PubSubBasedInternalCommandConsumer.java @@ -41,7 +41,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; @@ -261,7 +260,7 @@ Future handleCommandMessage(final PubsubMessage message, final AckReplyCon @Override public Future stop() { - return lifecycleStatus.runStopAttempt(() -> CompositeFuture.all( + return lifecycleStatus.runStopAttempt(() -> Future.all( subscriberFactory.closeSubscriber(CommandConstants.INTERNAL_COMMAND_ENDPOINT, adapterInstanceId), vertx.executeBlocking(promise -> { adminClientManager.closeAdminClients(); diff --git a/clients/command/src/main/java/org/eclipse/hono/client/command/ProtocolAdapterCommandConsumerFactoryImpl.java b/clients/command/src/main/java/org/eclipse/hono/client/command/ProtocolAdapterCommandConsumerFactoryImpl.java index 8a9acd6c47..a581edddc9 100644 --- a/clients/command/src/main/java/org/eclipse/hono/client/command/ProtocolAdapterCommandConsumerFactoryImpl.java +++ b/clients/command/src/main/java/org/eclipse/hono/client/command/ProtocolAdapterCommandConsumerFactoryImpl.java @@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory; import io.opentracing.SpanContext; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Promise; @@ -166,14 +165,13 @@ public Future start() { }); internalCommandConsumerSuppliers.clear(); readinessHandler = null; - @SuppressWarnings("rawtypes") - final List futures = internalCommandConsumers.stream() + final List> futures = internalCommandConsumers.stream() .map(Lifecycle::start) .collect(Collectors.toList()); if (futures.isEmpty()) { return Future.failedFuture("no command consumer registered"); } - return CompositeFuture.all(futures).mapEmpty(); + return Future.all(futures).mapEmpty(); }) .recover(thr -> { startFailureMessage = thr.getMessage(); @@ -200,11 +198,10 @@ public Future stop() { if (!stopCalled.compareAndSet(false, true)) { return Future.succeededFuture(); } - @SuppressWarnings("rawtypes") - final List futures = internalCommandConsumers.stream() + final List> futures = internalCommandConsumers.stream() .map(Lifecycle::stop) .collect(Collectors.toList()); - return CompositeFuture.all(futures).mapEmpty(); + return Future.all(futures).mapEmpty(); } @Override diff --git a/clients/kafka-common/src/main/java/org/eclipse/hono/client/kafka/consumer/HonoKafkaConsumer.java b/clients/kafka-common/src/main/java/org/eclipse/hono/client/kafka/consumer/HonoKafkaConsumer.java index 0cc2d0aece..1379f38c7c 100644 --- a/clients/kafka-common/src/main/java/org/eclipse/hono/client/kafka/consumer/HonoKafkaConsumer.java +++ b/clients/kafka-common/src/main/java/org/eclipse/hono/client/kafka/consumer/HonoKafkaConsumer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -53,7 +53,6 @@ import io.quarkus.runtime.annotations.RegisterForReflection; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -905,7 +904,7 @@ private Future initSubscriptionAndWaitForRebalance() { } // init kafkaConsumerWorker; it has to be retrieved after the first "subscribe" invocation kafkaConsumerWorker = getKafkaConsumerWorker(kafkaConsumer); - return CompositeFuture.all(subscribeDonePromise.future(), partitionAssignmentDone.future()).mapEmpty(); + return Future.all(subscribeDonePromise.future(), partitionAssignmentDone.future()).mapEmpty(); } /** diff --git a/clients/notification-amqp/src/main/java/org/eclipse/hono/client/notification/amqp/ProtonBasedNotificationReceiver.java b/clients/notification-amqp/src/main/java/org/eclipse/hono/client/notification/amqp/ProtonBasedNotificationReceiver.java index 2838fff9c0..39d338b104 100644 --- a/clients/notification-amqp/src/main/java/org/eclipse/hono/client/notification/amqp/ProtonBasedNotificationReceiver.java +++ b/clients/notification-amqp/src/main/java/org/eclipse/hono/client/notification/amqp/ProtonBasedNotificationReceiver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -30,7 +30,6 @@ import org.eclipse.hono.notification.NotificationReceiver; import org.eclipse.hono.notification.NotificationType; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; @@ -121,10 +120,9 @@ private void recreateConsumers() { log.debug("recreate notification consumer links"); connection.isConnected(getDefaultConnectionCheckTimeout()) .compose(res -> { - @SuppressWarnings("rawtypes") - final List consumerCreationFutures = new ArrayList<>(); + final List> consumerCreationFutures = new ArrayList<>(); addresses.forEach(address -> consumerCreationFutures.add(createNotificationConsumerIfNeeded(address))); - return CompositeFuture.join(consumerCreationFutures); + return Future.join(consumerCreationFutures); }).onComplete(ar -> { recreatingConsumers.set(false); if (tryAgainRecreatingConsumers.compareAndSet(true, false) || ar.failed()) { diff --git a/examples/hono-client-examples/src/main/java/org/eclipse/hono/vertx/example/base/HonoExampleApplicationBase.java b/examples/hono-client-examples/src/main/java/org/eclipse/hono/vertx/example/base/HonoExampleApplicationBase.java index b214974268..c1e127f3bb 100644 --- a/examples/hono-client-examples/src/main/java/org/eclipse/hono/vertx/example/base/HonoExampleApplicationBase.java +++ b/examples/hono-client-examples/src/main/java/org/eclipse/hono/vertx/example/base/HonoExampleApplicationBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -189,7 +188,7 @@ protected void consumeData() { client.addOnClientReadyHandler(readyTracker); client.start() .compose(ok -> readyTracker.future()) - .compose(v -> CompositeFuture.all(createEventConsumer(), createTelemetryConsumer())) + .compose(v -> Future.all(createEventConsumer(), createTelemetryConsumer())) .onSuccess(ok -> startup.complete(client)) .onFailure(startup::completeExceptionally); @@ -206,8 +205,7 @@ protected void consumeData() { final CompletableFuture> shutDown = new CompletableFuture<>(); - @SuppressWarnings("rawtypes") - final List closeFutures = new ArrayList<>(); + final List> closeFutures = new ArrayList<>(); Optional.ofNullable(eventConsumer) .map(MessageConsumer::close) .ifPresent(closeFutures::add); @@ -218,7 +216,7 @@ protected void consumeData() { .map(Lifecycle::stop) .ifPresent(closeFutures::add); - CompositeFuture.join(closeFutures) + Future.join(closeFutures) .compose(ok -> vertx.close()) .recover(t -> vertx.close()) .onComplete(ar -> shutDown.complete(client)); diff --git a/service-base/src/main/java/org/eclipse/hono/service/amqp/AmqpServiceBase.java b/service-base/src/main/java/org/eclipse/hono/service/amqp/AmqpServiceBase.java index 3faf1bba9c..0a4f9e1e37 100644 --- a/service-base/src/main/java/org/eclipse/hono/service/amqp/AmqpServiceBase.java +++ b/service-base/src/main/java/org/eclipse/hono/service/amqp/AmqpServiceBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -38,7 +38,6 @@ import org.eclipse.hono.util.Strings; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.ext.healthchecks.HealthCheckHandler; @@ -235,28 +234,26 @@ protected Future preStartServers() { private Future startEndpoints() { - @SuppressWarnings("rawtypes") final - List endpointFutures = new ArrayList<>(endpoints.size()); + List> endpointFutures = new ArrayList<>(endpoints.size()); for (final AmqpEndpoint ep : endpoints.values()) { log.info("starting endpoint [name: {}, class: {}]", ep.getName(), ep.getClass().getName()); endpointFutures.add(ep.start()); } - return CompositeFuture.all(endpointFutures) + return Future.all(endpointFutures) .map(ok -> (Void) null) .recover(Future::failedFuture); } private Future stopEndpoints() { - @SuppressWarnings("rawtypes") final - List endpointFutures = new ArrayList<>(endpoints.size()); + List> endpointFutures = new ArrayList<>(endpoints.size()); for (final AmqpEndpoint ep : endpoints.values()) { log.info("stopping endpoint [name: {}, class: {}]", ep.getName(), ep.getClass().getName()); endpointFutures.add(ep.stop()); } - return CompositeFuture.all(endpointFutures) + return Future.all(endpointFutures) .map(ok -> (Void) null) .recover(Future::failedFuture); } @@ -368,7 +365,7 @@ protected ProtonServerOptions createInsecureServerOptions() { public final Future stopInternal() { return preShutdown() - .compose(s -> CompositeFuture.all(stopServer(), stopInsecureServer())) + .compose(s -> Future.all(stopServer(), stopInsecureServer())) .compose(s -> stopEndpoints()) .compose(s -> postShutdown()); } diff --git a/service-base/src/main/java/org/eclipse/hono/service/http/HttpServiceBase.java b/service-base/src/main/java/org/eclipse/hono/service/http/HttpServiceBase.java index b794ada02e..3c29696ecc 100644 --- a/service-base/src/main/java/org/eclipse/hono/service/http/HttpServiceBase.java +++ b/service-base/src/main/java/org/eclipse/hono/service/http/HttpServiceBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -24,7 +24,6 @@ import org.eclipse.hono.util.Constants; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.http.HttpServer; @@ -151,7 +150,7 @@ protected final Future startInternal() { .compose(s -> checkPortConfiguration()) .compose(s -> startEndpoints()) .compose(router -> { - return CompositeFuture.all(bindSecureHttpServer(router), bindInsecureHttpServer(router)); + return Future.all(bindSecureHttpServer(router), bindInsecureHttpServer(router)); }).compose(s -> onStartupSuccess()); } @@ -369,14 +368,13 @@ private Future startEndpoints() { } else { addEndpointRoutes(router); addCustomRoutes(router); - @SuppressWarnings("rawtypes") final - List endpointFutures = new ArrayList<>(endpoints.size()); + List> endpointFutures = new ArrayList<>(endpoints.size()); for (final HttpEndpoint ep : endpoints()) { log.info("starting endpoint [name: {}, class: {}]", ep.getName(), ep.getClass().getName()); endpointFutures.add(ep.start()); } - CompositeFuture.all(endpointFutures).onComplete(startup -> { + Future.all(endpointFutures).onComplete(startup -> { if (startup.succeeded()) { startPromise.complete(router); } else { @@ -390,14 +388,13 @@ private Future startEndpoints() { private Future stopEndpoints() { final Promise stopPromise = Promise.promise(); - @SuppressWarnings("rawtypes") final - List endpointFutures = new ArrayList<>(endpoints.size()); + List> endpointFutures = new ArrayList<>(endpoints.size()); for (final HttpEndpoint ep : endpoints()) { log.info("stopping endpoint [name: {}, class: {}]", ep.getName(), ep.getClass().getName()); endpointFutures.add(ep.stop()); } - CompositeFuture.all(endpointFutures).onComplete(shutdown -> { + Future.all(endpointFutures).onComplete(shutdown -> { if (shutdown.succeeded()) { stopPromise.complete(); } else { @@ -412,7 +409,7 @@ private Future stopEndpoints() { protected final Future stopInternal() { return preShutdown() - .compose(s -> CompositeFuture.all(stopServer(), stopInsecureServer())) + .compose(s -> Future.all(stopServer(), stopInsecureServer())) .compose(s -> stopEndpoints()) .compose(v -> postShutdown()); } diff --git a/services/auth/src/main/java/org/eclipse/hono/authentication/app/Application.java b/services/auth/src/main/java/org/eclipse/hono/authentication/app/Application.java index 867e1f03c6..1e326b07cf 100644 --- a/services/auth/src/main/java/org/eclipse/hono/authentication/app/Application.java +++ b/services/auth/src/main/java/org/eclipse/hono/authentication/app/Application.java @@ -32,7 +32,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.DeploymentOptions; import io.vertx.core.Future; import io.vertx.proton.sasl.ProtonSaslAuthenticatorFactory; @@ -84,7 +83,7 @@ protected void doStart() { }); - CompositeFuture.all(authServiceDeploymentTracker, amqpServerDeploymentTracker) + Future.all(authServiceDeploymentTracker, amqpServerDeploymentTracker) .map(deploymentResult) .onComplete(deploymentCheck); } diff --git a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/device/TableManagementStore.java b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/device/TableManagementStore.java index e1a27ded42..5cb64508bf 100644 --- a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/device/TableManagementStore.java +++ b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/device/TableManagementStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -52,7 +52,6 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.opentracing.log.Fields; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.json.Json; @@ -362,7 +361,7 @@ private Future createGroups( final Set memberOf, final SpanContext context) { - return CompositeFuture.all(memberOf.stream() + return Future.all(memberOf.stream() .map(groupId -> { final var expanded = this.createMemberOfStatement.expand(params -> { @@ -774,7 +773,7 @@ public Future> setCredentials( // then create new entries .compose(updatedCredentials -> { updatedCredentials.createMissingSecretIds(); - return CompositeFuture.all(updatedCredentials.getData().stream() + return Future.all(updatedCredentials.getData().stream() .map(JsonObject::mapFrom) .filter(c -> c.containsKey("type") && c.containsKey("auth-id")) .map(c -> this.insertCredentialEntryStatement diff --git a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/tenant/ManagementStore.java b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/tenant/ManagementStore.java index 5d2c4d8f6b..50a3641a18 100644 --- a/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/tenant/ManagementStore.java +++ b/services/base-jdbc/src/main/java/org/eclipse/hono/service/base/jdbc/store/tenant/ManagementStore.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -37,7 +37,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.json.Json; @@ -255,7 +254,7 @@ private Future insertAllTrustAnchors(final SQLConnection connection, final return Future.succeededFuture(); } - return CompositeFuture + return Future .all(tenant.getTrustedCertificateAuthorities().stream() diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java index 91aca11efe..81c1309fb8 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/app/Application.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -80,7 +80,6 @@ import io.smallrye.config.ConfigMapping; import io.smallrye.health.api.HealthRegistry; -import io.vertx.core.CompositeFuture; import io.vertx.core.DeploymentOptions; import io.vertx.core.Future; import io.vertx.core.Verticle; @@ -306,7 +305,7 @@ protected void doStart() { })) .orElse(Future.succeededFuture()); - CompositeFuture.all( + Future.all( authServiceDeploymentTracker, amqpServerDeploymentTracker, notificationReceiverTracker, diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java index ef6460b4fa..6d53adac9f 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/CommandRouterServiceImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -58,7 +58,6 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.opentracing.log.Fields; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Vertx; @@ -169,8 +168,7 @@ public Future stop() { LOG.info("stopping command router"); if (running.compareAndSet(true, false)) { - @SuppressWarnings("rawtypes") - final List results = new ArrayList<>(); + final List> results = new ArrayList<>(); results.add(registrationClient.stop()); results.add(tenantClient.stop()); if (deviceConnectionInfo instanceof Lifecycle) { @@ -180,7 +178,7 @@ public Future stop() { results.add(commandConsumerFactoryProvider.stop()); results.add(adapterInstanceStatusService.stop()); tenantsToEnable.clear(); - return CompositeFuture.join(results) + return Future.join(results) .onFailure(t -> { LOG.info("error while stopping command router", t); }) @@ -227,7 +225,7 @@ public Future registerCommandConsumer(final String tenantId final Future amqpConsumerFuture = commandConsumerFactoryProvider .getClient(MessagingType.amqp) .createCommandConsumer(tenantId, span.context()); - return CompositeFuture.join(primaryConsumerFuture, amqpConsumerFuture) + return Future.join(primaryConsumerFuture, amqpConsumerFuture) .map(v -> (Void) null) .recover(thr -> { if (amqpConsumerFuture.failed()) { diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java index 9b4a7385bd..2e95f37f41 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedCommandConsumerFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -38,7 +38,6 @@ import org.eclipse.hono.util.CommandConstants; import io.opentracing.SpanContext; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -110,7 +109,7 @@ public ProtonBasedCommandConsumerFactoryImpl( @Override public Future start() { registerCloseConsumerLinkHandler(); - return CompositeFuture.all(connectOnStart(), mappingAndDelegatingCommandHandler.start()) + return Future.all(connectOnStart(), mappingAndDelegatingCommandHandler.start()) .map((Void) null) .onSuccess(v -> { connection.addReconnectListener(c -> recreateConsumers()); @@ -121,7 +120,7 @@ public Future start() { @Override public Future stop() { - return CompositeFuture.join(disconnectOnStop(), mappingAndDelegatingCommandHandler.stop()) + return Future.join(disconnectOnStop(), mappingAndDelegatingCommandHandler.stop()) .map((Void) null); } @@ -215,14 +214,13 @@ private void recreateConsumers() { log.debug("recreate command consumer links"); connection.isConnected(getDefaultConnectionCheckTimeout()) .compose(res -> { - @SuppressWarnings("rawtypes") - final List consumerCreationFutures = new ArrayList<>(); + final List> consumerCreationFutures = new ArrayList<>(); // recreate mappingAndDelegatingCommandConsumers consumerLinkTenants.forEach(tenantId -> { log.debug("recreate command consumer link for tenant {}", tenantId); consumerCreationFutures.add(getOrCreateMappingAndDelegatingCommandConsumer(tenantId)); }); - return CompositeFuture.join(consumerCreationFutures); + return Future.join(consumerCreationFutures); }).onComplete(ar -> { recreatingConsumers.set(false); if (tryAgainRecreatingConsumers.compareAndSet(true, false) || ar.failed()) { diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java index 6884092c74..7fef5aeff1 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedCommandConsumerFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -50,7 +50,6 @@ import io.opentracing.Tracer; import io.opentracing.tag.Tags; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -236,13 +235,13 @@ public Future start() { kafkaConsumer.setOnPartitionsLostHandler( partitions -> commandQueue.setRevokedPartitions(Helper.to(partitions))); - CompositeFuture.all( + Future.all( internalCommandSenderTracker.future(), commandResponseSenderTracker.future(), consumerTracker.future()) .onSuccess(ok -> lifecycleStatus.setStarted()); - return CompositeFuture.all(commandHandler.start(), kafkaConsumer.start()).mapEmpty(); + return Future.all(commandHandler.start(), kafkaConsumer.start()).mapEmpty(); } private void registerTenantCreationListener() { @@ -270,7 +269,7 @@ private void registerTenantCreationListener() { @Override public Future stop() { - return lifecycleStatus.runStopAttempt(() -> CompositeFuture.join(kafkaConsumer.stop(), commandHandler.stop()) + return lifecycleStatus.runStopAttempt(() -> Future.join(kafkaConsumer.stop(), commandHandler.stop()) .mapEmpty()); } diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java index bd5c9e187f..60ded4e862 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -30,7 +30,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; @@ -82,7 +81,7 @@ protected final MessagingType getMessagingType() { */ @Override public Future start() { - return CompositeFuture.all(super.start(), kafkaBasedCommandResponseSender.start()).mapEmpty(); + return Future.all(super.start(), kafkaBasedCommandResponseSender.start()).mapEmpty(); } /** @@ -93,7 +92,7 @@ public Future start() { */ @Override public Future stop() { - return CompositeFuture.join(super.stop(), kafkaBasedCommandResponseSender.stop()).mapEmpty(); + return Future.join(super.stop(), kafkaBasedCommandResponseSender.stop()).mapEmpty(); } /** diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java index 5ee67b0e2f..14f1721739 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedCommandConsumerFactoryImpl.java @@ -47,7 +47,6 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.opentracing.tag.Tags; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.ext.healthchecks.HealthCheckHandler; @@ -140,7 +139,7 @@ public Future start() { @Override public Future stop() { return lifecycleStatus.runStopAttempt( - () -> CompositeFuture.join(subscriberFactory.closeAllSubscribers(), commandHandler.stop()).mapEmpty()); + () -> Future.join(subscriberFactory.closeAllSubscribers(), commandHandler.stop()).mapEmpty()); } @Override diff --git a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java index b8bfda7667..c4c7b30501 100644 --- a/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java +++ b/services/command-router/src/main/java/org/eclipse/hono/commandrouter/impl/pubsub/PubSubBasedMappingAndDelegatingCommandHandler.java @@ -33,7 +33,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Vertx; @@ -83,7 +82,7 @@ protected MessagingType getMessagingType() { */ @Override public Future start() { - return CompositeFuture.all(super.start(), pubSubBasedCommandResponseSender.start()).mapEmpty(); + return Future.all(super.start(), pubSubBasedCommandResponseSender.start()).mapEmpty(); } /** @@ -94,7 +93,7 @@ public Future start() { */ @Override public Future stop() { - return CompositeFuture.join(super.stop(), pubSubBasedCommandResponseSender.stop()).mapEmpty(); + return Future.join(super.stop(), pubSubBasedCommandResponseSender.stop()).mapEmpty(); } /** diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java index 5d75ab98a7..2d60a898c4 100644 --- a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java +++ b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/amqp/ProtonBasedMappingAndDelegatingCommandHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -58,7 +58,6 @@ import io.micrometer.core.instrument.Timer; import io.opentracing.Tracer; import io.opentracing.noop.NoopTracerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -406,7 +405,7 @@ public void testIncomingCommandOrderIsPreservedWhenDelegating(final VertxTestCon .mapAndDelegateIncomingCommandMessage(tenantId, mock(ProtonDelivery.class), message4); // THEN the messages are delegated in the original order - CompositeFuture.all(cmd1Future, cmd2Future, cmd3Future, cmd4Future) + Future.all(cmd1Future, cmd2Future, cmd3Future, cmd4Future) .onComplete(ctx.succeeding(r -> { ctx.verify(() -> { final ArgumentCaptor messageCaptor = ArgumentCaptor.forClass(Message.class); @@ -478,7 +477,7 @@ public void testCommandDelegationOrderWithMappingFailedForFirstEntry(final Vertx .mapAndDelegateIncomingCommandMessage(tenantId, mock(ProtonDelivery.class), message4); // THEN the messages are delegated in the original order, with command 1 left out because it timed out - CompositeFuture.all(cmd2Future, cmd3Future, cmd4Future) + Future.all(cmd2Future, cmd3Future, cmd4Future) .onComplete(ctx.succeeding(r -> { ctx.verify(() -> { assertThat(cmd1Future.failed()).isTrue(); diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java index c32be06ded..a665e143c2 100644 --- a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java +++ b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaBasedMappingAndDelegatingCommandHandlerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -55,7 +55,6 @@ import io.micrometer.core.instrument.Timer; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -298,7 +297,7 @@ public void testIncomingCommandOrderIsPreservedWhenDelegating(final VertxTestCon final Future cmd4Future = cmdHandler.mapAndDelegateIncomingCommandMessage(commandRecord4); // THEN the messages are delegated in the original order - CompositeFuture.all(cmd1Future, cmd2Future, cmd3Future, cmd4Future) + Future.all(cmd1Future, cmd2Future, cmd3Future, cmd4Future) .onComplete(ctx.succeeding(r -> { ctx.verify(() -> { final ArgumentCaptor commandContextCaptor = ArgumentCaptor.forClass(CommandContext.class); @@ -357,7 +356,7 @@ public void testCommandDelegationOrderWithMappingFailedForFirstEntry(final Vertx final Future cmd4Future = cmdHandler.mapAndDelegateIncomingCommandMessage(commandRecord4); // THEN the messages are delegated in the original order, with command 1 left out because it timed out - CompositeFuture.all(cmd2Future, cmd3Future, cmd4Future) + Future.all(cmd2Future, cmd3Future, cmd4Future) .onComplete(ctx.succeeding(r -> { ctx.verify(() -> { assertThat(cmd1Future.failed()).isTrue(); diff --git a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java index db4a730546..ee39c0e8bc 100644 --- a/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java +++ b/services/command-router/src/test/java/org/eclipse/hono/commandrouter/impl/kafka/KafkaCommandProcessingQueueTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -38,7 +38,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import io.opentracing.Span; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Vertx; @@ -65,7 +64,6 @@ public class KafkaCommandProcessingQueueTest { * @param ctx The vert.x test context. */ @Test - @SuppressWarnings("rawtypes") void testSendActionIsInvokedInOrder(final Vertx vertx, final VertxTestContext ctx) { final Context vertxContext = vertx.getOrCreateContext(); vertxContext.runOnContext(v -> { @@ -80,7 +78,7 @@ void testSendActionIsInvokedInOrder(final Vertx vertx, final VertxTestContext ct // WHEN applying the sendAction on these commands in the reverse order final LinkedList sendActionInvoked = new LinkedList<>(); final LinkedList applySendActionSucceeded = new LinkedList<>(); - final List resultFutures = new LinkedList<>(); + final List> resultFutures = new LinkedList<>(); commandContexts.descendingIterator().forEachRemaining(context -> { resultFutures.add(kafkaCommandProcessingQueue .applySendCommandAction(context, () -> { @@ -90,7 +88,7 @@ void testSendActionIsInvokedInOrder(final Vertx vertx, final VertxTestContext ct .onSuccess(v2 -> applySendActionSucceeded.add(context))); }); - CompositeFuture.all(resultFutures).onComplete(ctx.succeeding(ar -> { + Future.all(resultFutures).onComplete(ctx.succeeding(ar -> { ctx.verify(() -> { // THEN the commands got sent in the original order assertThat(sendActionInvoked).isEqualTo(commandContexts); diff --git a/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/app/AbstractDeviceRegistryApplication.java b/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/app/AbstractDeviceRegistryApplication.java index de4413a16b..8d6673b67f 100644 --- a/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/app/AbstractDeviceRegistryApplication.java +++ b/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/app/AbstractDeviceRegistryApplication.java @@ -23,7 +23,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.DeploymentOptions; import io.vertx.core.Future; import io.vertx.core.Verticle; @@ -97,7 +96,7 @@ protected void doStart() { }) .onFailure(t -> log.error("failed to deploy HTTP server verticle(s)", t)); - CompositeFuture.all( + Future.all( authServiceDeploymentTracker, notificationSenderDeploymentTracker, amqpServerDeploymentTracker, diff --git a/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/service/device/AbstractRegistrationService.java b/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/service/device/AbstractRegistrationService.java index 6c3d235e19..203101eba7 100644 --- a/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/service/device/AbstractRegistrationService.java +++ b/services/device-registry-base/src/main/java/org/eclipse/hono/deviceregistry/service/device/AbstractRegistrationService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -38,7 +38,6 @@ import io.opentracing.Span; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -265,7 +264,7 @@ public Future assertRegistration(final String tenantId, fina final Future deviceInfoTracker = getRegistrationInformation(DeviceKey.from(tenantId, deviceId), span); final Future gatewayInfoTracker = getRegistrationInformation(DeviceKey.from(tenantId, gatewayId), span); - return CompositeFuture + return Future .all(deviceInfoTracker, gatewayInfoTracker) .compose(ok -> { diff --git a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/credentials/DelegatingCredentialsManagementHttpEndpoint.java b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/credentials/DelegatingCredentialsManagementHttpEndpoint.java index c6daf00320..a9e5421f02 100644 --- a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/credentials/DelegatingCredentialsManagementHttpEndpoint.java +++ b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/credentials/DelegatingCredentialsManagementHttpEndpoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -29,7 +29,6 @@ import org.eclipse.hono.util.RegistryManagementConstants; import io.opentracing.Span; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -112,7 +111,7 @@ private void getCredentialsForDevice(final RoutingContext ctx) { final Future tenantId = getRequestParameter(ctx, PARAM_TENANT_ID, getPredicate(config.getTenantIdPattern(), false)); final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), false)); - CompositeFuture.all(tenantId, deviceId) + Future.all(tenantId, deviceId) .compose(ok -> { TracingHelper.setDeviceTags(span, tenantId.result(), deviceId.result()); logger.debug("getting credentials [tenant: {}, device-id: {}]]", @@ -154,7 +153,7 @@ private void updateCredentials(final RoutingContext ctx) { final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), false)); final Future> updatedCredentials = fromPayload(ctx); - CompositeFuture.all(tenantId, deviceId, updatedCredentials) + Future.all(tenantId, deviceId, updatedCredentials) .compose(ok -> { TracingHelper.setDeviceTags(span, tenantId.result(), deviceId.result()); logger.debug("updating {} credentials [tenant: {}, device-id: {}]", diff --git a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/device/DelegatingDeviceManagementHttpEndpoint.java b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/device/DelegatingDeviceManagementHttpEndpoint.java index 47420629db..09e45625ed 100644 --- a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/device/DelegatingDeviceManagementHttpEndpoint.java +++ b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/device/DelegatingDeviceManagementHttpEndpoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -30,7 +30,6 @@ import org.eclipse.hono.util.RegistryManagementConstants; import io.opentracing.Span; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -151,7 +150,7 @@ private void doGetDevice(final RoutingContext ctx) { final Future tenantId = getRequestParameter(ctx, PARAM_TENANT_ID, getPredicate(config.getTenantIdPattern(), false)); final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), false)); - CompositeFuture.all(tenantId, deviceId) + Future.all(tenantId, deviceId) .compose(ok -> { TracingHelper.setDeviceTags(span, tenantId.result(), deviceId.result()); logger.debug("retrieving device [tenant: {}, device-id: {}]", tenantId.result(), deviceId.result()); @@ -187,7 +186,7 @@ private void doSearchDevices(final RoutingContext ctx) { final Future> sortOptions = decodeJsonFromRequestParameter(ctx, RegistryManagementConstants.PARAM_SORT_JSON, Sort.class); - CompositeFuture.all(pageSize, pageOffset, filters, sortOptions) + Future.all(pageSize, pageOffset, filters, sortOptions) .onSuccess(ok -> TracingHelper.TAG_TENANT_ID.set(span, tenantId)) .compose(ok -> getService().searchDevices( tenantId, @@ -214,7 +213,7 @@ private void doCreateDevice(final RoutingContext ctx) { final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), true)); final Future device = fromPayload(ctx); - CompositeFuture.all(tenantId, deviceId, device) + Future.all(tenantId, deviceId, device) .compose(ok -> { final Optional did = Optional.ofNullable(deviceId.result()); TracingHelper.TAG_TENANT_ID.set(span, tenantId.result()); @@ -246,7 +245,7 @@ private void doUpdateDevice(final RoutingContext ctx) { final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), false)); final Future device = fromPayload(ctx); - CompositeFuture.all(tenantId, deviceId, device) + Future.all(tenantId, deviceId, device) .compose(ok -> { TracingHelper.setDeviceTags(span, tenantId.result(), deviceId.result()); logger.debug("updating device [tenant: {}, device-id: {}]", tenantId.result(), deviceId.result()); @@ -270,7 +269,7 @@ private void doDeleteDevice(final RoutingContext ctx) { final Future tenantId = getRequestParameter(ctx, PARAM_TENANT_ID, getPredicate(config.getTenantIdPattern(), false)); final Future deviceId = getRequestParameter(ctx, PARAM_DEVICE_ID, getPredicate(config.getDeviceIdPattern(), false)); - CompositeFuture.all(tenantId, deviceId) + Future.all(tenantId, deviceId) .compose(ok -> { TracingHelper.setDeviceTags(span, tenantId.result(), deviceId.result()); logger.debug("removing device [tenant: {}, device-id: {}]", tenantId.result(), deviceId.result()); diff --git a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/tenant/DelegatingTenantManagementHttpEndpoint.java b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/tenant/DelegatingTenantManagementHttpEndpoint.java index decf7b510b..f3a67ff3d9 100644 --- a/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/tenant/DelegatingTenantManagementHttpEndpoint.java +++ b/services/device-registry-base/src/main/java/org/eclipse/hono/service/management/tenant/DelegatingTenantManagementHttpEndpoint.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -29,7 +29,6 @@ import org.eclipse.hono.util.RegistryManagementConstants; import io.opentracing.Span; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -162,7 +161,7 @@ private void createTenant(final RoutingContext ctx) { final Future tenantId = getRequestParameter(ctx, PARAM_TENANT_ID, getPredicate(config.getTenantIdPattern(), true)); final Future payload = fromPayload(ctx); - CompositeFuture.all(tenantId, payload) + Future.all(tenantId, payload) .compose(ok -> { final Optional tid = Optional.ofNullable(tenantId.result()); tid.ifPresent(s -> TracingHelper.TAG_TENANT_ID.set(span, s)); @@ -196,7 +195,7 @@ private void updateTenant(final RoutingContext ctx) { final Future tenantId = getRequestParameter(ctx, PARAM_TENANT_ID, getPredicate(config.getTenantIdPattern(), false)); final Future payload = fromPayload(ctx); - CompositeFuture.all(tenantId, payload) + Future.all(tenantId, payload) .compose(tenant -> { TracingHelper.TAG_TENANT_ID.set(span, tenantId.result()); logger.debug("updating tenant [{}]", tenantId.result()); @@ -252,7 +251,7 @@ private void searchTenants(final RoutingContext ctx) { final Future> sortOptions = decodeJsonFromRequestParameter(ctx, RegistryManagementConstants.PARAM_SORT_JSON, Sort.class); - CompositeFuture.all(pageSize, pageOffset, filters, sortOptions) + Future.all(pageSize, pageOffset, filters, sortOptions) .compose(ok -> getService().searchTenants( pageSize.result(), pageOffset.result(), diff --git a/services/device-registry-base/src/test/java/org/eclipse/hono/service/management/tenant/AbstractTenantManagementSearchTenantsTest.java b/services/device-registry-base/src/test/java/org/eclipse/hono/service/management/tenant/AbstractTenantManagementSearchTenantsTest.java index d4a9f3a470..b85365ad58 100644 --- a/services/device-registry-base/src/test/java/org/eclipse/hono/service/management/tenant/AbstractTenantManagementSearchTenantsTest.java +++ b/services/device-registry-base/src/test/java/org/eclipse/hono/service/management/tenant/AbstractTenantManagementSearchTenantsTest.java @@ -31,7 +31,6 @@ import org.junit.jupiter.api.Test; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.junit5.VertxTestContext; @@ -424,8 +423,7 @@ tenantId3, new Tenant().setEnabled(true).setExtensions( */ default Future createTenants(final Map tenantsToCreate) { - @SuppressWarnings("rawtypes") - final List creationResult = tenantsToCreate.entrySet().stream() + final List> creationResult = tenantsToCreate.entrySet().stream() .map(entry -> getTenantManagementService().createTenant( Optional.of(entry.getKey()), entry.getValue(), @@ -435,6 +433,6 @@ default Future createTenants(final Map tenantsToCreate) { return null; })) .collect(Collectors.toList()); - return CompositeFuture.all(creationResult).mapEmpty(); + return Future.all(creationResult).mapEmpty(); } } diff --git a/services/device-registry-base/src/test/java/org/eclipse/hono/service/registration/AbstractRegistrationServiceTest.java b/services/device-registry-base/src/test/java/org/eclipse/hono/service/registration/AbstractRegistrationServiceTest.java index 2468807373..19840ebe06 100644 --- a/services/device-registry-base/src/test/java/org/eclipse/hono/service/registration/AbstractRegistrationServiceTest.java +++ b/services/device-registry-base/src/test/java/org/eclipse/hono/service/registration/AbstractRegistrationServiceTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -36,7 +36,6 @@ import org.junit.jupiter.api.Test; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -812,7 +811,7 @@ default Future assertDevice( final Future f2 = gatewayId .map(id -> getRegistrationService().assertRegistration(tenant, deviceId, id)) .orElseGet(() -> getRegistrationService().assertRegistration(tenant, deviceId)); - return CompositeFuture.all( + return Future.all( f1.otherwise(t -> OperationResult.empty(ServiceInvocationException.extractStatusCode(t))) .map(r -> { managementAssertions.handle(r); diff --git a/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/JdbcBasedTenantManagementSearchTenantsTest.java b/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/JdbcBasedTenantManagementSearchTenantsTest.java index 43252c3490..8b4009e4de 100644 --- a/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/JdbcBasedTenantManagementSearchTenantsTest.java +++ b/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/JdbcBasedTenantManagementSearchTenantsTest.java @@ -30,7 +30,6 @@ import org.junit.jupiter.api.Test; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.junit5.VertxTestContext; @@ -44,8 +43,7 @@ class JdbcBasedTenantManagementSearchTenantsTest extends AbstractJdbcRegistryTes */ private Future createTenants(final Map tenantsToCreate) { - @SuppressWarnings("rawtypes") - final List creationResult = tenantsToCreate.entrySet().stream() + final List> creationResult = tenantsToCreate.entrySet().stream() .map(entry -> getTenantManagementService().createTenant( Optional.of(entry.getKey()), entry.getValue(), @@ -55,7 +53,7 @@ private Future createTenants(final Map tenantsToCreate) { return null; })) .collect(Collectors.toList()); - return CompositeFuture.all(creationResult).mapEmpty(); + return Future.all(creationResult).mapEmpty(); } /** diff --git a/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/ResolveGroupsTest.java b/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/ResolveGroupsTest.java index 301a9b8f13..93dd5d39e1 100644 --- a/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/ResolveGroupsTest.java +++ b/services/device-registry-jdbc/src/test/java/org/eclipse/hono/deviceregistry/jdbc/impl/ResolveGroupsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -33,7 +33,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.junit5.VertxExtension; @@ -159,7 +158,7 @@ static MappingTest[] testResolveGroups() { @Test void testResolveGroups(final VertxTestContext context) { - CompositeFuture.all(Arrays.stream(testResolveGroups()) + Future.all(Arrays.stream(testResolveGroups()) .map(test -> { final var tenantId = UUID.randomUUID().toString(); @@ -168,7 +167,7 @@ void testResolveGroups(final VertxTestContext context) { .flatMap(x -> this.tenantManagement.createTenant(Optional.of(tenantId), new Tenant(), SPAN)) - .flatMap(x -> CompositeFuture.all( + .flatMap(x -> Future.all( test.devices.stream() diff --git a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDBBasedDeviceManagementSearchDevicesTest.java b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDBBasedDeviceManagementSearchDevicesTest.java index 2bcfbf6d84..adf2b096de 100644 --- a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDBBasedDeviceManagementSearchDevicesTest.java +++ b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDBBasedDeviceManagementSearchDevicesTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -29,7 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; +import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; import io.vertx.junit5.Timeout; @@ -65,7 +65,7 @@ public void setup(final VertxTestContext testContext) { dao = MongoDbTestUtils.getDeviceDao(vertx, DB_NAME); credentialsDao = MongoDbTestUtils.getCredentialsDao(vertx, DB_NAME); service = new MongoDbBasedDeviceManagementService(vertx, dao, credentialsDao, config); - CompositeFuture.all(dao.createIndices(), credentialsDao.createIndices()).onComplete(testContext.succeedingThenComplete()); + Future.all(dao.createIndices(), credentialsDao.createIndices()).onComplete(testContext.succeedingThenComplete()); } /** @@ -85,7 +85,7 @@ public void setup(final TestInfo testInfo) { */ @AfterEach public void cleanCollection(final VertxTestContext testContext) { - CompositeFuture.all( + Future.all( dao.deleteAllFromCollection(), credentialsDao.deleteAllFromCollection()) .onComplete(testContext.succeedingThenComplete()); @@ -104,7 +104,7 @@ public void closeDao(final VertxTestContext testContext) { final Promise credentialsCloseHandler = Promise.promise(); credentialsDao.close(credentialsCloseHandler); - CompositeFuture.all(credentialsCloseHandler.future(), devicesCloseHandler.future()) + Future.all(credentialsCloseHandler.future(), devicesCloseHandler.future()) .compose(ok -> { final Promise vertxCloseHandler = Promise.promise(); vertx.close(vertxCloseHandler); diff --git a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedCredentialServiceTest.java b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedCredentialServiceTest.java index 2b89f47407..18b350efe6 100644 --- a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedCredentialServiceTest.java +++ b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedCredentialServiceTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -56,7 +56,6 @@ import org.slf4j.LoggerFactory; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -115,7 +114,7 @@ public void createServices(final VertxTestContext ctx) { credentialsDao, registrationServiceConfig); - CompositeFuture.all(deviceDao.createIndices(), credentialsDao.createIndices()) + Future.all(deviceDao.createIndices(), credentialsDao.createIndices()) .onComplete(ctx.succeedingThenComplete()); } @@ -170,7 +169,7 @@ public void finishTest(final VertxTestContext testContext) { final Promise deviceCloseHandler = Promise.promise(); deviceDao.close(deviceCloseHandler); - CompositeFuture.all(credentialsCloseHandler.future(), deviceCloseHandler.future()) + Future.all(credentialsCloseHandler.future(), deviceCloseHandler.future()) .compose(ok -> { final Promise vertxCloseHandler = Promise.promise(); vertx.close(vertxCloseHandler); diff --git a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedRegistrationServiceTest.java b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedRegistrationServiceTest.java index 44856363ed..3c44373d4d 100644 --- a/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedRegistrationServiceTest.java +++ b/services/device-registry-mongodb/src/test/java/org/eclipse/hono/deviceregistry/mongodb/service/MongoDbBasedRegistrationServiceTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2020, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2020, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -54,7 +54,6 @@ import io.opentracing.Span; import io.opentracing.noop.NoopSpan; import io.opentracing.noop.NoopTracerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -106,7 +105,7 @@ public void startService(final VertxTestContext testContext) { registrationService = new MongoDbBasedRegistrationService(deviceDao); registrationService.setEdgeDeviceAutoProvisioner(edgeDeviceAutoProvisioner); - CompositeFuture.all(deviceDao.createIndices(), credentialsDao.createIndices()).onComplete(testContext.succeedingThenComplete()); + Future.all(deviceDao.createIndices(), credentialsDao.createIndices()).onComplete(testContext.succeedingThenComplete()); } /** @@ -140,7 +139,7 @@ public void setup(final TestInfo testInfo) { */ @AfterEach public void cleanCollection(final VertxTestContext testContext) { - CompositeFuture.all( + Future.all( deviceDao.deleteAllFromCollection(), credentialsDao.deleteAllFromCollection()) .onComplete(testContext.succeedingThenComplete()); @@ -158,7 +157,7 @@ public void closeDao(final VertxTestContext testContext) { final Promise deviceCloseHandler = Promise.promise(); deviceDao.close(deviceCloseHandler); - CompositeFuture.all(credentialsCloseHandler.future(), deviceCloseHandler.future()) + Future.all(credentialsCloseHandler.future(), deviceCloseHandler.future()) .compose(ok -> { final Promise vertxCloseHandler = Promise.promise(); vertx.close(vertxCloseHandler); diff --git a/tests/src/test/java/org/eclipse/hono/tests/IntegrationTestSupport.java b/tests/src/test/java/org/eclipse/hono/tests/IntegrationTestSupport.java index 87eb0a042b..ead2a6f7b9 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/IntegrationTestSupport.java +++ b/tests/src/test/java/org/eclipse/hono/tests/IntegrationTestSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -92,7 +92,6 @@ import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentracing.Tracer; import io.opentracing.noop.NoopSpan; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -928,7 +927,7 @@ public void deleteObjects(final VertxTestContext ctx) { if (!devicesToDelete.isEmpty()) { LOGGER.debug("deleting {} temporary devices ...", devicesToDelete.size()); } - final var deleteDevices = CompositeFuture + final var deleteDevices = Future .join(devicesToDelete.entrySet() .stream().flatMap(entry -> entry.getValue().stream() @@ -946,7 +945,7 @@ public void deleteObjects(final VertxTestContext ctx) { if (!tenantsToDelete.isEmpty()) { LOGGER.debug("deleting {} temporary tenants ...", tenantsToDelete.size()); } - return CompositeFuture.join(tenantsToDelete.stream() + return Future.join(tenantsToDelete.stream() .map(tenantId -> registry.removeTenant(tenantId, true)) .collect(Collectors.toList())); }) @@ -1234,7 +1233,7 @@ public Future> sendCommand( timeOutTracker.tryComplete(); }); - return CompositeFuture.all(sendCommandTracker, timeOutTracker.future()) + return Future.all(sendCommandTracker, timeOutTracker.future()) .recover(error -> { LOGGER.debug("got error sending command: {}", error.getMessage()); return Future.failedFuture(error); @@ -1309,7 +1308,7 @@ public Future sendOneWayCommand( } }); - return CompositeFuture.all(sendOneWayCommandTracker, timeOutTracker.future()) + return Future.all(sendOneWayCommandTracker, timeOutTracker.future()) .mapEmpty(); } @@ -1541,7 +1540,7 @@ public Future createAutoProvisioningMessageConsumers( final Promise provisioningMessageReceived = Promise.promise(); final Promise telemetryMessageReceived = Promise.promise(); - CompositeFuture.all(provisioningMessageReceived.future(), telemetryMessageReceived.future()) + Future.all(provisioningMessageReceived.future(), telemetryMessageReceived.future()) .onSuccess(ok -> resultHandler.complete()) .onFailure(t -> resultHandler.fail(t)); diff --git a/tests/src/test/java/org/eclipse/hono/tests/auth/AuthServerAmqpIT.java b/tests/src/test/java/org/eclipse/hono/tests/auth/AuthServerAmqpIT.java index 5bdf98a19c..50abb8b3ab 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/auth/AuthServerAmqpIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/auth/AuthServerAmqpIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -36,7 +36,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -124,7 +124,7 @@ public void testTokenRetrievalSucceedsForAuthenticatedUser(final VertxTestContex final var token = client.verifyPlain(null, "hono-client", "secret"); - CompositeFuture.all(validationKey, token) + Future.all(validationKey, token) .onComplete(ctx.succeeding(ok -> { final var user = token.result(); LOG.debug("retrieved token:{}{}", System.lineSeparator(), user.getToken()); diff --git a/tests/src/test/java/org/eclipse/hono/tests/client/HonoKafkaConsumerIT.java b/tests/src/test/java/org/eclipse/hono/tests/client/HonoKafkaConsumerIT.java index 27ca008ce5..4a903f3f0d 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/client/HonoKafkaConsumerIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/client/HonoKafkaConsumerIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -50,7 +50,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -675,21 +674,19 @@ private static Future createTopics(final Collection topicNames, fi } private Future publishRecords(final int numTestRecordsPerTopic, final String keyPrefix, final Set topics) { - @SuppressWarnings("rawtypes") - final List resultFutures = new ArrayList<>(); + final List> resultFutures = new ArrayList<>(); topics.forEach(topic -> { resultFutures.add(publishRecords(numTestRecordsPerTopic, keyPrefix, topic)); }); - return CompositeFuture.all(resultFutures).map((Void) null); + return Future.all(resultFutures).map((Void) null); } private Future publishRecords(final int numRecords, final String keyPrefix, final String topic) { - @SuppressWarnings("rawtypes") - final List resultFutures = new ArrayList<>(); + final List> resultFutures = new ArrayList<>(); IntStream.range(0, numRecords).forEach(i -> { resultFutures.add(publish(topic, keyPrefix + i, Buffer.buffer("testPayload")).mapEmpty()); }); - return CompositeFuture.all(resultFutures).map((Void) null); + return Future.all(resultFutures).map((Void) null); } private static Future publish(final String topic, final String recordKey, final Buffer recordPayload) { diff --git a/tests/src/test/java/org/eclipse/hono/tests/commandrouter/KafkaBasedCommandConsumerFactoryImplIT.java b/tests/src/test/java/org/eclipse/hono/tests/commandrouter/KafkaBasedCommandConsumerFactoryImplIT.java index f36a342363..59e5e625cd 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/commandrouter/KafkaBasedCommandConsumerFactoryImplIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/commandrouter/KafkaBasedCommandConsumerFactoryImplIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -69,7 +69,6 @@ import io.opentracing.Span; import io.opentracing.SpanContext; import io.opentracing.Tracer; -import io.vertx.core.CompositeFuture; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -140,14 +139,13 @@ public void logTestName(final TestInfo testInfo) { */ @AfterEach void cleanupAfterTest(final VertxTestContext ctx) { - @SuppressWarnings("rawtypes") - final List stopFutures = componentsToStopAfterTest.stream() + final List> stopFutures = componentsToStopAfterTest.stream() .map(component -> component.stop() .onSuccess(ok -> LOG.info("stopped component of type {}", component.getClass().getName())) .onFailure(t -> LOG.info("failed to stop component of type {}", component.getClass().getName(), t))) .collect(Collectors.toList()); componentsToStopAfterTest.clear(); - CompositeFuture.all(stopFutures) + Future.all(stopFutures) .onComplete(ctx.succeedingThenComplete()); } @@ -175,7 +173,7 @@ public static void shutDown(final VertxTestContext ctx) { }); topicsDeletedPromise.future() - .compose(ok -> CompositeFuture.all(adminClient.close(), kafkaProducer.close())) + .compose(ok -> Future.all(adminClient.close(), kafkaProducer.close())) .compose(ok -> vertx.close()) .onComplete(ctx.succeedingThenComplete()); } @@ -229,7 +227,7 @@ public void testCommandsGetForwardedInIncomingOrder(final VertxTestContext ctx) final var consumerFactory = getKafkaBasedCommandConsumerFactory( targetAdapterInstanceGetterCompletionFutureSupplier, tenantId); consumerFactory.addOnFactoryReadyHandler(factoryTracker); - CompositeFuture.all( + Future.all( internalConsumer.start().compose(ok -> consumerTracker.future()), consumerFactory.start().compose(ok -> factoryTracker.future())) .compose(f -> createCommandConsumer(tenantId, consumerFactory)) @@ -340,7 +338,7 @@ public void testCommandsGetForwardedIfOneConsumerInstanceGetsClosed(final VertxT firstConsumerGetAdapterInstanceSupplier, tenantId); consumerFactory1.addOnFactoryReadyHandler(factoryTracker); consumerFactory1Ref.set(consumerFactory1); - CompositeFuture.all( + Future.all( internalConsumer.start().compose(ok -> consumerTracker.future()), consumerFactory1.start().compose(ok -> factoryTracker.future())) .compose(f -> createCommandConsumer(tenantId, consumerFactory1)) @@ -363,7 +361,7 @@ public void testCommandsGetForwardedIfOneConsumerInstanceGetsClosed(final VertxT final AtomicInteger secondConsumerGetAdapterInstanceInvocations = new AtomicInteger(); // wait for first record on internal topic to have been received ... - CompositeFuture.join( + Future.join( firstConsumerAllGetAdapterInstanceInvocationsDone.future(), firstRecordReceivedPromise.future()) .compose(v -> { diff --git a/tests/src/test/java/org/eclipse/hono/tests/http/HttpTestBase.java b/tests/src/test/java/org/eclipse/hono/tests/http/HttpTestBase.java index a8e5499cf7..8d031bd051 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/http/HttpTestBase.java +++ b/tests/src/test/java/org/eclipse/hono/tests/http/HttpTestBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -63,7 +63,6 @@ import org.slf4j.LoggerFactory; import io.netty.handler.codec.http.QueryStringEncoder; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.MultiMap; @@ -1206,7 +1205,7 @@ public void testHandleConcurrentUploadWithTtd(final VertxTestContext ctx) throws logger.info("sent one-way command to device"); // THEN both requests succeed - CompositeFuture.all(commandSent, firstRequest, secondRequest) + Future.all(commandSent, firstRequest, secondRequest) .onComplete(ctx.succeeding(ok -> { ctx.verify(() -> { // and the response to the second request contains a command diff --git a/tests/src/test/java/org/eclipse/hono/tests/mqtt/MqttPublishTestBase.java b/tests/src/test/java/org/eclipse/hono/tests/mqtt/MqttPublishTestBase.java index 900a9b5997..65ecea842f 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/mqtt/MqttPublishTestBase.java +++ b/tests/src/test/java/org/eclipse/hono/tests/mqtt/MqttPublishTestBase.java @@ -49,7 +49,6 @@ import io.netty.handler.codec.http.QueryStringEncoder; import io.netty.handler.codec.mqtt.MqttQoS; import io.vertx.core.AsyncResult; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -609,7 +608,7 @@ public void testMessageWithPayloadExceedingMaxSize(final VertxTestContext ctx) t // WHEN a device publishes a message with a payload exceeding the max size final Future sendFuture = send(tenantId, deviceId, Buffer.buffer(payloadBytes), false, true, null); - return CompositeFuture.join(clientClosedPromise.future(), sendFuture) + return Future.join(clientClosedPromise.future(), sendFuture) .onComplete(ar -> { // THEN publishing the message fails (if QoS 1) if (getQos() == MqttQoS.AT_LEAST_ONCE) { diff --git a/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceManagementIT.java b/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceManagementIT.java index 5bd3d136a5..e8f3bdd9c8 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceManagementIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceManagementIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -44,7 +44,7 @@ import com.fasterxml.jackson.core.type.TypeReference; -import io.vertx.core.CompositeFuture; +import io.vertx.core.Future; import io.vertx.core.MultiMap; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpHeaders; @@ -625,7 +625,7 @@ public void testSearchDevicesWithValidPageSizeSucceeds(final VertxTestContext ct final int pageSize = 1; - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, getHelper().getRandomDeviceId(tenantId), new Device()), registry.registerDevice(tenantId, getHelper().getRandomDeviceId(tenantId), new Device())) .compose(response -> registry.searchDevices( @@ -677,7 +677,7 @@ public void testSearchDevicesWithValidPageOffsetSucceeds(final VertxTestContext final int pageOffset = 1; final String sortJson = getSortJson("/ext/id", "desc"); - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, deviceId1, device1), registry.registerDevice(tenantId, deviceId2, device2)) .compose(ok -> registry.searchDevices(tenantId, Optional.of(pageSize), Optional.of(pageOffset), @@ -723,7 +723,7 @@ public void testSearchDevicesWithValidMultipleFiltersSucceeds(final VertxTestCon final String filterJson2 = getFilterJson("/enabled", true, "eq"); final String filterJson3 = getFilterJson("/enabled", false, "eq"); - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, deviceId1, device1), registry.registerDevice(tenantId, deviceId2, device2)) .compose(ok -> registry.searchDevices(tenantId, Optional.empty(), Optional.empty(), @@ -757,7 +757,7 @@ public void testSearchDevicesWithWildCardToMatchMultipleCharactersSucceeds(final final String filterJson1 = getFilterJson("/enabled", true, "eq"); final String filterJson2 = getFilterJson("/ext/id", "$id*", "eq"); - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, deviceId1, device1), registry.registerDevice(tenantId, deviceId2, device2)) .compose(ok -> registry.searchDevices(tenantId, Optional.empty(), Optional.empty(), @@ -807,7 +807,7 @@ public void testSearchDevicesWithWildCardToMatchExactlyOneCharacterSucceeds(fina final String filterJson1 = getFilterJson("/enabled", true, "eq"); final String filterJson2 = getFilterJson("/ext/id", "$id?2", "eq"); - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, deviceId1, device1), registry.registerDevice(tenantId, deviceId2, device2)) .compose(ok -> registry.searchDevices(tenantId, Optional.empty(), Optional.empty(), @@ -870,7 +870,7 @@ public void testSearchDevicesWithValidSortOptionSucceeds(final VertxTestContext final Device device2 = new Device().setExtensions(Map.of("id", "bbb")); final String sortJson = getSortJson("/ext/id", "desc"); - CompositeFuture.all( + Future.all( registry.registerDevice(tenantId, deviceId1, device1), registry.registerDevice(tenantId, deviceId2, device2)) .compose(ok -> registry.searchDevices(tenantId, Optional.empty(), Optional.empty(), List.of(), diff --git a/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceRegistryNotificationsIT.java b/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceRegistryNotificationsIT.java index 068fff6e3c..ebeb0fe6e1 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceRegistryNotificationsIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/registry/DeviceRegistryNotificationsIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -43,7 +43,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -94,7 +93,7 @@ public void shutdown(final VertxTestContext ctx) { final Future receiverStopFuture = Optional.ofNullable(receiver) .map(Lifecycle::stop) .orElseGet(Future::succeededFuture); - CompositeFuture.join(receiverStopFuture, helper.disconnect()) + Future.join(receiverStopFuture, helper.disconnect()) .onComplete(ar -> helper.deleteObjects(ctx)); } diff --git a/tests/src/test/java/org/eclipse/hono/tests/registry/TenantManagementIT.java b/tests/src/test/java/org/eclipse/hono/tests/registry/TenantManagementIT.java index 394208f87f..9d99163ab0 100644 --- a/tests/src/test/java/org/eclipse/hono/tests/registry/TenantManagementIT.java +++ b/tests/src/test/java/org/eclipse/hono/tests/registry/TenantManagementIT.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2016, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -58,7 +58,6 @@ import com.fasterxml.jackson.core.type.TypeReference; -import io.vertx.core.CompositeFuture; import io.vertx.core.Future; import io.vertx.core.MultiMap; import io.vertx.core.http.HttpHeaders; @@ -850,7 +849,7 @@ public void testSearchTenantsWithValidPageSizeSucceeds(final VertxTestContext ct final int pageSize = 1; - CompositeFuture.all( + Future.all( getHelper().registry.addTenant(getHelper().getRandomTenantId(), new Tenant()), getHelper().registry.addTenant(getHelper().getRandomTenantId(), new Tenant())) .compose(response -> getHelper().registry.searchTenants( @@ -973,7 +972,7 @@ public void testSearchTenantsWithValidMultipleFiltersSucceeds(final VertxTestCon final String filterJson2 = getFilterJson("/enabled", true, "eq"); final String filterJson3 = getFilterJson("/enabled", false, "eq"); - CompositeFuture.all( + Future.all( getHelper().registry.addTenant(tenantId1, tenant1), getHelper().registry.addTenant(tenantId2, tenant2)) .compose(ok -> getHelper().registry.searchTenants(Optional.empty(), Optional.empty(), @@ -1008,7 +1007,7 @@ public void testSearchTenantsWithWildCardToMatchMultipleCharactersSucceeds(final final String filterJson1 = getFilterJson("/enabled", true, "eq"); final String filterJson2 = getFilterJson("/ext/id", "$id*", "eq"); - CompositeFuture.all( + Future.all( getHelper().registry.addTenant(tenantId1, tenant1), getHelper().registry.addTenant(tenantId2, tenant2)) .compose(ok -> getHelper().registry.searchTenants(Optional.empty(), Optional.empty(), @@ -1058,7 +1057,7 @@ public void testSearchTenantsWithWildCardToMatchExactlyOneCharacterSucceeds(fina final String filterJson1 = getFilterJson("/enabled", true, "eq"); final String filterJson2 = getFilterJson("/ext/id", "$id?2", "eq"); - CompositeFuture.all( + Future.all( getHelper().registry.addTenant(tenantId1, tenant1), getHelper().registry.addTenant(tenantId2, tenant2)) .compose(ok -> getHelper().registry.searchTenants(Optional.empty(), Optional.empty(), @@ -1121,7 +1120,7 @@ public void testSearchTenantsWithValidSortOptionSucceeds(final VertxTestContext final Tenant tenant2 = new Tenant().setExtensions(Map.of("id", "bbb")); final String sortJson = getSortJson("/ext/id", "desc"); - CompositeFuture.all( + Future.all( getHelper().registry.addTenant(tenantId1, tenant1), getHelper().registry.addTenant(tenantId2, tenant2)) .compose(ok -> getHelper().registry.searchTenants(Optional.empty(), Optional.empty(), List.of(), @@ -1148,15 +1147,14 @@ public void testSearchTenantsWithValidSortOptionSucceeds(final VertxTestContext */ private Future createTenants(final Map tenantsToCreate) { - @SuppressWarnings("rawtypes") - final List creationResult = tenantsToCreate.entrySet().stream() + final List> creationResult = tenantsToCreate.entrySet().stream() .map(entry -> getHelper().registry.addTenant(entry.getKey(), entry.getValue()) .map(response -> { assertThat(response.statusCode()).isEqualTo(HttpURLConnection.HTTP_CREATED); return null; })) .collect(Collectors.toList()); - return CompositeFuture.all(creationResult).mapEmpty(); + return Future.all(creationResult).mapEmpty(); } private String getFilterJson(final String field, final T value, final String operator) {