Skip to content

Use wrapped CodecRegistry for MongoClient#watch #1016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public ClusterDescription getClusterDescription() {
private <TResult> ChangeStreamIterable<TResult> createChangeStreamIterable(@Nullable final ClientSession clientSession,
final List<? extends Bson> pipeline,
final Class<TResult> resultClass) {
return new ChangeStreamIterableImpl<>(clientSession, "admin", settings.getCodecRegistry(), settings.getReadPreference(),
return new ChangeStreamIterableImpl<>(clientSession, "admin", delegate.getCodecRegistry(), settings.getReadPreference(),
settings.getReadConcern(), delegate.getOperationExecutor(),
pipeline, resultClass, ChangeStreamLevel.CLIENT, settings.getRetryReads());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ class MongoClientSpecification extends Specification {
.readConcern(ReadConcern.MAJORITY)
.codecRegistry(getDefaultCodecRegistry())
.build()
def codecRegistry = settings.getCodecRegistry()
def readPreference = settings.getReadPreference()
def readConcern = settings.getReadConcern()
def client = new MongoClientImpl(Stub(Cluster), null, settings, executor)
Expand All @@ -133,23 +132,26 @@ class MongoClientSpecification extends Specification {
def changeStreamIterable = execute(watchMethod, session)

then:
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace, codecRegistry,
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace,
withUuidRepresentation(getDefaultCodecRegistry(), UNSPECIFIED),
readPreference, readConcern, executor, [], Document, ChangeStreamLevel.CLIENT, true),
['codec'])

when:
changeStreamIterable = execute(watchMethod, session, [new Document('$match', 1)])

then:
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace, codecRegistry,
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace,
withUuidRepresentation(getDefaultCodecRegistry(), UNSPECIFIED),
readPreference, readConcern, executor, [new Document('$match', 1)], Document, ChangeStreamLevel.CLIENT,
true), ['codec'])

when:
changeStreamIterable = execute(watchMethod, session, [new Document('$match', 1)], BsonDocument)

then:
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace, codecRegistry,
expect changeStreamIterable, isTheSameAs(new ChangeStreamIterableImpl<>(session, namespace,
withUuidRepresentation(getDefaultCodecRegistry(), UNSPECIFIED),
readPreference, readConcern, executor, [new Document('$match', 1)], BsonDocument,
ChangeStreamLevel.CLIENT, true), ['codec'])

Expand Down