aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

Fixed DynamoDbEnhancedClient DefaultDynamoDbAsyncTable::createTable()…

Open roamariei opened this issue 1 year ago • 1 comments

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 install succeeds
  • [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-change script and following the instructions. Commit the new file created by the script in .changes/next-release with 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

roamariei avatar Jan 31 '25 11:01 roamariei

@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.

roamariei avatar Apr 08 '25 09:04 roamariei

Hi @zoewangg, I've applied the suggested changes.

roamariei avatar May 23 '25 14:05 roamariei

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.

zoewangg avatar May 26 '25 16:05 zoewangg