Skip to content

Implement "all" endpoints supporting to configure whole instances#222

Draft
pathob wants to merge 11 commits into
mainfrom
all-endpoints
Draft

Implement "all" endpoints supporting to configure whole instances#222
pathob wants to merge 11 commits into
mainfrom
all-endpoints

Conversation

@pathob
Copy link
Copy Markdown
Contributor

@pathob pathob commented May 9, 2025

No description provided.

@pathob pathob changed the base branch from main to prepare-1.0 June 2, 2025 21:49
@pathob pathob force-pushed the prepare-1.0 branch 2 times, most recently from 409ad69 to d34c610 Compare June 5, 2025 14:46
Base automatically changed from prepare-1.0 to main June 24, 2025 22:52
@pathob pathob force-pushed the all-endpoints branch 3 times, most recently from 6ce4812 to 95d6b8d Compare July 8, 2025 22:00
@pathob pathob force-pushed the all-endpoints branch 2 times, most recently from e10fca3 to 972184b Compare February 22, 2026 11:35
@deftdevs deftdevs deleted a comment from sonarqubecloud Bot Feb 22, 2026
@pathob pathob force-pushed the all-endpoints branch 2 times, most recently from b29c8d8 to 98c8bbf Compare February 24, 2026 13:14
@deftdevs deftdevs deleted a comment from sonarqubecloud Bot Feb 24, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
14.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

pathob and others added 6 commits May 18, 2026 19:32
…tion

- Add map-based setLicenses overload (key → LicenseModel) to LicensesService API
  and all three product implementations; response keys are redacted via
  LicenseKeyRedactor (first4...last4#hash4 format)
- Introduce LicenseKeyRedactor utility with SHA-1-based key redaction and tests
- Refactor _AbstractAllServiceImpl: generalize setEntity to <I,O>, sanitize
  exception details to only expose messages from mapped WebApplicationExceptions
- Sweep all three _AllServiceImpl files to use static BootstrAPI constants
  exclusively (remove reflection-based entityType() helpers)
- Add _AllResourceTest for Jira and Confluence mirroring Crowd's test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pathob and others added 5 commits May 19, 2026 14:43
…er/setAuthentication

- Add default setMailServer/getMailServer to MailServerService delegating to smtp/pop
- Add default setAuthentication/getAuthentication to AuthenticationService delegating to idps/sso
- Add setSettings/getSettings to JiraSettingsService as default methods
- Extend ConfluenceSettingsService to also include SettingsBrandingService;
  introduce ConfluenceSettingsServiceImpl composing SettingsServiceImpl + SettingsBrandingServiceImpl
- Introduce CrowdSettingsService unifying CrowdSettingsGeneralService + CrowdSettingsBrandingService;
  introduce CrowdSettingsServiceImpl composing both
- Reduce _AllServiceImpl in all three products to flat single setEntity calls per top-level section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Composite service methods (setSettings, setMailServer, setAuthentication)
now return ServiceResult<T> carrying both the result model and a sub-map
of per-field status entries. _AbstractAllServiceImpl.setEntityWithStatus
merges these sub-maps into the top-level status map, so the PUT / response
exposes fine-grained keys like settings/general, mail-server/smtp, and
authentication/idps rather than a single coarse entry per composite.

ServiceResultUtil extracts entityType() and toErrorStatus() as public
statics so service interfaces can use them without depending on the
abstract class. AbstractAuthenticationIdpModel gains an explicit
@XmlRootElement name to enable the same key derivation for the idps entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bug fixes
- Fix NPE in ServiceResultUtil.toErrorStatus for non-standard HTTP codes
  (e.g. 422, 429) by accepting an int status code on _AllModelStatus.error.
- Wrap the composite call in _AbstractAllServiceImpl.setEntityWithStatus
  so a thrown exception inside setSettings/setMailServer/setAuthentication
  no longer kills the entire setAll; the failure is attributed to the
  top-level group derived from the input's @XmlRootElement.
- Log non-WAE exceptions server-side before sanitizing them out of the
  client response.
- Fix Jira LicensesServiceImpl.setLicenses(Map) to call addLicense
  per-key like Confluence/Crowd. The previous implementation paired
  input keys with JiraLicenseManager.getLicenses() entries by index,
  but the API makes no ordering guarantee.
- Fix Crowd and Confluence ServiceConfig to call existing bean methods
  instead of `new`-ing duplicate instances for the composite settings
  service (CGLIB caching was being bypassed).
- Fix copy-paste in BootstrAPI.SETTINGS_GENERAL_PUT_RESPONSE_DESCRIPTION.

Status-key convention
- Split the formerly-overloaded entityType() into two named operations:
  entityType(Class) returns the raw @XmlRootElement.name (used for
  top-level keys like mail-templates, session-config) and
  subEntityKey(Class) splits on the last dash for sub-field keys like
  settings/general, mail-server/smtp, permissions/global. This removes
  the silent transform that was incorrectly mapping mail-templates to
  mail/templates.
- Rewrite _AbstractAllResourceImpl.computeOverallStatus to use 207
  Multi-Status for mixed outcomes, 500 for any 5xx, the common 4xx
  when all client errors agree, and 200 otherwise.

Design cleanup
- Have Confluence's SettingsServiceImpl implement SettingsGeneralService
  and SettingsSecurityService (it had no interface before).
- Have Crowd's CrowdSettingsServiceImpl take interfaces, not concrete
  impl types, in its constructor.
- Remove the unused MailServerModel.EXAMPLE_1 and stale imports across
  the three _AllServiceImpl files.

Docs
- Fix _AllModel.md in all three products: licenses is a Map, not a List.
- Fix AllApi.md in all three products: the response body is _AllModel
  (with the status map and redacted license keys), not empty.

Tests (+22, all passing)
- New ServiceResultUtilTest covers entityType, subEntityKey edge cases,
  the NPE fix, and exception sanitization.
- New _AbstractAllResourceImplTest covers the new aggregation logic.
- LicensesServiceTest gets a Jira-specific test verifying redaction and
  per-key pairing for the new setLicenses(Map) overload.
- Rename Crowd AllResourceTest -> _AllResourceTest for naming parity
  with Jira/Confluence; add status-aggregation tests to all three.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)
11.9% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant