Skip to content

Commit 0133a7b

Browse files
Dpk376claude
andcommitted
FINERACT-2441: Remove deprecated RestAssured methods and complete migration
- Migrated SearchResourcesTest to use feign-based ClientHelper.addClientAsPerson() - Migrated LoanAccountsContainsCurrencyFieldTest to use feign-based addClientAsPerson() and getClientAccounts() - Deleted 8 deprecated RestAssured helper methods from ClientHelper: addClientAsPerson(requestSpec, responseSpec, json) updateClient(requestSpec, responseSpec, externalId, json) deleteClient(requestSpec, responseSpec, externalId) getClientAccounts(requestSpec, responseSpec, externalId) getProposedTransferDate(requestSpec, responseSpec, externalId) getObligeeData(requestSpec, responseSpec, externalId) getBasicClientAsJSON(officeId, legalFormId, externalId) getClientByExternalId(requestSpec, responseSpec, externalId) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4216571 commit 0133a7b

3 files changed

Lines changed: 9 additions & 106 deletions

File tree

integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountsContainsCurrencyFieldTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ public void testGetClientLoanAccountsUsingExternalIdContainsCurrency() {
6666

6767
// given
6868
globalConfigurationHelper.manageConfigurations(GlobalConfigurationConstants.ENABLE_AUTO_GENERATED_EXTERNAL_ID, true);
69-
final String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON,
70-
null);
7169
// when
72-
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload);
70+
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(ClientHelper.DEFAULT_OFFICE_ID,
71+
ClientHelper.LEGALFORM_ID_PERSON, null);
7372
final String clientExternalId = clientResponse.getResourceExternalId();
7473
final long clientId = clientResponse.getClientId();
7574

@@ -81,8 +80,7 @@ public void testGetClientLoanAccountsUsingExternalIdContainsCurrency() {
8180
final Integer loanId = createLoanAccount(loanTransactionHelper, String.valueOf(clientId), String.valueOf(loanProductId),
8281
formattedDate);
8382

84-
GetClientsClientIdAccountsResponse clientAccountsResponse = ClientHelper.getClientAccounts(requestSpec, responseSpec,
85-
clientExternalId);
83+
GetClientsClientIdAccountsResponse clientAccountsResponse = ClientHelper.getClientAccounts(clientExternalId);
8684

8785
if (clientAccountsResponse.getLoanAccounts() == null) {
8886
// Handle the case where getClientAccounts returned null

integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public void searchOverClientResources() {
8484
final List<String> resources = Arrays.asList("clients");
8585

8686
// Client and Loan account creation
87-
String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null);
88-
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload);
87+
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(ClientHelper.DEFAULT_OFFICE_ID,
88+
ClientHelper.LEGALFORM_ID_PERSON, null);
8989
final Long clientId = clientResponse.getClientId();
9090
final GetClientsClientIdResponse getClientResponse = ClientHelper.getClient(requestSpec, responseSpec, clientId.intValue());
9191
final String query = getClientResponse.getAccountNo();
@@ -112,8 +112,8 @@ public void searchAnyValueOverLoanResources() {
112112
public void searchOverSavingsResources() {
113113
final List<String> resources = Arrays.asList("savings");
114114

115-
String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null);
116-
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload);
115+
final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(ClientHelper.DEFAULT_OFFICE_ID,
116+
ClientHelper.LEGALFORM_ID_PERSON, null);
117117
final Long clientId = clientResponse.getClientId();
118118

119119
final Integer savingsId = SavingsAccountHelper.openSavingsAccount(requestSpec, responseSpec, clientId.intValue(), "1000");
@@ -139,8 +139,8 @@ public void searchOverSavingsResources() {
139139
public void searchOverSharesResources() {
140140
final List<String> resources = Arrays.asList("shares");
141141

142-
String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null);
143-
final PostClientsResponse clientsResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload);
142+
final PostClientsResponse clientsResponse = ClientHelper.addClientAsPerson(ClientHelper.DEFAULT_OFFICE_ID,
143+
ClientHelper.LEGALFORM_ID_PERSON, null);
144144
final Long clientId = clientsResponse.getClientId();
145145

146146
final ShareProductHelper shareProductHelper = new ShareProductHelper();

integration-tests/src/test/java/org/apache/fineract/integrationtests/common/ClientHelper.java

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -182,83 +182,12 @@ public PageClientSearchData searchClients(PagedRequestClientTextSearch request)
182182
return Calls.ok(FineractClientHelper.getFineractClient().clientSearchV2.searchClientsByText(request));
183183
}
184184

