Skip to content

Java SDK Refresh - v25.0.0#1648

Merged
prachi-okta merged 68 commits intomasterfrom
increasing-code-coverage
Dec 23, 2025
Merged

Java SDK Refresh - v25.0.0#1648
prachi-okta merged 68 commits intomasterfrom
increasing-code-coverage

Conversation

@prachi-okta
Copy link
Copy Markdown
Contributor

@prachi-okta prachi-okta commented Sep 11, 2025

Pull Request: Release v25.0.0 - Major SDK Refactoring and Enhanced Test Coverage

📋 Summary

This PR introduces Okta Java SDK v25.0.0, a major release that significantly improves the SDK's architecture, test coverage, and developer experience based on the updated Okta Admin Management API (OpenAPI spec v5.1.0).


🎯 Key Highlights

Metric Value
Total Files Changed 81
Lines Added 49,132
Lines Removed 7,926
Net Lines +41,206
Total Commits 58
New Integration Test Files 28
New Unit Test Files 8
New Deserializers 9

Version Updates

Component Before After
SDK Version 24.x 25.0.0
OpenAPI Spec 2024.08.3 5.1.0
API YAML Lines 66,987 83,953 (+25%)

🔴 Breaking Changes

Summary

Category Affected Endpoints
User Object Schema 10+ endpoints
Authenticator APIs 12 endpoints
User Factor APIs 7 endpoints
Policy APIs 9 endpoints
Identity Provider APIs 7 endpoints
Role Assignment APIs 9 endpoints
Other APIs 20+ endpoints

Key Breaking Change: User Object Schema

The User object no longer includes the type property and its sub-properties in API responses.

Affected endpoints include:

  • GET /api/v1/users
  • POST /api/v1/users
  • GET /api/v1/groups/{groupId}/users
  • All user lifecycle operations

Migration Required: Applications using user.getType() must be updated. See MIGRATION-v25.0.0.md.


🆕 New Components

Custom Deserializers (9 Total)

Added to handle polymorphic API responses properly:

Deserializer Target Class Purpose
RoleAssignmentDeserializer ListGroupAssignedRoles200ResponseInner StandardRole/CustomRole polymorphism
AssignRoleToGroupResponseDeserializer AssignRoleToGroup200Response Group role assignments
AssignRoleToUserResponseDeserializer AssignRoleToUser201Response User role assignments
AssignRoleToClientResponseDeserializer AssignRoleToClient200Response Client role assignments
JwkResponseDeserializer ListJwk200ResponseInner JWK signing/encryption keys
GroupOwnerDeserializer GroupOwner Non-ISO-8601 date format handling
FlexibleOffsetDateTimeDeserializer OffsetDateTime Global flexible date parsing
AbstractRoleAssignmentDeserializer Base class Shared role assignment logic
IgnoreTypeInfoMixIn Mix-in Disables problematic @JsonTypeInfo

New Integration Test Suites (28 Total)

image

User Management APIs (12 Suites)

  • UserLifecycleIT.groovy - Lifecycle operations
  • UserCredIT.groovy - Password/credential operations
  • UserGrantIT.groovy - User grants management
  • UserOAuthIT.groovy - OAuth token operations
  • UserSessionsIT.groovy - Session management
  • UserLinkedObjectIT.groovy - Linked objects
  • UserResourcesIT.groovy - App links, assigned apps
  • UserAuthenticatorEnrollmentsIT.groovy - Authenticator enrollments
  • UserClassificationIT.groovy - User classification
  • UserRiskIT.groovy - Risk level operations
  • UserFactorIT.groovy - Factor enrollment/verification
  • UserTypeIT.groovy - User type management

Application APIs (9 Suites)

  • ApplicationGrantsIT.groovy - OAuth grants
  • ApplicationLogosIT.groovy - Logo management
  • ApplicationPoliciesIT.groovy - Policy assignments
  • ApplicationSSOIT.groovy - SSO operations
  • ApplicationSSOCredentialKeyIT.groovy - SSO credential keys
  • ApplicationSSOFederatedClaimIT.groovy - Federated claims
  • ApplicationTokensIT.groovy - Token management
  • ApplicationUsersIT.groovy - User assignments
  • OktaApplicationSettingsIT.groovy - App settings

Organization & Settings APIs (7 Suites)

  • AgentPoolsIT.groovy - Agent pool management
  • ApiServiceIntegrationsIT.groovy - Service integrations
  • ApiTokenIT.groovy - API token operations
  • GroupPushMappingIT.groovy - Group push mappings
  • ProfileMappingIT.groovy - Profile mappings
  • RealmsIT.groovy - Realm operations
  • PolicyCleanupIT.groovy - Policy cleanup utilities

New Unit Tests (8 Files)

Test File Coverage
RoleAssignmentDeserializerTest.java Deserializer logic (287 lines)
DPoPInterceptorTest.java DPoP authentication (379 lines)
RetryUtilTest.java Retry utilities (134 lines)
ApiExceptionHelperTest.java Exception handling (64 lines)
HelperConstantsTest.java Constants (64 lines)
PaginationUtilTest.java Pagination utilities (295 lines)

New Configuration Files

File Purpose
.mvn/jvm.config JVM settings for large YAML parsing (-Xmx2g)
.mvn/maven.config SnakeYAML codepoint limits

📊 Integration Test Coverage

Total Test Suites: 35

Category Count Key Operations
User Management 13 CRUD, lifecycle, credentials, sessions, grants
Application 10 CRUD, SSO, policies, users, tokens, logos
Groups 2 CRUD, owners, members, push mappings
Identity Providers 1 CRUD, lifecycle, users
Policies 2 CRUD, rules, cleanup
Organization 4 Agent pools, API tokens, service integrations
Other 3 Realms, profile mappings, pagination

