Skip to content

FINERACT-2718: Migrate group center tests to feign - #6194

Open
DeathGun44 wants to merge 6 commits into
apache:developfrom
DeathGun44:FINERACT-2718/migrate-group-center-tests-to-feign
Open

FINERACT-2718: Migrate group center tests to feign#6194
DeathGun44 wants to merge 6 commits into
apache:developfrom
DeathGun44:FINERACT-2718/migrate-group-center-tests-to-feign

Conversation

@DeathGun44

@DeathGun44 DeathGun44 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Migrates the group and center integration tests from the old REST-assured HTTP client to the typed Feign SDK client

Why

The old tests call the server with hand-written REST-assured requests and read untyped JSON. Moving them onto the generated Feign client gives typed requests and responses, so the tests are safer to change and consistent with the rest of the migrated suite.

What changed

Test classes migrated

  • CenterIntegrationTest
  • GroupTest
  • GroupLoanIntegrationTest

New typed helpers:

  • FeignGroupHelper, FeignCenterHelper, FeignStaffHelper, FeignGlimHelper

Removed the old stopgap:

  • Deleted FeignGroupCenterHelper (a raw-HTTP helper from an earlier PR) and repointed its two users LoanReschedulingWithinCenterTest and ExternalIdSupportIntegrationTest - at the new typed helpers.

Production change (minimal, additive):

  • Added the missing fields to PostGroupsRequest and PostCentersRequest in the Swagger DTOs so groups and centers can be created through the typed model. These are additive only - the API wire format is unchanged.

Production change (minimal, additive):

  • Added the missing fields to the Swagger DTOs so groups, centers, clients and loans can be driven through the typed model: the creation fields, the ?command=... request fields, the changes objects those commands return, the retrieval fields the tests assert on, and the group / GLIM fields on the loan application and approve bodies. Touches GroupsApiResourceSwagger, CentersApiResourceSwagger, ClientsApiResourceSwagger and LoansApiResourceSwagger.
  • These are additive only - no field removed, no type or required changed, and the API wire format is unchanged. The backward-compatibility check against develop reports no breaking changes.

Raw HTTP is gone

No FeignRawHttpHelper and no REST-assured remain in the migrated code - every request and response goes through the generated Feign models, including the ?command=... endpoints and the GLIM application / approve / retrieval flow. Retrieval no longer needs the REST-assured-era CenterDomain POJO either.

One case is still bound by hand, but stays typed: GET /centers and GET /groups return a plain JSON array unless paged=true, and an operation can only declare one response schema (the paged one), so the generated retrieveAllCenters / retrieveAllGroups can't decode the array. Rather than document the endpoint incorrectly, those requests are bound to the generated page-item models through a small Feign interface, NonPagedListingApi - the same pattern as the existing InternalExternalEventsApi.

paged=true is not an equivalent substitute there: retrievePagedAll ignores orphansOnly, so the paged variant returns every group of the office. That is documented on the interface.

No assertion was weakened and no REST-assured was introduced.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per our guidelines
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow our coding conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • This PR must not be a "code dump". Large changes can be made in a branch, with assistance. Ask for help on the developer mailing list.
  • If merging this PR resolves a JIRA issue, I will mark that issue as resolved and set "Fix Version/s" appropriately.

Your assigned reviewer(s) will follow our guidelines for code reviews.

@DeathGun44
DeathGun44 force-pushed the FINERACT-2718/migrate-group-center-tests-to-feign branch from 03827d9 to 293ee66 Compare July 28, 2026 10:41
Aman-Mittal
Aman-Mittal previously approved these changes Jul 30, 2026

@Aman-Mittal Aman-Mittal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code wise seems ok

@Aman-Mittal Aman-Mittal added the java Pull requests that update Java code label Jul 30, 2026

@adamsaghy adamsaghy 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.

Why the FeignRawHttpHelper usages? We would like to avoid serializing back and forth json objects...

@DeathGun44
DeathGun44 force-pushed the FINERACT-2718/migrate-group-center-tests-to-feign branch from 293ee66 to d57728e Compare August 3, 2026 13:35
@adamsaghy

Copy link
Copy Markdown
Contributor

@DeathGun44 Please rebase

… swagger DTOs

Document the fields the group, center and client command endpoints already accept
and the changes objects they already return, plus the group and GLIM fields of the
loan application and approval bodies, so the generated client can express them
without hand-built json.

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
Delete the FeignGroupCenterHelper stopgap and repoint its callers at the typed
helpers. The group and center helpers themselves no longer build json by hand
either: every command, retrieval and update goes through the generated client, and
the two listings the openapi schema cannot describe go through a typed feign
interface bound to the generated page item models.

Signed-off-by: DeathGun44 <krishnamewara841@gmail.com>
@DeathGun44
DeathGun44 force-pushed the FINERACT-2718/migrate-group-center-tests-to-feign branch from d57728e to cc5a6a9 Compare August 3, 2026 14:21
@DeathGun44

Copy link
Copy Markdown
Contributor Author

Why the FeignRawHttpHelper usages? We would like to avoid serializing back and forth json objects...

Done!
One thing I couldn't express in the spec. GET /centers and GET /groups return a plain JSON array unless you pass paged=true, but an operation can only declare one response schema (the paged one), so the generated client can't decode the array. Rather than document the endpoint incorrectly, I bound those requests to the generated page-item models through a small Feign interface (NonPagedListingApi) - same pattern as the existing InternalExternalEventsApi. Still fully typed, no JSON parsing.

To be straight about it, only one of its three methods is really forced:

  • listOrphanGroups has to stay non-paged, because retrievePagedAll ignores orphansOnly. I checked against a running server: after attaching every group of an office to a center, the non-paged call returns [] while the paged call returns both groups with centerId set. That looks like a server-side inconsistency - happy to raise a separate ticket if you agree.

  • The two center listings could use paged=true. I kept them non-paged only so testListCenters still compares the two shapes rather than comparing a call to itself. Glad to switch if you'd rather.
    I also relaxed testListCenters to compare by id - neither branch applies an ORDER BY unless you ask for one, so the element-wise comparison was passing by luck.

Rebased onto current develop

@DeathGun44

DeathGun44 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

the test seems flaky, also updated the pr description

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

Labels

java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants