-
Notifications
You must be signed in to change notification settings - Fork 200
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
Initial addition of cursored pagination for SQL #2884
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
68bc521
Initial addition of cursored pagination
andriy-dmytruk 2a88b3e
Checkstyle
andriy-dmytruk 34f73e7
Change base to 4.8.x
andriy-dmytruk b5294fc
Add hasNext and hasPrevious methods to Page
andriy-dmytruk f5d2c5a
Checkstyle fixes and disable PostgreSQL test
andriy-dmytruk 2e8e813
Implement some review comments
andriy-dmytruk 9964e4c
Add methods corresponding to the jakarta PageRequest API
andriy-dmytruk 6167f12
Add requestTotal property to the pageable
andriy-dmytruk 17f81d3
Update Page to account for cases when total size is not queried
andriy-dmytruk b9aa459
Fix build
andriy-dmytruk 5146d90
Implement more review comments
andriy-dmytruk 6bcabba
Add tests
andriy-dmytruk fbc8570
Fix checkstyle
andriy-dmytruk 019dacd
Throw UnsupportedOperationException where cursored pageable is not ye…
andriy-dmytruk db7cc08
Add all cursors to the page implementation and remove nextPageable an…
andriy-dmytruk 6d261ea
Slightly improve the test
andriy-dmytruk b6278a9
Fix for postgres r2dbc test
andriy-dmytruk 8aa2078
Add CursoredPage and interceptor
andriy-dmytruk 0ccf54a
Add documentation for cursored pageable
andriy-dmytruk 0d38e7d
Fix interceptors
andriy-dmytruk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/h2/H2CursoredPaginationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.jdbc.h2 | ||
|
||
import io.micronaut.data.tck.repositories.BookRepository | ||
import io.micronaut.data.tck.repositories.PersonRepository | ||
import io.micronaut.data.tck.tests.AbstractCursoredPageSpec | ||
import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import spock.lang.Shared | ||
|
||
@MicronautTest | ||
@H2DBProperties | ||
class H2CursoredPaginationSpec extends AbstractCursoredPageSpec { | ||
@Inject | ||
@Shared | ||
H2PersonRepository pr | ||
|
||
@Inject | ||
@Shared | ||
H2BookRepository br | ||
|
||
@Override | ||
PersonRepository getPersonRepository() { | ||
return pr | ||
} | ||
|
||
@Override | ||
BookRepository getBookRepository() { | ||
return br | ||
} | ||
|
||
@Override | ||
void init() { | ||
pr.deleteAll() | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/mysql/MysqlCursoredPaginationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.jdbc.mysql | ||
|
||
import groovy.transform.Memoized | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
import io.micronaut.data.tck.repositories.PersonRepository | ||
import io.micronaut.data.tck.tests.AbstractCursoredPageSpec | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
|
||
class MysqlCursoredPaginationSpec extends AbstractCursoredPageSpec implements MySQLTestPropertyProvider { | ||
|
||
@Shared @AutoCleanup ApplicationContext context | ||
|
||
@Memoized | ||
@Override | ||
PersonRepository getPersonRepository() { | ||
return context.getBean(MySqlPersonRepository) | ||
} | ||
|
||
@Memoized | ||
@Override | ||
BookRepository getBookRepository() { | ||
return context.getBean(MySqlBookRepository) | ||
} | ||
|
||
@Override | ||
void init() { | ||
context = ApplicationContext.run(properties) | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...dbc/src/test/groovy/io/micronaut/data/jdbc/oraclexe/OracleXECursoredPaginationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.jdbc.oraclexe | ||
|
||
import groovy.transform.Memoized | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
import io.micronaut.data.tck.repositories.PersonRepository | ||
import io.micronaut.data.tck.tests.AbstractCursoredPageSpec | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
|
||
class OracleXECursoredPaginationSpec extends AbstractCursoredPageSpec implements OracleTestPropertyProvider { | ||
|
||
@Shared @AutoCleanup ApplicationContext context | ||
|
||
@Override | ||
@Memoized | ||
PersonRepository getPersonRepository() { | ||
return context.getBean(OracleXEPersonRepository) | ||
} | ||
|
||
@Override | ||
@Memoized | ||
BookRepository getBookRepository() { | ||
return context.getBean(OracleXEBookRepository) | ||
} | ||
|
||
@Override | ||
void init() { | ||
context = ApplicationContext.run(properties) | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...dbc/src/test/groovy/io/micronaut/data/jdbc/postgres/PostgresCursoredPaginationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.jdbc.postgres | ||
|
||
import groovy.transform.Memoized | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
import io.micronaut.data.tck.repositories.PersonRepository | ||
import io.micronaut.data.tck.tests.AbstractCursoredPageSpec | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Ignore | ||
import spock.lang.Shared | ||
|
||
@Ignore("Causes error: 'FATAL: sorry, too many clients already'") | ||
class PostgresCursoredPaginationSpec extends AbstractCursoredPageSpec implements PostgresTestPropertyProvider { | ||
@Shared @AutoCleanup ApplicationContext context | ||
|
||
@Memoized | ||
@Override | ||
PersonRepository getPersonRepository() { | ||
return context.getBean(PostgresPersonRepository) | ||
} | ||
|
||
@Memoized | ||
@Override | ||
BookRepository getBookRepository() { | ||
return context.getBean(PostgresBookRepository) | ||
} | ||
|
||
@Override | ||
void init() { | ||
context = ApplicationContext.run(getProperties()) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...c/src/test/groovy/io/micronaut/data/jdbc/sqlserver/SqlServerCursoredPaginationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2017-2020 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.micronaut.data.jdbc.sqlserver | ||
|
||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
import io.micronaut.data.tck.repositories.PersonRepository | ||
import io.micronaut.data.tck.tests.AbstractCursoredPageSpec | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
|
||
class SqlServerCursoredPaginationSpec extends AbstractCursoredPageSpec implements MSSQLTestPropertyProvider { | ||
andriy-dmytruk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@Shared @AutoCleanup ApplicationContext context | ||
|
||
@Override | ||
PersonRepository getPersonRepository() { | ||
return context.getBean(MSSQLPersonRepository) | ||
} | ||
|
||
@Override | ||
BookRepository getBookRepository() { | ||
return context.getBean(MSBookRepository) | ||
} | ||
|
||
@Override | ||
void init() { | ||
context = ApplicationContext.run(properties) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Less important, I think you could move context creation in the abstract class
and then use it in all tests (usually how we do it) so init() method might not be needed.