|
16 | 16 |
|
17 | 17 | package com.mongodb.reactivestreams.client; |
18 | 18 |
|
19 | | -import com.mongodb.client.test.CollectionHelper; |
20 | 19 | import com.mongodb.reactivestreams.client.syncadapter.SyncMongoClient; |
21 | 20 | import org.bson.Document; |
22 | | -import org.bson.codecs.DocumentCodec; |
23 | | -import org.junit.jupiter.api.BeforeEach; |
24 | 21 | import org.junit.jupiter.api.Test; |
25 | 22 |
|
26 | | -import java.util.concurrent.ExecutionException; |
27 | | -import java.util.concurrent.TimeoutException; |
28 | | - |
29 | 23 | /** |
30 | | - * See |
31 | | - * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#prose-tests">Retryable Write Prose Tests</a>. |
| 24 | + * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#prose-tests"> |
| 25 | + * Prose Tests</a>. |
32 | 26 | */ |
33 | | -public class RetryableWritesProseTest extends DatabaseTestCase { |
34 | | - private CollectionHelper<Document> collectionHelper; |
35 | | - |
36 | | - @BeforeEach |
37 | | - @Override |
38 | | - public void setUp() { |
39 | | - super.setUp(); |
40 | | - |
41 | | - collectionHelper = new CollectionHelper<>(new DocumentCodec(), collection.getNamespace()); |
42 | | - collectionHelper.create(); |
43 | | - } |
44 | | - |
| 27 | +final class RetryableWritesProseTest { |
45 | 28 | /** |
46 | | - * Prose test #2. |
| 29 | + * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#2-test-that-drivers-properly-retry-after-encountering-poolclearederrors"> |
| 30 | + * 2. Test that drivers properly retry after encountering PoolClearedErrors</a>. |
47 | 31 | */ |
48 | 32 | @Test |
49 | | - public void poolClearedExceptionMustBeRetryable() throws InterruptedException, ExecutionException, TimeoutException { |
| 33 | + void poolClearedExceptionMustBeRetryable() throws Exception { |
50 | 34 | com.mongodb.client.RetryableWritesProseTest.poolClearedExceptionMustBeRetryable( |
51 | 35 | SyncMongoClient::new, |
52 | 36 | mongoCollection -> mongoCollection.insertOne(new Document()), "insert", true); |
53 | 37 | } |
54 | 38 |
|
55 | 39 | /** |
56 | | - * Prose test #3. |
| 40 | + * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#3-test-that-drivers-return-the-original-error-after-encountering-a-writeconcernerror-with-a-retryablewriteerror-label"> |
| 41 | + * 3. Test that drivers return the original error after encountering a WriteConcernError with a RetryableWriteError label</a>. |
57 | 42 | */ |
58 | 43 | @Test |
59 | | - public void originalErrorMustBePropagatedIfNoWritesPerformed() throws InterruptedException { |
| 44 | + void originalErrorMustBePropagatedIfNoWritesPerformed() throws Exception { |
60 | 45 | com.mongodb.client.RetryableWritesProseTest.originalErrorMustBePropagatedIfNoWritesPerformed( |
61 | 46 | SyncMongoClient::new); |
62 | 47 | } |
63 | 48 |
|
64 | 49 | /** |
65 | | - * Prose test #4. |
| 50 | + * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#4-test-that-in-a-sharded-cluster-writes-are-retried-on-a-different-mongos-when-one-is-available"> |
| 51 | + * 4. Test that in a sharded cluster writes are retried on a different mongos when one is available</a>. |
66 | 52 | */ |
67 | 53 | @Test |
68 | | - public void retriesOnDifferentMongosWhenAvailable() { |
| 54 | + void retriesOnDifferentMongosWhenAvailable() { |
69 | 55 | com.mongodb.client.RetryableWritesProseTest.retriesOnDifferentMongosWhenAvailable( |
70 | 56 | SyncMongoClient::new, |
71 | 57 | mongoCollection -> mongoCollection.insertOne(new Document()), "insert", true); |
72 | 58 | } |
73 | 59 |
|
74 | 60 | /** |
75 | | - * Prose test #5. |
| 61 | + * <a href="https://github.com/mongodb/specifications/blob/master/source/retryable-writes/tests/README.md#5-test-that-in-a-sharded-cluster-writes-are-retried-on-the-same-mongos-when-no-others-are-available"> |
| 62 | + * 5. Test that in a sharded cluster writes are retried on the same mongos when no others are available</a>. |
76 | 63 | */ |
77 | 64 | @Test |
78 | | - public void retriesOnSameMongosWhenAnotherNotAvailable() { |
| 65 | + void retriesOnSameMongosWhenAnotherNotAvailable() { |
79 | 66 | com.mongodb.client.RetryableWritesProseTest.retriesOnSameMongosWhenAnotherNotAvailable( |
80 | 67 | SyncMongoClient::new, |
81 | 68 | mongoCollection -> mongoCollection.insertOne(new Document()), "insert", true); |
|
0 commit comments