Skip to content

Add granular console scopes integration tests#28189

Open
mpmadhavig wants to merge 1 commit into
wso2:masterfrom
mpmadhavig:granular-console-scopes-local
Open

Add granular console scopes integration tests#28189
mpmadhavig wants to merge 1 commit into
wso2:masterfrom
mpmadhavig:granular-console-scopes-local

Conversation

@mpmadhavig

Copy link
Copy Markdown
Contributor

Ports the granular console scopes integration tests from wso2-support/product-is#2175 to master.

Changes

  • New test: ConsoleGranularScopeTestCase — covers Console role permission resolution for granular application feature scopes (console:applications_create/_update/_delete) with use_granular_console_permissions toggled off and on.
  • SCIM2RestClient: added getV2Role(...) and getV2RolePermissions(...) helpers.
  • testng.xml: registered the test in an isolated block (it restarts the server to toggle the config and restores it afterwards).

Notes

  • The pom.xml dependency bumps from the source PR were not ported — those are 7.1.0-line patch builds. This branch is on a newer dependency line assumed to already contain the feature.

🤖 Generated with Claude Code

Ported from wso2-support/product-is#2175.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary

  • Added integration coverage for granular Console application permission scopes in enabled and disabled configuration modes.
  • Added SCIM2 role helpers for retrieving v2 role details and resolved permissions.
  • Registered the new test case in TestNG with isolated configuration lifecycle handling.

Walkthrough

Adds ConsoleGranularScopeTestCase to validate Console permission resolution with granular permissions disabled and enabled. Coverage includes legacy compatibility, single and combined granular scopes, duplicate prevention, and repeated retrieval stability. SCIM2RestClient now retrieves v2 roles and extracts permission values as sets. The new TestNG block executes the integration test.

Sequence Diagram(s)

sequenceDiagram
  participant TestCase
  participant ConfigManager
  participant IdentityServer
  participant SCIM2Client
  TestCase->>ConfigManager: Enable granular permission setting
  ConfigManager->>IdentityServer: Apply configuration
  TestCase->>IdentityServer: Graceful restart
  TestCase->>SCIM2Client: Create and retrieve Console role
  SCIM2Client->>IdentityServer: Request v2 role
  IdentityServer-->>SCIM2Client: Resolved permissions
  SCIM2Client-->>TestCase: Permission values
Loading

Suggested reviewers: yasasr1, ashanthamara

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding granular console scope integration tests.
Description check ✅ Passed The description is directly related to the changes and matches the added tests and helper updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/roles/v2/ConsoleGranularScopeTestCase.java (1)

117-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use Files.createTempFile and ensure deletion.

For better safety and to ensure cleanup, use Files.createTempFile and register it for deletion on exit. As per path instructions, this focuses on correctness and best practices.

♻️ Proposed fix
-        File enabledTomlFile = File.createTempFile("console-granular-enabled", ".toml");
-        Files.write(enabledTomlFile.toPath(), content.getBytes(StandardCharsets.UTF_8));
+        File enabledTomlFile = Files.createTempFile("console-granular-enabled", ".toml").toFile();
+        enabledTomlFile.deleteOnExit();
+        Files.write(enabledTomlFile.toPath(), content.getBytes(StandardCharsets.UTF_8));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/roles/v2/ConsoleGranularScopeTestCase.java`
around lines 117 - 118, Update the temporary-file setup in
ConsoleGranularScopeTestCase to use Files.createTempFile instead of
File.createTempFile, and register the created path for deletion on exit before
writing content. Preserve the existing UTF-8 file contents and enabled TOML test
flow.

Sources: Path instructions, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/roles/v2/ConsoleGranularScopeTestCase.java`:
- Around line 117-118: Update the temporary-file setup in
ConsoleGranularScopeTestCase to use Files.createTempFile instead of
File.createTempFile, and register the created path for deletion on exit before
writing content. Preserve the existing UTF-8 file contents and enabled TOML test
flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dffca029-62bf-4964-aabd-b99be0def367

📥 Commits

Reviewing files that changed from the base of the PR and between 19330ea and a1b540e.

📒 Files selected for processing (3)
  • modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/roles/v2/ConsoleGranularScopeTestCase.java
  • modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/SCIM2RestClient.java
  • modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml

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