Test Enhancements

  • Retry Logic: Added for flaky API operations (rate limiting, eventual consistency)
  • Cleanup Utilities: Proper test isolation and resource cleanup
  • Map Parameter Variants: Comprehensive coverage of API method overloads
  • Given-When-Then: Consistent test naming conventions

🔧 Technical Improvements

DefaultClientBuilder Updates

// Mix-ins registered for polymorphic types
mapper.addMixIn(ListGroupAssignedRoles200ResponseInner.class, IgnoreTypeInfoMixIn.class);
mapper.addMixIn(AssignRoleToClient200Response.class, IgnoreTypeInfoMixIn.class);
mapper.addMixIn(AssignRoleToGroup200Response.class, IgnoreTypeInfoMixIn.class);
mapper.addMixIn(AssignRoleToUser201Response.class, IgnoreTypeInfoMixIn.class);
mapper.addMixIn(ListJwk200ResponseInner.class, IgnoreTypeInfoMixIn.class);

// Custom deserializers registered
module.addDeserializer(ListGroupAssignedRoles200ResponseInner.class, new RoleAssignmentDeserializer());
module.addDeserializer(AssignRoleToClient200Response.class, new AssignRoleToClientResponseDeserializer());
module.addDeserializer(AssignRoleToGroup200Response.class, new AssignRoleToGroupResponseDeserializer());
module.addDeserializer(AssignRoleToUser201Response.class, new AssignRoleToUserResponseDeserializer());
module.addDeserializer(ListJwk200ResponseInner.class, new JwkResponseDeserializer());
module.addDeserializer(GroupOwner.class, new GroupOwnerDeserializer());
module.addDeserializer(OffsetDateTime.class, new FlexibleOffsetDateTimeDeserializer());

Pagination Improvements

New PagedIterable<T> class for automatic, thread-safe pagination:

// New recommended approach
PagedIterable<User> users = userApi.listUsersPagedIterable(null, null, 200, null, null, null, null);
for (User user : users) {
    System.out.println("User: " + user.getProfile().getLogin());
}
Feature Old (PaginationUtil) New (PagedIterable)
Thread Safety ❌ Shared state ✅ Isolated iterator
Memory ❌ Manual building ✅ Lazy loading
API ❌ do-while loops ✅ for-each loops

Note: PaginationUtil.getAfter() is deprecated (@Deprecated(forRemoval = true, since = "24.1.0"))

Code Quality Improvements

  • ✅ PMD violation fixes
  • ✅ Improved error handling in tests
  • ✅ Better test isolation and cleanup
  • ✅ Enhanced retry logic for API operations

📚 Documentation

New/Updated Files

Document Lines Purpose
MIGRATION-v25.0.0.md 467 Comprehensive breaking change documentation
CHANGELOG-v25.0.0.md New Full release notes
MIGRATION-GUIDE-v25.0.0.md New Step-by-step migration guide
README.md New README updates

🧪 Testing

Test Verification

  • All 35 integration test suites passing
  • All 8 unit test classes passing
  • Code examples in README verified for v25.x compatibility
  • Migration guide examples tested
  • Custom deserializers validated with real API responses

How to Test

# Run all tests
mvn clean test

# Run integration tests only
mvn -pl integration-tests test

# Run specific test suite
mvn -pl integration-tests test -Dtest=UsersIT

# Run with coverage
mvn clean test jacoco:report

🔄 Migration Path

  1. Review the detailed migration guide
  2. Identify code using changed endpoints (User, Authenticator, Factor, Policy, IdP)
  3. Update any dependencies on removed user.type properties
  4. Test thoroughly with the new SDK version
  5. Review custom deserializer behavior for role assignments
  6. Update error handling for new response codes

✅ Checklist

PR Checklist

  • Code follows project coding standards
  • Tests added for new functionality
  • All existing tests pass
  • Documentation updated
  • Breaking changes documented
  • Migration guide provided
  • CHANGELOG updated
  • No PMD violations
  • Version numbers updated

Files Changed Categories

Category Files Description
Deserializers 9 New custom Jackson deserializers
Integration Tests 35 New and updated test suites
Unit Tests 8 New and updated unit tests
Configuration 8 POM files, .mvn configs
Documentation 4 Migration guides, changelog
API Spec 1 Updated OpenAPI specification
Source Code 10+ DefaultClientBuilder, builders, etc.

🔗 Related Links

@prachi-okta prachi-okta reopened this Sep 18, 2025
@prachi-okta prachi-okta force-pushed the increasing-code-coverage branch from b24bf2f to f1d87b8 Compare October 31, 2025 08:02
- Added retry mechanism (3 attempts) for policy creation to handle E0000009 errors
- Similar to existing retry logic for policy replacement
- Handles intermittent Okta API server errors during policy creation
- Add serializeWithType() to GroupProfileSerializer to fix 'Type id handling
  not implemented for type GroupProfile' errors in GroupsIT and AppsIT tests
- Change UserGetSingleton to User in UsersIT and ClientProvider since getUser
  API returns User, not UserGetSingleton (fixes cast exceptions)
- Add try-catch for AssignRoleToUser response deserialization in roleAssignTest
  and groupTargetRoleTest to handle oneOf discriminator issues where StandardRole
  is not a subtype of AssignRoleToUser201Response
Copy link
Copy Markdown

@aniket-okta aniket-okta left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@prachi-okta prachi-okta merged commit 086d8b6 into master Dec 23, 2025
8 checks passed
@aniket-okta aniket-okta deleted the increasing-code-coverage branch December 23, 2025 09:03
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.

3 participants