185-
// TODO: Rewrite to use fineract-client instead!
186-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
187-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
188-
@Deprecated(forRemoval = true)
189-
public static PostClientsResponse addClientAsPerson(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
190-
final String jsonPayload) {
191-
final String response = Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, jsonPayload);
192-
log.info("{}", response);
193-
return GSON.fromJson(response, PostClientsResponse.class);
194-
}
195-
196-
// TODO: Rewrite to use fineract-client instead!
197-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
198-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
199-
@Deprecated(forRemoval = true)
200-
public static PutClientsClientIdResponse updateClient(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
201-
final String externalId, final String jsonPayload) {
202-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "?" + Utils.TENANT_IDENTIFIER;
203-
final String response = Utils.performServerPut(requestSpec, responseSpec, url, jsonPayload);
204-
log.info("{}", response);
205-
return GSON.fromJson(response, PutClientsClientIdResponse.class);
206-
}
207-
208-
// TODO: Rewrite to use fineract-client instead!
209-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
210-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
211-
@Deprecated(forRemoval = true)
212-
public static DeleteClientsClientIdResponse deleteClient(final RequestSpecification requestSpec,
213-
final ResponseSpecification responseSpec, final String externalId) {
214-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "?" + Utils.TENANT_IDENTIFIER;
215-
final String response = Utils.performServerDelete(requestSpec, responseSpec, url, Utils.emptyJson(), null);
216-
log.info("{}", response);
217-
return GSON.fromJson(response, DeleteClientsClientIdResponse.class);
218-
}
219-
220-
// TODO: Rewrite to use fineract-client instead!
221-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
222-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
223-
@Deprecated(forRemoval = true)
224-
public static GetClientsClientIdAccountsResponse getClientAccounts(final RequestSpecification requestSpec,
225-
final ResponseSpecification responseSpec, final String externalId) {
226-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "/accounts?" + Utils.TENANT_IDENTIFIER;
227-
final String response = Utils.performServerGet(requestSpec, responseSpec, url);
228-
log.info("{}", response);
229-
return GSON.fromJson(response, GetClientsClientIdAccountsResponse.class);
230-
}
231-
232185
public static String getClientAccountsRaw(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
233186
final long clientId) {
234187
final String url = CLIENT_URL + "/" + clientId + "/accounts?" + Utils.TENANT_IDENTIFIER;
235188
return Utils.performServerGet(requestSpec, responseSpec, url);
236189
}
237190

238-
// TODO: Rewrite to use fineract-client instead!
239-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
240-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
241-
@Deprecated(forRemoval = true)
242-
public static GetClientTransferProposalDateResponse getProposedTransferDate(final RequestSpecification requestSpec,
243-
final ResponseSpecification responseSpec, final String externalId) {
244-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "/transferproposaldate?" + Utils.TENANT_IDENTIFIER;
245-
final String response = Utils.performServerGet(requestSpec, responseSpec, url);
246-
log.info("{}", response);
247-
return GSON.fromJson(response, GetClientTransferProposalDateResponse.class);
248-
}
249-
250-
// TODO: Rewrite to use fineract-client instead!
251-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
252-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
253-
@Deprecated(forRemoval = true)
254-
public static List<GetObligeeData> getObligeeData(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
255-
final String externalId) {
256-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "/obligeedetails?" + Utils.TENANT_IDENTIFIER;
257-
final String response = Utils.performServerGet(requestSpec, responseSpec, url);
258-
log.info("{}", response);
259-
return GSON.fromJson(response, new TypeToken<List<GetObligeeData>>() {}.getType());
260-
}
261-
262191
// TODO: Rewrite to use fineract-client instead!
263192
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
264193
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
@@ -501,19 +430,6 @@ public static HashMap<String, Object> setInitialClientValues(final String office
501430
return map;
502431
}
503432

504-
// TODO: Rewrite to use fineract-client instead!
505-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
506-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
507-
@Deprecated(forRemoval = true)
508-
public static String getBasicClientAsJSON(final String officeId, final Long legalFormId, final String externalId) {
509-
HashMap<String, Object> map = setInitialClientValues(officeId, legalFormId, externalId);
510-
map.put("active", "true");
511-
map.put("activationDate", DEFAULT_DATE);
512-
final String basicClientAsJson = GSON.toJson(map);
513-
log.info("Client JSON : {}", basicClientAsJson);
514-
return basicClientAsJson;
515-
}
516-
517433
// TODO: Rewrite to use fineract-client instead!
518434
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
519435
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
@@ -685,17 +601,6 @@ public static GetClientsClientIdResponse getClient(final RequestSpecification re
685601
return GSON.fromJson(clientResponseStr, GetClientsClientIdResponse.class);
686602
}
687603

688-
// TODO: Rewrite to use fineract-client instead!
689-
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
690-
// org.apache.fineract.client.models.PostLoansLoanIdRequest)
691-
@Deprecated(forRemoval = true)
692-
public static GetClientsClientIdResponse getClientByExternalId(final RequestSpecification requestSpec,
693-
final ResponseSpecification responseSpec, final String externalId) {
694-
final String url = CLIENT_EXTERNALID_URL + "/" + externalId + "?" + Utils.TENANT_IDENTIFIER;
695-
final String response = Utils.performServerGet(requestSpec, responseSpec, url);
696-
return GSON.fromJson(response, GetClientsClientIdResponse.class);
697-
}
698-
699604
// TODO: Rewrite to use fineract-client instead!
700605
// Example: org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper.disburseLoan(java.lang.Long,
701606
// org.apache.fineract.client.models.PostLoansLoanIdRequest)

0 commit comments

Comments
 (0)