jamesfredley opened a new pull request, #15429:
URL: https://github.com/apache/grails-core/pull/15429
## Summary
Ports the multi-datasource Data Service CRUD routing tests from the
Hibernate5-specific `DataServiceMultiDataSourceSpec` (PR #15395) into the
datastore-agnostic `grails-datamapping-tck`, following the pattern established
by `WhereQueryConnectionRoutingSpec` (PR #15418).
This ensures the Data Service connection routing fix is validated across all
GORM datastore implementations (Hibernate5, MongoDB, etc.).
## Changes
### New TCK files (4 files in `grails-datamapping-tck`)
- **`DataServiceRoutingProduct`** - Domain class mapped to `datasource
'ALL'` with `name` (String) and `amount` (Integer) fields
- **`DataServiceRoutingProductService`** - Abstract class Data Service with
`@Transactional(connection = 'secondary')` testing save, get, delete, count,
findByName, findAllByName, and constructor-style save
- **`DataServiceRoutingProductDataService`** - Interface-only Data Service
pattern verifying identical routing behavior
- **`DataServiceConnectionRoutingSpec`** - 16 test cases covering:
- Save, get, delete (FindAndDeleteImplementer), void delete
(DeleteImplementer), count, findByName, findAllByName routing to secondary
datasource
- Constructor-style save routing
- Save/get/find round-trip through Data Service
- Interface service pattern (save, get, delete, void delete)
- Cross-service data sharing between abstract and interface services
- Data isolation (secondary data not visible on default, default data not
visible on secondary)
## Test Results
All 16 new tests pass on Hibernate5, and the existing
`WhereQueryConnectionRoutingSpec` (5 tests) continues to pass.
```
DataServiceConnectionRoutingSpec > save routes to secondary datasource PASSED
DataServiceConnectionRoutingSpec > get by ID routes to secondary datasource
PASSED
DataServiceConnectionRoutingSpec > count routes to secondary datasource
PASSED
DataServiceConnectionRoutingSpec > delete by ID routes to secondary
datasource - FindAndDeleteImplementer PASSED
DataServiceConnectionRoutingSpec > delete by ID routes to secondary
datasource - DeleteImplementer PASSED
DataServiceConnectionRoutingSpec > findByName routes to secondary datasource
PASSED
DataServiceConnectionRoutingSpec > findAllByName routes to secondary
datasource PASSED
DataServiceConnectionRoutingSpec > constructor-style save routes to
secondary datasource PASSED
DataServiceConnectionRoutingSpec > save, get, and find round-trip through
Data Service PASSED
DataServiceConnectionRoutingSpec > interface service: save routes to
secondary datasource PASSED
DataServiceConnectionRoutingSpec > interface service: get by ID routes to
secondary datasource PASSED
DataServiceConnectionRoutingSpec > interface service: delete routes to
secondary datasource PASSED
DataServiceConnectionRoutingSpec > interface service: void delete routes to
secondary datasource PASSED
DataServiceConnectionRoutingSpec > interface and abstract services share the
same datasource PASSED
DataServiceConnectionRoutingSpec > secondary data is not visible on default
datasource PASSED
DataServiceConnectionRoutingSpec > default data is not visible on secondary
datasource PASSED
Results: SUCCESS (16 tests, 16 successes, 0 failures, 0 skipped)
```
## Related
- Fixes #15394
- Follows pattern from #15418
- Tests ported from #15395
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]