Repository navigation
Conversation
…tests Also move the sync & reactive test from `AbstractChangeSteamFunctionalTest` to `ChangeStreamProseTest`. This effectively matches the instructions that were left in `AbstractChangeSteamFunctionalTest`. JAVA-6350
…geStreamPublisher.withDocumentClass` JAVA-6351
|
|
||
| public final class ListCollectionNamesIterableTest { | ||
| public static final Set<String> EXPECTED_EXTRA_METHODS = singleton("authorizedCollections(boolean)"); | ||
| public static final Set<String> EXPECTED_MISSING_METHODS = singleton("timeoutMode(com.mongodb.client.cursor.TimeoutMode)"); |
There was a problem hiding this comment.
Make EXPECTED_MISSING_METHODS empty if #2090 is merged before this PR.
| default Publisher<TResult> timeoutMode(TimeoutMode timeoutMode) { | ||
| throw fail(); | ||
| } |
There was a problem hiding this comment.
Remove this method if #2090 is merged before this PR.
| default MongoIterable<TResult> timeoutMode(TimeoutMode timeoutMode) { | ||
| throw fail(); | ||
| } |
There was a problem hiding this comment.
Remove this method if #2090 is merged before this PR.
9c18062 to
e49875e
Compare
…I method JAVA-6258
…ble API method Test changes: - It does not seem possible to test the changes via both AggregateIterableSpecification/ChangeStreamIterableSpecification and AggregatePublisherImplTest/ChangeStreamPublisherImplTest, so I added AggregateIterableIntegrationTest/AggregatePublisherIntegrationTest, ChangeStreamIterableIntegrationTest/ChangeStreamPublisherIntegrationTest - Moved ChangeStreamProseTest.batchSizeWorksForWithDocumentClass to ChangeStreamIterableIntegrationTest/ChangeStreamPublisherIntegrationTest.batchSizeWorksForWithDocumentClass JAVA-6258
| * @see ChangeStreamOperation#FORBIDDEN_COMMAND_OPTIONS | ||
| */ | ||
| // When changing this set, remember to update the documentation of the affected API. | ||
| public static final Set<String> FORBIDDEN_COMMAND_OPTIONS = unmodifiableSet( |
There was a problem hiding this comment.
Make it a Predicate, the same applies to ChangeStreamOperation.
There was a problem hiding this comment.
To implement this as a predicate, one has to do either of the following:
- still have a field that holds the set
- use multiple
equals(...) or...comparisons
I like neither more than the current code, so I decided not to do the proposed change.
There was a problem hiding this comment.
Done. @apmasell, thank you for the idea on how to write the predicate in a way I did not see.
| } | ||
|
|
||
| @Override | ||
| public <TDocument> MongoIterable<TDocument> withDocumentClass(final Class<TDocument> clazz) { |
There was a problem hiding this comment.
Why is it not implemented via MongoIterableImpl.map?
There was a problem hiding this comment.
At least one of the reasons we can't implement this method via MongoIterable.map is the following.
map converts TResult into U, where U for withDocumentClass would have been TDocument, and TResult would have been ChangeStreamDocument<...>. That means, to implement withDocumentClass via map, we need to provide a the mapper Function<ChangeStreamDocument<...>, TDocument>. This means, instead of decoding raw bytes into TDocument right away, we would have decoded them into ChangeStreamDocument, and then converted it into TDocument (by encoding back into bytes, and decoding into TDocument), which is more wasteful.
Maybe there are other reasons, but I am not experimenting with this to find them out.
| .collect(toCollection(TreeSet::new)); | ||
| } | ||
|
|
||
| public static String signature(final Method method) { |
There was a problem hiding this comment.
- Rename to "erased signature"
- Document that return types are ignored, which allows for the related discrepancies to stay unnoticed.
| * @see ChangeStreamOperation#FORBIDDEN_COMMAND_OPTIONS | ||
| */ | ||
| // When changing this set, remember to update the documentation of the affected API. | ||
| public static final Set<String> FORBIDDEN_COMMAND_OPTIONS = unmodifiableSet( |
There was a problem hiding this comment.
Done. @apmasell, thank you for the idea on how to write the predicate in a way I did not see.
JAVA-6350 - 5bdea84
JAVA-6351 - 208acd6
JAVA-5068 - e4a8385, 81c3b36
JAVA-6258 - ce5f537, 4a50fe6, a117fe0
Post-review fixes: a5fd442, 8823119, 2ced33d, fce0a10