Fixed unicorn_web issues. #48
Merged
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.
Summary
1. unicorn_approvals/ApprovalsService/pom.xml
• Added test environment variable: CONTRACT_STATUS_TABLE=test-table for testing
• Added Maven Surefire dependency: Added JUnit4 support with version 3.5.3
2. ContractStatusChangedHandlerFunction.java
• Enhanced logging: Added comprehensive logging throughout the function
• Added error handling: Wrapped the main logic in try-catch with proper error logging
• Environment validation: Added check to ensure CONTRACT_STATUS_TABLE is set
• Debug information: Added logging for table name, events received, and DynamoDB operations
3. unicorn_web/Common/src/main/java/dao/Property.java
• Fixed partition key generation: Changed from lowercase conversion of entire string to lowercase conversion of individual components
4. unicorn_web/Data/property_data.json
• Fixed partition key format: Updated all PK values from lowercase property# to uppercase PROPERTY#
• Consistency fix: Ensures test data matches the new partition key format
5. PublicationApprovedEventHandler.java
• Enhanced logging: Added detailed logging for property updates and key generation
• Fixed partition key: Changed from search# prefix to PROPERTY# prefix
• Debug output: Added logging for partition key, sort key, and existing property data
6. RequestApprovalFunction.java (Major Refactoring)
• Changed from API Gateway to SQS: Completely refactored from handling API Gateway events to SQS events
• Removed HTTP response logic: Eliminated all API Gateway response creation methods
• Added batch processing: Now processes multiple SQS messages in a single invocation
• Enhanced error handling: Individual message failures don't stop processing of other messages
• Improved logging: Added comprehensive logging throughout the processing pipeline
• Fixed partition key: Changed from search# to PROPERTY# prefix
• Added environment logging: Logs environment variables for debugging
7. PropertySearchFunction.java
• Fixed partition key: Changed from search# to PROPERTY# prefix for consistency
• Added debug logging: Added logging for partition and sort keys
Overall Impact
This commit primarily fixes a partition key inconsistency across the application where some components were using search# while others expected PROPERTY#.
The changes ensure all components use the consistent PROPERTY# prefix, along with improved error handling and logging throughout the system. The major
architectural change is converting the approval request function from API Gateway-triggered to SQS-triggered for better scalability and reliability.
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.