-
Notifications
You must be signed in to change notification settings - Fork 192
Fix 1441 in 4_4_x - scope and collection not considered in repo delete. #1465
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
Fix 1441 in 4_4_x - scope and collection not considered in repo delete. #1465
Conversation
This is a more localized change than the one in main. Closes #1464.
@@ -60,7 +60,7 @@ public class ReactiveCouchbaseRepositoryKeyValueIntegrationTests extends Cluster | |||
|
|||
@Autowired ReactiveUserRepository userRepository; | |||
|
|||
@Autowired ReactiveAirportRepository airportRepository; | |||
@Autowired ReactiveAirportRepository reactiveAirportRepository; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to rename the ReactiveAiportRepository to exactly match the bean-name for disambiguation - as the ReactiveAirportRepositoryAnnotated is also a ReactiveAirportRepository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
@SpringJUnitConfig(Config.class) | ||
@IgnoreWhen(missesCapabilities = { Capabilities.QUERY, Capabilities.COLLECTIONS }, clusterTypes = ClusterType.MOCKED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the missing @SpringJunitConfig was causing the @Autowired not to work, and requiring a hack in beforeAll()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple comments, but looks good overall.
this.findOperationWithProjection = findOp; | ||
this.findOp = (ReactiveFindByQuery<?>) (operations.findByQuery(type).inScope(method.getScope()) | ||
.inCollection(method.getCollection())); | ||
this.removeOp = (ReactiveRemoveByQuery<?>) (operations.removeByQuery(type).inScope(method.getScope()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can it be casted to findBy and RemoveBy at the same time?
@@ -65,6 +67,8 @@ public AbstractCouchbaseQuery(CouchbaseQueryMethod method, CouchbaseOperations o | |||
ExecutableFindByQuery<?> findOp = operations.findByQuery(type); | |||
findOp = (ExecutableFindByQuery<?>) (findOp.inScope(method.getScope()).inCollection(method.getCollection())); | |||
this.findOperationWithProjection = findOp; | |||
this.removeOp = (ExecutableRemoveByQuery<?>) (operations.removeByQuery(type).inScope(method.getScope()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as comment below, is it possible that not both casts are possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand the comment correctly - both are fine. the first one is operations.findByQuery(), the second is operations.removeByQuery(). I'm actually not sure why a cast is even required - because ExecutableRemoveByQuery (eventually) extends the type returned by withCollection() (RemoveByQueryWithOptions).
@@ -99,6 +101,15 @@ | |||
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS) | |||
Mono<Airport> findByIata(String iata); | |||
|
|||
@Query("#{#n1ql.delete} WHERE #{#n1ql.filter} and iata = $1 #{#n1ql.returning}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra whitespace between and and iata, also below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof. Formatter does not reformat quoted strings!
@@ -60,7 +60,7 @@ public class ReactiveCouchbaseRepositoryKeyValueIntegrationTests extends Cluster | |||
|
|||
@Autowired ReactiveUserRepository userRepository; | |||
|
|||
@Autowired ReactiveAirportRepository airportRepository; | |||
@Autowired ReactiveAirportRepository reactiveAirportRepository; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is a more localized change than the one in main.
Closes #1464.