Commit Graph

14986 Commits

Author SHA1 Message Date
hongwei
245dc5910f test/(http4sbridge): add Http4sTestServer singleton and integration tests
- Add Http4sTestServer singleton for shared HTTP4S test server across test classes
- Create Http4sServerIntegrationTest for real end-to-end HTTP4S server testing
- Move Http4sLiftBridgeParityTest to http4sbridge package for better organization
- Move Http4sLiftRoundTripPropertyTest to http4sbridge package for consistency
- Implement lazy initialization pattern matching TestServer (Jetty/Lift) behavior
- Add automatic server startup on first access and shutdown hook for cleanup
- Enable real HTTP requests over network to test complete server stack including middleware
2026-02-04 14:56:16 +01:00
hongwei
bef2dd46cf refactor/set maven.test.failure.ignore to true 2026-02-04 13:16:40 +01:00
hongwei
76da1a98d5 refactor/(run_all_tests): enhance failed tests tracking with timestamps
- Replace auto-generated notice with timestamp in failed_tests.txt header
- Add new else branch to clear failed_tests.txt when all tests pass
- Include "ALL TESTS PASSED" marker in cleared failed_tests.txt file
- Add logging message when tests pass and failed tests file is cleared
- Improve test result tracking by distinguishing between failed and passing runs
2026-02-04 11:47:44 +01:00
hongwei
650d6ca730 refactor/(http4s): enhance error handling and request conversion for bridge parity
- Replace NotFoundResponse with JSON error responses in Http4sLiftWebBridge for consistent error formatting
- Improve Content-Type header extraction with fallback to header parameters when contentType is unavailable
- Fix query parameter extraction to use parsed queryParams instead of raw URI query parsing
- Add wrappedRoutesV500ServicesWithJsonNotFound for standalone JSON 404 responses
- Add wrappedRoutesV500ServicesWithBridge for production-like fallback behavior to Lift bridge
- Fix multi-value query parameter handling in Http4sRequestConversionPropertyTest by adding all values at once
- Update authenticatedEndpoints to use path segments instead of string literals to avoid URL encoding issues
- Enhance logging messages to indicate JSON 404 responses are being returned
- These changes improve parity between Http4s and Lift implementations and provide better error diagnostics
2026-02-04 11:01:13 +01:00
hongwei
6a6f55e3a5 refactor/(run_specific_tests): improve test execution and reporting
- Replace mapfile with while loop for macOS compatibility when reading test files
- Refactor test execution to run test classes individually instead of batch mode
- Add parallel compilation support with -T 4 flag for faster builds
- Implement comprehensive test result tracking and aggregation
- Add detailed summary reporting with passed/failed test counts
- Display individual test status with checkmarks (✓) and crosses (✗) in output
- Enhance logging with per-test execution headers and status indicators
- Improve result determination logic to handle individual test failures
- Add failed test class listing in summary report for better visibility
2026-02-04 09:39:41 +01:00
hongwei
cf5df3f9ee refactor/(run_all_tests): improve test class extraction from failure logs
- Replace unreliable grep pattern matching with line-number-based approach
- Find most recent test class name before each failure occurrence
- Use awk to filter test class lines that appear before failure markers
- Improve accuracy of test class identification in complex log outputs
- Maintain backward compatibility with existing test file discovery logic
- This change addresses edge cases where multiple test classes appear in logs before failures
2026-02-04 09:16:51 +01:00
hongwei
3061689938 refactor/remove checkmark emojis from documentation and logging
- Remove  emoji prefixes from APIMethods600 API documentation comments
- Remove  emoji prefixes from SecureLogging utility method documentation
- Remove  emoji prefixes from Http4sResponseConversionPropertyTest validation summary output
- Improve readability and consistency by using plain text instead of emoji markers
- Ensure documentation maintains clarity without relying on visual emoji indicators
2026-02-04 00:48:38 +01:00
hongwei
444c23eaec test/(http4s): add property-based tests for request and response conversion
- Add Http4sRequestConversionPropertyTest with 100+ iteration property tests
- Add Http4sResponseConversionPropertyTest with comprehensive response validation
- Implement random data generators for HTTP methods, URIs, headers, and bodies
- Test HTTP method preservation across random request variations
- Test URI path preservation with various path segments and encodings
- Test query parameter preservation with multiple values and special characters
- Test header preservation including custom headers and edge cases
- Test request body preservation with empty, JSON, and special character payloads
- Test response status code preservation and mapping
- Test response header preservation and accessibility
- Test response body preservation with various content types
- Validate edge cases: empty bodies, special characters, large payloads, unusual headers
- Ensure bridge correctly implements HTTPRequest interface per Requirements 2.2
- Minimum 100 iterations per test scenario for robust property validation
2026-02-04 00:44:57 +01:00
hongwei
ed87179a05 test/(http4s): enhance Http4sCallContextBuilder and add round-trip property tests
- Refactor Http4sCallContextBuilderTest with improved header extraction test scenarios
- Add comprehensive header handling tests including single values, multiple values, and special characters
- Enhance Authorization header extraction and validation tests
- Add Http4sResponseConversionTest with response mapping and conversion validation
- Create Http4sLiftRoundTripPropertyTest for HTTP4S to Lift Req conversion property-based testing
- Improve test documentation and validation requirements traceability
- Simplify imports and remove unused dependencies for cleaner test code
- Validates Requirements 2.2 for header parameter extraction and query parameter handling
2026-02-03 23:40:33 +01:00
hongwei
bab466127f test/(http4s): add response conversion tests and enhance bridge debugging
- Add Http4sResponseConversionTest with comprehensive test coverage for Lift to HTTP4S response conversion
- Test all response types: InMemoryResponse, StreamingResponse, OutputStreamResponse, BasicResponse
- Validate HTTP status codes, headers, and body preservation across response types
- Test edge cases: empty responses, large payloads (>1MB), UTF-8 characters, error status codes
- Test streaming responses with callbacks and output stream handling
- Enhance Http4sLiftWebBridge debugging with body preview (first 200 bytes) and request JSON/body logging
- Improve observability for request/response flow debugging and troubleshooting
- Validates Requirements 2.4 (Task 2.5) for response conversion parity
2026-02-03 23:40:20 +01:00
hongwei
b951231528 refactor/(http4s): enhance Http4sLiftBridge debugging and test initialization
- Add comprehensive debug logging throughout Http4sLiftBridge dispatch flow to track request handling and handler resolution
- Log stateful scope state, handler availability checks, and response types for better troubleshooting
- Add detailed request metadata logging (content-type, auth headers, body size, path information) in buildLiftReq
- Move http4sRoutes initialization to beforeAll() to ensure Lift is fully initialized before bridge setup
- Add afterAll() cleanup method to remove test data (ViewDefinition and AccountAccess records)
- Fix header and body ordering in toHttp4sRequest to ensure headers are set after body to prevent defaults from overriding
- Add explanatory comments documenting known limitation of bridge running in separate LiftRules instance from Jetty server
- Improve request construction to properly handle Content-Type and other headers in http4s requests
2026-02-03 15:37:35 +01:00
hongwei
48c181a84a test/(v5.0.0): Add system views CRUD parity test scenarios
- Add comprehensive system views CRUD operations parity test between Lift and Http4s
- Import required dependencies for view creation, entitlements, and JSON serialization
- Add entitlements for system view operations (create, read, update, delete)
- Implement create operation test with request/response parity validation
- Implement get operation test to verify view retrieval consistency
- Implement update operation test with modified view attributes
- Implement get-after-update test to verify persistence of changes
- Implement delete operation test with account access cleanup
- Implement get-after-delete test to verify deletion across both frameworks
- Validate correlation IDs and response status codes for all operations
- Ensure JSON response structure parity between Lift and Http4s implementations
2026-02-02 13:10:22 +01:00
hongwei
8ef0e7c5cb Refactor/ API version handling in ApiCollector and related files
Updated the ApiCollector implementations across multiple API versions to replace the deprecated ScannedApiVersion with the new ApiVersion utility. This change enhances consistency and maintainability in the API versioning approach. The affected files include ApiCollector.scala for AU, Bahrain, Polish, STET, and UK Open Banking APIs, as well as the ApiVersion.scala file where new constants were defined for these versions.
2026-02-02 11:48:24 +01:00
hongwei
66eec52845 Test/Enhance Http4sLiftBridgeParityTest with additional version scenarios 2026-02-02 11:04:10 +01:00
hongwei
70286cfd6b Enhance Http4sLiftBridgeParityTest with DirectLogin scenarios
Add test user and consumer setup in beforeAll for DirectLogin testing. Introduce new scenarios to validate DirectLogin behavior with and without authentication headers, ensuring consistent response codes and token presence across Http4s and Lift implementations. This improves test coverage and aligns with the ongoing efforts for contract parity.
2026-01-30 12:22:48 +01:00
hongwei
b47651b8c6 Refactor/ test descriptions to use 'liftweb' terminology
Update feature descriptions and failure messages in Http4sLiftBridgeParityTest and V500ContractParityTest to consistently refer to 'liftweb' instead of 'Lift'. This change enhances clarity and aligns with the naming conventions used throughout the codebase. Additionally, update comments in MessageDocsJsonSchemaTest for consistency in terminology.
2026-01-30 11:05:30 +01:00
hongwei
8b723ec02b feature/(http4s): refactor and integrate Http4sLiftBridge for improved request handling
Remove the legacy Http4sBoot class and integrate the new Http4sLiftBridge to enhance request handling and response mapping between Http4s and Lift frameworks. This update includes the addition of standard headers in responses and improves the overall structure of the Http4s server.

