From 596110b1738a5a0f4721f51c1496286606e60b39 Mon Sep 17 00:00:00 2001 From: avinashvijayvargiya Date: Thu, 19 Mar 2026 02:36:08 +0530 Subject: [PATCH] FINERACT-2248: Migrate SearchHelper, NotificationHelper, TaxComponentHelper and TaxGroupHelper to fineract-client-feign --- .../integrationtests/NotificationApiTest.java | 31 ++++++------ .../integrationtests/SearchResourcesTest.java | 46 ++++++++---------- .../fineract/integrationtests/TaxesTest.java | 45 ++++++++++------- .../helpers/FeignNotificationHelper.java | 48 +++++++++++++++++++ .../feign/helpers/FeignSearchHelper.java | 38 +++++++++++++++ .../helpers/FeignTaxComponentHelper.java | 43 +++++++++++++++++ .../feign/helpers/FeignTaxGroupHelper.java | 48 +++++++++++++++++++ 7 files changed, 239 insertions(+), 60 deletions(-) create mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignNotificationHelper.java create mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignSearchHelper.java create mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxComponentHelper.java create mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxGroupHelper.java diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java index ea730bc8ae4..2cb205df313 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/NotificationApiTest.java @@ -26,14 +26,16 @@ import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import java.util.List; +import org.apache.fineract.client.feign.FineractFeignClient; import org.apache.fineract.client.models.GetNotification; import org.apache.fineract.client.models.GetNotificationsResponse; import org.apache.fineract.client.models.GetOfficesResponse; import org.apache.fineract.client.models.PostClientsRequest; import org.apache.fineract.client.models.PostUsersRequest; import org.apache.fineract.client.models.PostUsersResponse; +import org.apache.fineract.integrationtests.client.feign.helpers.FeignNotificationHelper; import org.apache.fineract.integrationtests.common.ClientHelper; -import org.apache.fineract.integrationtests.common.NotificationHelper; +import org.apache.fineract.integrationtests.common.FineractFeignClientHelper; import org.apache.fineract.integrationtests.common.OfficeHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.useradministration.users.UserHelper; @@ -46,11 +48,11 @@ public class NotificationApiTest { public static final int SUPER_USER_ID = 1; public static final String CLIENT_OBJECT_TYPE = "client"; public static final String CREATED_ACTION_TYPE = "created"; + private RequestSpecification requestSpec; private ResponseSpecification responseSpec; - - private RequestSpecification newUserRequestSpec; - private ResponseSpecification newUserResponseSpec; + private FeignNotificationHelper notificationHelper; + private FeignNotificationHelper newUserNotificationHelper; @BeforeEach public void setUp() { @@ -59,10 +61,12 @@ public void setUp() { requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); + notificationHelper = new FeignNotificationHelper(FineractFeignClientHelper.getFineractFeignClient()); + GetOfficesResponse headOffice = OfficeHelper.getHeadOffice(); String username = Utils.uniqueRandomStringGenerator("NotificationUser", 4); - String password = Utils.randomStringGenerator("A1b2c3d4e5f$", 1); // prefix is to conform with the password - // rules + String password = Utils.randomStringGenerator("A1b2c3d4e5f$", 1); + PostUsersRequest createUserRequest = new PostUsersRequest().username(username).firstname(Utils.randomFirstNameGenerator()) .lastname(Utils.randomLastNameGenerator()).email("whatever@mifos.org").password(password).repeatPassword(password) .sendPasswordToEmail(false).roles(List.of(SUPER_USER_ROLE_ID)).officeId(headOffice.getId()); @@ -70,32 +74,29 @@ public void setUp() { PostUsersResponse userCreationResponse = UserHelper.createUser(requestSpec, responseSpec, createUserRequest); Assertions.assertNotNull(userCreationResponse.getResourceId()); - newUserRequestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); - newUserRequestSpec.header("Authorization", - "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey(username, password)); - newUserResponseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); - + FineractFeignClient newUserClient = FineractFeignClientHelper.createNewFineractFeignClient(username, password); + newUserNotificationHelper = new FeignNotificationHelper(newUserClient); } @Test public void testNotificationRetrievalWorksWhenNoNotificationsAreAvailable() { // given // when - GetNotificationsResponse response = NotificationHelper.getNotifications(requestSpec, responseSpec); + GetNotificationsResponse response = notificationHelper.getNotifications(); // then Assertions.assertNotNull(response); } @Test public void testNotificationRetrievalWorksWhenOneNotificationIsAvailable() { - // given + // given (still using RestAssured-based ClientHelper - to be migrated separately) PostClientsRequest clientRequest = ClientHelper.defaultClientCreationRequest(); Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, clientRequest); Assertions.assertNotNull(clientId); // when - NotificationHelper.waitUntilNotificationsAreAvailable(newUserRequestSpec, newUserResponseSpec); - GetNotificationsResponse response = NotificationHelper.getNotifications(newUserRequestSpec, newUserResponseSpec); + newUserNotificationHelper.waitUntilNotificationsAreAvailable(); + GetNotificationsResponse response = newUserNotificationHelper.getNotifications(); // then Assertions.assertNotNull(response); List pageItems = response.getPageItems(); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java index bdb751034c3..8dc2bb49847 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SearchResourcesTest.java @@ -26,15 +26,14 @@ import io.restassured.http.ContentType; import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Map; import org.apache.fineract.client.models.GetClientsClientIdResponse; import org.apache.fineract.client.models.GetSearchResponse; import org.apache.fineract.client.models.PostClientsResponse; +import org.apache.fineract.integrationtests.client.feign.helpers.FeignSearchHelper; import org.apache.fineract.integrationtests.common.ClientHelper; -import org.apache.fineract.integrationtests.common.SearchHelper; +import org.apache.fineract.integrationtests.common.FineractFeignClientHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper; import org.apache.fineract.integrationtests.common.shares.ShareAccountHelper; @@ -48,6 +47,7 @@ public class SearchResourcesTest { private ResponseSpecification responseSpec; private RequestSpecification requestSpec; + private FeignSearchHelper searchHelper; @BeforeEach public void setup() { @@ -55,43 +55,41 @@ public void setup() { this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); + this.searchHelper = new FeignSearchHelper(FineractFeignClientHelper.getFineractFeignClient()); } @Test public void searchAnyValueOverAllResources() { - final List resources = Arrays.asList("clients", "clientIdentifiers", "groups", "savings", "shares", "loans"); + final String resources = "clients,clientIdentifiers,groups,savings,shares,loans"; final String query = Utils.randomStringGenerator("C", 12); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.TRUE, - resources.toString()); + final List searchResponse = searchHelper.search(query, resources, Boolean.TRUE); assertNotNull(searchResponse); assertEquals(0, searchResponse.size()); } @Test public void searchAnyValueOverClientResources() { - final List resources = Arrays.asList("clients"); + final String resources = "clients"; final String query = Utils.randomStringGenerator("C", 12); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.TRUE, - getResources(resources)); + final List searchResponse = searchHelper.search(query, resources, Boolean.TRUE); assertNotNull(searchResponse); assertEquals(0, searchResponse.size()); } @Test public void searchOverClientResources() { - final List resources = Arrays.asList("clients"); + final String resources = "clients"; - // Client and Loan account creation + // Client creation (still using RestAssured-based ClientHelper - to be migrated separately) String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null); final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload); final Long clientId = clientResponse.getClientId(); final GetClientsClientIdResponse getClientResponse = ClientHelper.getClient(requestSpec, responseSpec, clientId.intValue()); final String query = getClientResponse.getAccountNo(); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.FALSE, - getResources(resources)); + final List searchResponse = searchHelper.search(query, resources, Boolean.FALSE); assertNotNull(searchResponse); assertEquals(1, searchResponse.size()); assertEquals(getClientResponse.getDisplayName(), searchResponse.get(0).getEntityName(), "Client name comparation"); @@ -99,19 +97,19 @@ public void searchOverClientResources() { @Test public void searchAnyValueOverLoanResources() { - final List resources = Arrays.asList("loans"); + final String resources = "loans"; final String query = Utils.randomStringGenerator("L", 12); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.TRUE, - getResources(resources)); + final List searchResponse = searchHelper.search(query, resources, Boolean.TRUE); assertNotNull(searchResponse); assertEquals(0, searchResponse.size()); } @Test public void searchOverSavingsResources() { - final List resources = Arrays.asList("savings"); + final String resources = "savings"; + // Setup (still using RestAssured-based helpers - to be migrated separately) String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null); final PostClientsResponse clientResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload); final Long clientId = clientResponse.getClientId(); @@ -120,8 +118,7 @@ public void searchOverSavingsResources() { final SavingsAccountHelper savingsAccountHelper = new SavingsAccountHelper(requestSpec, responseSpec); final String query = (String) savingsAccountHelper.getSavingsAccountDetail(savingsId, "accountNo"); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.FALSE, - getResources(resources)); + final List searchResponse = searchHelper.search(query, resources, Boolean.FALSE); assertNotNull(searchResponse); assertEquals(1, searchResponse.size()); @@ -137,8 +134,9 @@ public void searchOverSavingsResources() { @Test public void searchOverSharesResources() { - final List resources = Arrays.asList("shares"); + final String resources = "shares"; + // Setup (still using RestAssured-based helpers - to be migrated separately) String jsonPayload = ClientHelper.getBasicClientAsJSON(ClientHelper.DEFAULT_OFFICE_ID, ClientHelper.LEGALFORM_ID_PERSON, null); final PostClientsResponse clientsResponse = ClientHelper.addClientAsPerson(requestSpec, responseSpec, jsonPayload); final Long clientId = clientsResponse.getClientId(); @@ -170,8 +168,7 @@ public void searchOverSharesResources() { responseSpec); final String query = (String) shareAccountData.get("accountNo"); - final ArrayList searchResponse = SearchHelper.getSearch(requestSpec, responseSpec, query, Boolean.FALSE, - getResources(resources)); + final List searchResponse = searchHelper.search(query, resources, Boolean.FALSE); assertNotNull(searchResponse); assertEquals(1, searchResponse.size()); @@ -184,9 +181,4 @@ public void searchOverSharesResources() { assertNotNull(result.getEntityStatus().getCode()); assertNotNull(result.getEntityStatus().getValue()); } - - private String getResources(final List resources) { - return String.join(",", resources); - } - } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/TaxesTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/TaxesTest.java index 57b557bd77c..16eb9b78247 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/TaxesTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/TaxesTest.java @@ -18,13 +18,14 @@ */ package org.apache.fineract.integrationtests; +import static org.apache.fineract.client.feign.util.FeignCalls.fail; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashSet; import java.util.List; import java.util.Set; +import org.apache.fineract.client.feign.util.CallFailedRuntimeException; import org.apache.fineract.client.models.GetTaxesComponentsResponse; import org.apache.fineract.client.models.GetTaxesGroupResponse; import org.apache.fineract.client.models.GetTaxesGroupTaxAssociations; @@ -33,29 +34,39 @@ import org.apache.fineract.client.models.PostTaxesGroupRequest; import org.apache.fineract.client.models.PostTaxesGroupResponse; import org.apache.fineract.client.models.PostTaxesGroupTaxComponents; -import org.apache.fineract.client.util.CallFailedRuntimeException; -import org.apache.fineract.integrationtests.common.TaxComponentHelper; -import org.apache.fineract.integrationtests.common.TaxGroupHelper; +import org.apache.fineract.integrationtests.client.feign.helpers.FeignTaxComponentHelper; +import org.apache.fineract.integrationtests.client.feign.helpers.FeignTaxGroupHelper; +import org.apache.fineract.integrationtests.common.FineractFeignClientHelper; import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.accounting.Account; import org.apache.fineract.integrationtests.common.accounting.AccountHelper; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class TaxesTest { + private FeignTaxComponentHelper taxComponentHelper; + private FeignTaxGroupHelper taxGroupHelper; + + @BeforeEach + public void setup() { + taxComponentHelper = new FeignTaxComponentHelper(FineractFeignClientHelper.getFineractFeignClient()); + taxGroupHelper = new FeignTaxGroupHelper(FineractFeignClientHelper.getFineractFeignClient()); + } + @Test public void createTaxComponentTest() { Long taxComponentId = createTaxComponentWithLiabilityToCredit("taxComponent"); - GetTaxesComponentsResponse taxComponentDetails = TaxComponentHelper.retrieveTaxComponent(taxComponentId); + GetTaxesComponentsResponse taxComponentDetails = taxComponentHelper.retrieveTaxComponent(taxComponentId); Assertions.assertNotNull(taxComponentDetails); Assertions.assertNotNull(taxComponentDetails.getId()); Assertions.assertEquals(taxComponentId, taxComponentDetails.getId()); taxComponentId = createTaxComponentWithLiabilityToDebit("taxComponent"); - taxComponentDetails = TaxComponentHelper.retrieveTaxComponent(taxComponentId); + taxComponentDetails = taxComponentHelper.retrieveTaxComponent(taxComponentId); Assertions.assertNotNull(taxComponentDetails); Assertions.assertNotNull(taxComponentDetails.getId()); Assertions.assertEquals(taxComponentId, taxComponentDetails.getId()); @@ -63,7 +74,7 @@ public void createTaxComponentTest() { @Test public void createTaxGroupTest() { - List allTaxGroups = TaxGroupHelper.retrieveAllTaxGroups(); + List allTaxGroups = taxGroupHelper.retrieveAllTaxGroups(); Assertions.assertNotNull(allTaxGroups); final Long taxComponentId = createTaxComponentWithLiabilityToCredit("taxComponent"); @@ -72,11 +83,11 @@ public void createTaxGroupTest() { taxComponentsSet.add(new PostTaxesGroupTaxComponents().taxComponentId(taxComponentId).startDate("01 January 2023")); final PostTaxesGroupRequest taxGroupRequest = new PostTaxesGroupRequest().name(Utils.randomStringGenerator("TAX_GRP_", 4)) .taxComponents(taxComponentsSet).dateFormat("dd MMMM yyyy").locale("en"); - final PostTaxesGroupResponse taxGroupResponse = TaxGroupHelper.createTaxGroup(taxGroupRequest); + final PostTaxesGroupResponse taxGroupResponse = taxGroupHelper.createTaxGroup(taxGroupRequest); Assertions.assertNotNull(taxGroupResponse); Assertions.assertNotNull(taxGroupResponse.getResourceId()); - final GetTaxesGroupResponse taxGroupDetails = TaxGroupHelper.retrieveTaxGroup(taxGroupResponse.getResourceId()); + final GetTaxesGroupResponse taxGroupDetails = taxGroupHelper.retrieveTaxGroup(taxGroupResponse.getResourceId()); Assertions.assertNotNull(taxGroupDetails); Assertions.assertEquals(taxGroupResponse.getResourceId(), taxGroupDetails.getId()); Assertions.assertFalse(taxGroupDetails.getTaxAssociations().isEmpty()); @@ -84,7 +95,7 @@ public void createTaxGroupTest() { Assertions.assertNotNull(taxAssociation); Assertions.assertEquals(taxComponentId, taxAssociation.getTaxComponent().getId()); - allTaxGroups = TaxGroupHelper.retrieveAllTaxGroups(); + allTaxGroups = taxGroupHelper.retrieveAllTaxGroups(); Assertions.assertNotNull(allTaxGroups); Assertions.assertTrue(allTaxGroups.size() > 0); } @@ -97,7 +108,7 @@ private Long createTaxComponentWithLiabilityToCredit(final String taxComponentPr .creditAccountType(Integer.valueOf(taxComponentGlAccount.getAccountType().toString())) .creditAccountId(taxComponentGlAccount.getAccountID().longValue()).dateFormat(Utils.DATE_FORMAT).locale(Utils.LOCALE); - final PostTaxesComponentsResponse taxComponentRespose = TaxComponentHelper.createTaxComponent(taxComponentRequest); + final PostTaxesComponentsResponse taxComponentRespose = taxComponentHelper.createTaxComponent(taxComponentRequest); Assertions.assertNotNull(taxComponentRespose); Assertions.assertNotNull(taxComponentRespose.getResourceId()); @@ -112,7 +123,7 @@ private Long createTaxComponentWithLiabilityToDebit(final String taxComponentPre .debitAccountType(Integer.valueOf(taxComponentGlAccount.getAccountType().toString())) .debitAccountId(taxComponentGlAccount.getAccountID().longValue()).dateFormat(Utils.DATE_FORMAT).locale(Utils.LOCALE); - final PostTaxesComponentsResponse taxComponentRespose = TaxComponentHelper.createTaxComponent(taxComponentRequest); + final PostTaxesComponentsResponse taxComponentRespose = taxComponentHelper.createTaxComponent(taxComponentRequest); Assertions.assertNotNull(taxComponentRespose); Assertions.assertNotNull(taxComponentRespose.getResourceId()); @@ -123,10 +134,9 @@ private Long createTaxComponentWithLiabilityToDebit(final String taxComponentPre void retrieveTaxGroupWithNonExistentId_shouldReturn404() { final Long nonExistentTaxGroupId = 99999L; - CallFailedRuntimeException exception = assertThrows(CallFailedRuntimeException.class, - () -> TaxGroupHelper.retrieveTaxGroup(nonExistentTaxGroupId)); + CallFailedRuntimeException exception = fail(() -> taxGroupHelper.retrieveTaxGroup(nonExistentTaxGroupId)); - assertEquals(404, exception.getResponse().code()); + assertEquals(404, exception.getStatus()); assertTrue(exception.getMessage().contains("error.msg.tax.group.id.invalid"), "Response should contain the error code for tax group not found"); } @@ -135,10 +145,9 @@ void retrieveTaxGroupWithNonExistentId_shouldReturn404() { void retrieveTaxComponentWithNonExistentId_shouldReturn404() { final Long nonExistentTaxComponentId = 99999L; - CallFailedRuntimeException exception = assertThrows(CallFailedRuntimeException.class, - () -> TaxComponentHelper.retrieveTaxComponent(nonExistentTaxComponentId)); + CallFailedRuntimeException exception = fail(() -> taxComponentHelper.retrieveTaxComponent(nonExistentTaxComponentId)); - assertEquals(404, exception.getResponse().code()); + assertEquals(404, exception.getStatus()); assertTrue(exception.getMessage().contains("error.msg.tax.component.id.invalid"), "Response should contain the error code for tax component not found"); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignNotificationHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignNotificationHelper.java new file mode 100644 index 00000000000..fb9464bc7e2 --- /dev/null +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignNotificationHelper.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.integrationtests.client.feign.helpers; + +import static org.apache.fineract.client.feign.util.FeignCalls.ok; +import static org.awaitility.Awaitility.await; + +import java.time.Duration; +import org.apache.fineract.client.feign.FineractFeignClient; +import org.apache.fineract.client.models.GetNotificationsResponse; + +public class FeignNotificationHelper { + + private final FineractFeignClient fineractClient; + + public FeignNotificationHelper(FineractFeignClient fineractClient) { + this.fineractClient = fineractClient; + } + + public GetNotificationsResponse getNotifications() { + return ok(() -> fineractClient.notification().getAllNotifications(null, null, null, null, null)); + } + + public boolean areNotificationsAvailable() { + return !getNotifications().getPageItems().isEmpty(); + } + + public void waitUntilNotificationsAreAvailable() { + await().atMost(Duration.ofSeconds(30)).pollInterval(Duration.ofSeconds(5)).pollDelay(Duration.ofSeconds(5)) + .until(this::areNotificationsAvailable); + } +} diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignSearchHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignSearchHelper.java new file mode 100644 index 00000000000..452a9be870f --- /dev/null +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignSearchHelper.java @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.integrationtests.client.feign.helpers; + +import static org.apache.fineract.client.feign.util.FeignCalls.ok; + +import java.util.List; +import org.apache.fineract.client.feign.FineractFeignClient; +import org.apache.fineract.client.models.GetSearchResponse; + +public class FeignSearchHelper { + + private final FineractFeignClient fineractClient; + + public FeignSearchHelper(FineractFeignClient fineractClient) { + this.fineractClient = fineractClient; + } + + public List search(String query, String resource, Boolean exactMatch) { + return ok(() -> fineractClient.search().searchData(query, resource, exactMatch)); + } +} diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxComponentHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxComponentHelper.java new file mode 100644 index 00000000000..603293a0ec1 --- /dev/null +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxComponentHelper.java @@ -0,0 +1,43 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.integrationtests.client.feign.helpers; + +import static org.apache.fineract.client.feign.util.FeignCalls.ok; + +import org.apache.fineract.client.feign.FineractFeignClient; +import org.apache.fineract.client.models.GetTaxesComponentsResponse; +import org.apache.fineract.client.models.PostTaxesComponentsRequest; +import org.apache.fineract.client.models.PostTaxesComponentsResponse; + +public class FeignTaxComponentHelper { + + private final FineractFeignClient fineractClient; + + public FeignTaxComponentHelper(FineractFeignClient fineractClient) { + this.fineractClient = fineractClient; + } + + public PostTaxesComponentsResponse createTaxComponent(PostTaxesComponentsRequest request) { + return ok(() -> fineractClient.taxComponents().createTaxComponent(request)); + } + + public GetTaxesComponentsResponse retrieveTaxComponent(Long taxComponentId) { + return ok(() -> fineractClient.taxComponents().retrieveTaxComponent(taxComponentId)); + } +} diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxGroupHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxGroupHelper.java new file mode 100644 index 00000000000..60f3af5a5ec --- /dev/null +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignTaxGroupHelper.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.integrationtests.client.feign.helpers; + +import static org.apache.fineract.client.feign.util.FeignCalls.ok; + +import java.util.List; +import org.apache.fineract.client.feign.FineractFeignClient; +import org.apache.fineract.client.models.GetTaxesGroupResponse; +import org.apache.fineract.client.models.PostTaxesGroupRequest; +import org.apache.fineract.client.models.PostTaxesGroupResponse; + +public class FeignTaxGroupHelper { + + private final FineractFeignClient fineractClient; + + public FeignTaxGroupHelper(FineractFeignClient fineractClient) { + this.fineractClient = fineractClient; + } + + public PostTaxesGroupResponse createTaxGroup(PostTaxesGroupRequest request) { + return ok(() -> fineractClient.taxGroup().createTaxGroup(request)); + } + + public GetTaxesGroupResponse retrieveTaxGroup(Long taxGroupId) { + return ok(() -> fineractClient.taxGroup().retrieveTaxGroup(taxGroupId)); + } + + public List retrieveAllTaxGroups() { + return ok(() -> fineractClient.taxGroup().retrieveAllTaxGroups()); + } +}