Skip to content

fix(licensedb): add persistence for license and obligation sync#3851

Open
ADITYA-CODE-SOURCE wants to merge 6 commits intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:feature/3766-persistence-v2
Open

fix(licensedb): add persistence for license and obligation sync#3851
ADITYA-CODE-SOURCE wants to merge 6 commits intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:feature/3766-persistence-v2

Conversation

@ADITYA-CODE-SOURCE
Copy link
Contributor

Summary

  • Fix data persistence bug in LicenseDB sync endpoints
  • syncLicenses() and syncObligations() now persist data to database
  • Inject Sw360LicenseService and Sw360ObligationService for persistence

Changes

  • Added Sw360LicenseService and Sw360ObligationService as dependencies in LicenseDBService
  • Modified syncLicenses() to call sw360LicenseService.createLicense() for each license
  • Modified syncObligations() to call sw360ObligationService.createObligation() for each obligation
  • Handle duplicate/existing entries gracefully with warning logs

Testing

  • CI should pass
  • Manual testing: call /api/license-db/sync endpoint and verify data is persisted in database

Fixes #3766

…d service

- Add LicenseDBProperties.java with OAuth and connection config
- Add LicenseDbClient.java for LicenseDB REST API
- Add LicenseDbService.java for license/obligation sync
- Add LicenseDBConfig, LicenseDBController, LicenseDBRestClient, LicenseDBService
- Update SW360Constants and sw360.thrift with LICENSEDB enum
- Update sw360.properties in 3 locations
- Add LicenseDBConstantsTest.java unit tests
- Fix conflict in Sw360LicenseService.java

This is a clean implementation of LicenseDB integration for GSoC 2026.
No CI workflow changes or unrelated files included.
- Fix Sw360LicenseService.java syntax errors from conflict resolution
- Fix LicenseDBProperties.java to use correct constant name
- Remove non-existent setter calls from LicenseDbService.java
- Constants already exist in SW360Constants.java
- Restore uploadLicense method in Sw360LicenseService.java
- Add ObligationType and ObligationLevel imports to LicenseDBService.java
- Fix enum references to use correct class names instead of nested types
- Add import for times()
- Add import for verify()
- These were missing causing test compilation failure
- Add @ConditionalOnProperty to LicenseDBConfig, LicenseDBRestClient,
  LicenseDBService, and LicenseDBController
- This prevents Spring from trying to create LicenseDB beans when
  licensedb.enabled=false (default), fixing test context failures
- The RestTemplate bean is no longer required when LicenseDB is disabled
- Inject Sw360LicenseService and Sw360ObligationService
- Call createLicense() in syncLicenses() to persist licenses
- Call createObligation() in syncObligations() to persist obligations
- Handle duplicate/existing entries gracefully

Fixes eclipse-sw360#3766
@ADITYA-CODE-SOURCE
Copy link
Contributor Author

@GMishx @KoukiHama @arunazhakesan @ag4ums
Hello sir , could you please review this PR?
CI ✅
Fixes #3766 - LicenseDB sync endpoints now persist data to database.
Note: Builds on PR #3686 (LicenseDB integration).

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] LicenseDB Import REST endpoint does not persist data to SW360 database

2 participants