This is an automated email from the ASF dual-hosted git repository. matthieu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 29fe055c86bbd581ed73da55b437525b32cc1fef Author: Matthieu Baechler <matth...@apache.org> AuthorDate: Thu Jan 9 11:46:19 2020 +0100 JAMES-3028 refactor DeleteDumbBlobStoreContract.mixingSaveReadAndDeleteShouldReturnConsistentState to use randomlyDistributedReactorOperations --- .../james/blob/api/DeleteDumbBlobStoreContract.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/server/blob/blob-api/src/test/java/org/apache/james/blob/api/DeleteDumbBlobStoreContract.java b/server/blob/blob-api/src/test/java/org/apache/james/blob/api/DeleteDumbBlobStoreContract.java index a3c2a25..e7d4a40 100644 --- a/server/blob/blob-api/src/test/java/org/apache/james/blob/api/DeleteDumbBlobStoreContract.java +++ b/server/blob/blob-api/src/test/java/org/apache/james/blob/api/DeleteDumbBlobStoreContract.java @@ -36,13 +36,10 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ThreadLocalRandom; -import java.util.function.Function; import org.apache.commons.io.IOUtils; import org.apache.james.util.concurrency.ConcurrentTestRunner; import org.junit.jupiter.api.Test; -import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; @@ -204,23 +201,16 @@ public interface DeleteDumbBlobStoreContract { @Test default void mixingSaveReadAndDeleteShouldReturnConsistentState() throws ExecutionException, InterruptedException { ConcurrentTestRunner.builder() - .reactorOperation((thread, iteration) -> getConcurrentMixedOperation()) + .randomlyDistributedReactorOperations( + (thread, iteration) -> testee().save(TEST_BUCKET_NAME, TEST_BLOB_ID, TWELVE_MEGABYTES), + (thread, iteration) -> testee().delete(TEST_BUCKET_NAME, TEST_BLOB_ID), + (thread, iteration) -> checkConcurrentMixedOperation() + ) .threadCount(10) .operationCount(100) .runSuccessfullyWithin(Duration.ofMinutes(2)); } - default Publisher<Void> getConcurrentMixedOperation() { - switch (ThreadLocalRandom.current().nextInt(3)) { - case 0: - return testee().save(TEST_BUCKET_NAME, TEST_BLOB_ID, TWELVE_MEGABYTES); - case 1: - return testee().delete(TEST_BUCKET_NAME, TEST_BLOB_ID); - default: - return checkConcurrentMixedOperation(); - } - } - default Mono<Void> checkConcurrentMixedOperation() { return Mono .fromCallable(() -> --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org