Fixed DynamoDbEnhancedClient DefaultDynamoDbAsyncTable::createTable()…
Fixed DynamoDbEnhancedClient DefaultDynamoDbAsyncTable::createTable() to create secondary indices that are defined on annotations of the POJO class, similar to DefaultDynamoDbTable::createTable().
Description
Current behavior: DynamoDbEnhancedAsyncClient#createTable() fails to generate secondary indexes that are defined on annotations of the POJO class.
Expected behavior: DynamoDbEnhancedAsyncClient#createTable() should generate secondary indexes that are defined on annotations of the POJO class, similar to DefaultDynamoDbTable::createTable().
Motivation and Context
https://github.com/aws/aws-sdk-java-v2/issues/5400
Modifications
Followed the same approach as the synchronous flow in DefaultDynamoDbTable::createTable(). Refactored existing code to enable reuse across both classes.
Testing
The changes have already been tested in the synchronous flow, and additional unit tests have been added for the newly created utility class.
Screenshots (if appropriate)
Types of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
Checklist
- [x] I have read the CONTRIBUTING document
- [x] Local run of
mvn installsucceeds - [x] My code follows the code style of this project
- [ ] My change requires a change to the Javadoc documentation
- [ ] I have updated the Javadoc documentation accordingly
- [x] I have added tests to cover my changes
- [x] All new and existing tests passed
- [x] I have added a changelog entry. Adding a new entry must be accomplished by running the
scripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes. - [ ] My change is to implement 1.11 parity feature and I have updated LaunchChangelog
License
- [x] I confirm that this pull request can be released under the Apache 2 license
@shetsa-amzn We’re unable to add tests directly for this method because DefaultDynamoDbAsyncTable is a final class, which means it cannot be spied using Mockito.spy(). This is different from DefaultDynamoDbTable, which is not final and allows spying. That said, the functionality is already tested in the synchronous flow, specifically in the DefaultDynamoDbTableTest class, so it should behave consistently in the asynchronous flow as well.
Hi @zoewangg, I've applied the suggested changes.
LGTM, waiting for secondary reviewer @dagnir to review.
@roamariei jfyi, let's not squash commits going forward since it'd make it hard to review changes between revision. :)
Triggering builds.
Quality Gate passed
Issues
5 New issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.3% Duplication on New Code