New tests have been added to ensure contract parity between the Http4s and Lift implementations, focusing on consistent response behavior across different API versions.
2026-01-30 11:03:28 +01:00
hongwei
e1e8b391f7 feature/(http4s): enhance request handling and response mapping
Refactor the Http4s500 module to improve request handling by introducing a new method for building Lift requests and enhancing the response mapping from Lift to Http4s. This includes the addition of correlation header checks in the V500ContractParityTest to ensure consistent response behavior between Http4s and Lift implementations.

The changes aim to streamline the integration between the two frameworks, facilitating better contract parity testing and improving overall code clarity.
2026-01-29 15:25:40 +01:00
hongwei
9a6368bf80 feature/(http4s): add proxy to lift for parity testing
Add a proxy route in Http4s500 to forward unmatched requests to the legacy Lift framework, enabling contract parity testing between the two implementations. This allows new http4s endpoints to be tested against existing Lift behavior.

Update V500ContractParityTest to include a test for the private accounts endpoint, verifying both implementations return consistent responses. Simplify assertion syntax from `should not be empty` to `isDefined shouldBe true` for clarity.
2026-01-29 10:30:08 +01:00
hongwei
97ccc77a86 Merge remote-tracking branch 'Simon/develop' into feature/addHttp4sV500 2026-01-28 15:36:40 +01:00
hongwei
7c2e788d84 feature/(v5.0.0): add products endpoints to http4s routes
Implement GET /banks/{bankId}/products and GET /banks/{bankId}/products/{productCode} endpoints in the http4s v5.0.0 routes. Enhance error response converter to parse APIFailureNewStyle from exception messages. Add corresponding unit and contract parity tests.
2026-01-28 15:17:16 +01:00
hongwei
cd34ffde55 feature/(v5.0.0): add single bank endpoint to http4s routes
Implement GET /banks/{BANK_ID} endpoint in the http4s v5.0.0 routes, returning bank details in JSON format. This provides parity with the existing Lift-based API and enables direct http4s client access to individual bank resources.

