DATACASS-806 - Add support for suspend repository query methods returning List<T>.

This commit is contained in:
Mark Paluch
2020-09-22 14:51:00 +02:00
parent f75eee31b5
commit a4a67b6e63
2 changed files with 13 additions and 2 deletions

View File

@@ -50,8 +50,8 @@ public class ReactiveCassandraQueryMethod extends CassandraQueryMethod {
super(method, metadata, projectionFactory, mappingContext);
this.isCollectionQuery = Lazy.of(() -> !(isPageQuery() || isSliceQuery())
&& ReactiveWrappers.isMultiValueType(metadata.getReturnType(method).getType()));
this.isCollectionQuery = Lazy.of(() -> (!(isPageQuery() || isSliceQuery())
&& ReactiveWrappers.isMultiValueType(metadata.getReturnType(method).getType())) || super.isCollectionQuery());
}
/*

View File

@@ -40,6 +40,8 @@ class ReactiveCassandraQueryMethodCoroutineUnitTests {
suspend fun findSuspendAllByName(): Flow<Person>
fun findAllByName(): Flow<Person>
suspend fun findSuspendByName(): List<Person>
}
@Test // DATACASS-771
@@ -59,4 +61,13 @@ class ReactiveCassandraQueryMethodCoroutineUnitTests {
assertThat(queryMethod.isCollectionQuery).isTrue()
}
@Test // DATACASS-806
internal fun `should consider suspended methods returning List as collection queries`() {
val method = PersonRepository::class.java.getMethod("findSuspendByName", Continuation::class.java)
val queryMethod = ReactiveCassandraQueryMethod(method, DefaultRepositoryMetadata(PersonRepository::class.java), projectionFactory, CassandraMappingContext())
assertThat(queryMethod.isCollectionQuery).isTrue()
}
}