From 164ed86ce85d37973ebb24138da7541b757a7923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20J=C4=99drzejczyk?= Date: Tue, 12 Nov 2024 10:15:33 +0100 Subject: [PATCH 1/2] Revert "Add MonoFirstWithValue inflight cancellation test (#3915)" This reverts commit 3ba3cc14da34d9489e23a561638e7361cd0f56f9. --- .../publisher/MonoFirstWithValueTest.java | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java b/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java index 61353ec259..9b606e9242 100644 --- a/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java +++ b/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2024 VMware Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,11 @@ import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicLong; import org.junit.jupiter.api.Test; import reactor.core.Exceptions; import reactor.core.Scannable; -import reactor.core.scheduler.Schedulers; import reactor.test.StepVerifier; import reactor.test.publisher.TestPublisher; import reactor.test.subscriber.AssertSubscriber; @@ -175,35 +172,6 @@ void cancelIsPropagated() { pub2.assertMaxRequested(1); pub2.assertWasCancelled(); } - @Test - void cancelInflightMono() { - AtomicLong cancelledInflightMonos = new AtomicLong(0); - CountDownLatch inflightMonoLatch = new CountDownLatch(1); - CountDownLatch completedMonoLatch = new CountDownLatch(1); - Mono inflightMono1 = Mono.fromCallable(() -> { - inflightMonoLatch.await(); - return 1; - }).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic()); - - Mono inflightMono2 = Mono.fromCallable(() -> { - inflightMonoLatch.await(); - return 2; - }).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic()); - - Mono completedMono = Mono.fromCallable(() -> { - completedMonoLatch.await(); - return 3; - }).doOnCancel(cancelledInflightMonos::getAndIncrement).subscribeOn(Schedulers.boundedElastic()); - - StepVerifier.create(Mono.firstWithValue(inflightMono1, inflightMono2, completedMono)) - .then(() -> { - completedMonoLatch.countDown(); - }) - .expectNext(3) - .verifyComplete(); - - assertThat(cancelledInflightMonos).hasValue(2); - } @Test void singleArrayNullSource() { From bd2166a097cf194886ad521bdf55e9be8c610e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20J=C4=99drzejczyk?= Date: Tue, 12 Nov 2024 10:18:47 +0100 Subject: [PATCH 2/2] license header --- .../java/reactor/core/publisher/MonoFirstWithValueTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java b/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java index 9b606e9242..4a37e099ac 100644 --- a/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java +++ b/reactor-core/src/test/java/reactor/core/publisher/MonoFirstWithValueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 VMware Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2020-2024 VMware Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.