Add corresponding test scenarios to verify the endpoint functionality and ensure response consistency between http4s and Lift implementations.
2026-01-28 14:55:57 +01:00
hongwei
d463b71c00 feature/(api): add http4s support for v5.0.0 API routes
Introduce new Http4s500 module providing v5.0.0 API endpoints alongside existing v7.0.0 routes.
Update Http4sServer to serve both API versions by combining routes with fallback logic.
Modify ResourceDocMiddleware to extract API version from request path for proper call context.
Add comprehensive test suites for v5.0.0 routes and contract parity verification.
2026-01-28 14:44:36 +01:00
hongwei
90ef73c863 test/(v5_0_0): add API root and banks endpoint tests
Add test scenarios for the GET /root and GET /banks endpoints in the v5.0.0 API to verify they return the expected API info and banks list structure.
2026-01-28 13:57:12 +01:00
karmaking
c365b6afb2 Merge branch 'develop' of https://github.com/OpenBankProject/OBP-API into develop 2026-01-28 11:50:09 +01:00
karmaking
31b7a3a3ce update build pipeline 2026-01-28 11:46:51 +01:00
Simon Redfern
ac1530fb2f
Merge pull request #2668 from hongwei1/refactor/tweakedActions
reafactor/ ci: expand branch pattern to include all branches
2026-01-28 10:54:56 +01:00
hongwei
a97c8d6ffb reafactor/ ci: expand branch pattern to include all branches
The previous branch pattern excluded some branches unintentionally. Adding '**' ensures all branches are matched except 'develop'.
2026-01-28 09:41:29 +01:00
Simon Redfern
a81e208cb1
Merge pull request #2665 from hongwei1/develop
test/added tests for V700
2026-01-27 16:30:40 +01:00
Simon Redfern
61c83581ac
Merge pull request #2659 from constantine2nd/develop
Merge conflicts resolved, HTTP4S
2026-01-27 16:25:50 +01:00
Simon Redfern
8ab316b492
Merge pull request #2666 from simonredfern/develop
Making dynamic entities more snake_case
2026-01-26 15:46:40 +01:00
hongwei
5ff7b299a6 refactor/(resource-docs): enforce canReadResourceDoc role via middleware
Move role-based authorization for resource-docs endpoint from endpoint implementation to ResourceDocMiddleware. This ensures consistent authentication handling across all endpoints and removes duplicate authorization logic.

The middleware now checks the `resource_docs_requires_role` property and enforces the `canReadResourceDoc` role when enabled. Tests are updated to verify proper 403 responses with missing role messages.
2026-01-26 14:29:54 +01:00
hongwei
73b9ecb591 Merge remote-tracking branch 'Marko/develop' into develop 2026-01-26 13:56:51 +01:00
simonredfern
e08d25520e Dynamic Entity Example id is snake case e.g. piano_id rather than
pianoId
2026-01-26 13:03:35 +01:00
Marko Milić
87b48fc71d feature/Tweak GitHub workflows 2026-01-26 12:54:28 +01:00
hongwei
897a6a1584 test/(http4s): improve error handling and request header extraction
- Safely extract request headers using `S.request.map(...).openOr(Nil)` instead of `openOrThrowException`
- Add proper error handling for resource-docs endpoint using `ErrorResponseConverter`
- Extract query parameters directly from URI instead of parsing URL string
- Add comprehensive test suite for Http4s700 routes
2026-01-26 12:47:14 +01:00
Marko Milić
18daf8dfb2 Revert "fix Github Action"
This reverts commit 3a264ed326.
2026-01-26 12:42:31 +01:00
simonredfern
26f2fd192b Docfix: Mentioning content=dynamic for resource docs 2026-01-26 10:51:33 +01:00
Marko Milić
0188ba61a0 refactor/Tweak variables names 2026-01-26 10:25:36 +01:00
Marko Milić
1534831ff4 refactor/Refactor ResourceDocMiddleware: integrate JSON content type and improve validation DSL
- Ensure all responses (errors and successful) have JSON Content-Type
- Replace repeated EitherT patterns with a clean Validation DSL (success/failure)
- Add ValidationContext to accumulate user, bank, account, view, and counterparty entities
- Add detailed comments for authentication, authorization, and entity validation steps
- Simplify middleware logic while preserving original validation order and behavior
2026-01-23 18:13:42 +01:00
Marko Milić
79ea9231a1 Merge upstream/develop into develop after conflict resolution 2026-01-23 12:41:26 +01:00
hongwei
493a7858e0 test/(http4s): add ResourceDocMatcher unit tests
- Add comprehensive test suite for ResourceDocMatcher with 545 lines of test coverage
- Test exact path matching for GET, POST, and multi-segment paths
- Test verb and path mismatch scenarios returning None
- Test BANK_ID variable matching and parameter extraction
- Test BANK_ID + ACCOUNT_ID variable matching and extraction
- Test BANK_ID + ACCOUNT_ID + VIEW_ID variable matching and extraction
- Test COUNTERPARTY_ID variable matching and extraction
- Test non-matching request scenarios
- Ensure ResourceDocMatcher correctly identifies and extracts path parameters for all variable types
- Use FeatureSpec with Given-When-Then style for clear test documentation
2026-01-23 12:37:21 +01:00
hongwei
f0eaedaf3a test/(http4s): add comprehensive Http4sCallContextBuilder unit tests
- Add Http4sCallContextBuilderTest with 454 lines of test coverage
- Test URL extraction including path, query parameters, and path parameters
- Test header extraction and conversion to HTTPParam format
- Test body extraction for POST, PUT, and GET requests
- Test correlation ID generation and extraction from X-Request-ID header
- Test IP address extraction from X-Forwarded-For and direct connection
- Test authentication header extraction for all supported auth types
- Test error handling and edge cases in CallContext building
- Ensure Http4sCallContextBuilder correctly processes http4s Request[IO] objects
2026-01-23 12:21:18 +01:00
Marko Milić
e0f747a64c Merge remote-tracking branch 'upstream/develop' into develop 2026-01-23 10:29:19 +01:00
simonredfern
7efbf6389a closing database connections after StoredProcedure calls and Migrations. 2026-01-22 18:41:01 +01:00
simonredfern
6ad3689fd3 Merge remote-tracking branch 'upstream/develop' into develop 2026-01-22 18:38:39 +01:00
simonredfern
3d4660ec0b added _links for dynamic entity CRUD endpoints. + adding GET system
database pool endpoint
2026-01-22 18:37:42 +01:00
Simon Redfern
3cb783affa
Merge pull request #2662 from hongwei1/develop
feature/addResourceDocsGuardsForHttp4s
2026-01-22 16:35:11 +01:00
hongwei
0415d13b1a refactor/(http4s): improve documentation and code clarity in error handling and support utilities
- Enhance ErrorResponseConverter documentation with detailed handler descriptions and response format details
- Add comprehensive comments explaining error type handling (APIFailureNewStyle, Box Failure, unknown exceptions)
- Document correlation-Id header inclusion and HTTP status code mapping in error responses
- Simplify error matching logic in toHttp4sResponse using pattern matching
- Improve Http4sSupport file documentation with clear component descriptions
- Add usage examples for RequestOps implicit class in endpoint implementations
- Clarify CallContext storage mechanism using http4s Vault (type-safe key-value store)
- Document validated entity storage (user, bank, bankAccount, view, counterparty) within CallContext
- Add inline comments explaining ResourceDocMatcher functionality and request matching process
- Improve code readability with consistent formatting and clearer method documentation
2026-01-22 16:19:53 +01:00
hongwei
83d90bfc44 Merge remote-tracking branch 'Simon/develop' into develop
# Conflicts:
#	.gitignore
2026-01-22 16:11:59 +01:00