You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "budaidev (via GitHub)" <gi...@apache.org> on 2025/11/18 13:51:11 UTC

[PR] FINERACT-2380: move retrofit client based test to feign [fineract]

budaidev opened a new pull request, #5164:
URL: https://github.com/apache/fineract/pull/5164

   ## Description
   
   Describe the changes made and why they were made.
   
   Ignore if these details are present on the associated [Apache Fineract JIRA ticket](https://github.com/apache/fineract/pull/1284).
   
   ## Checklist
   
   Please make sure these boxes are checked before submitting your pull request - thanks!
   
   - [ ] Write the commit message as per https://github.com/apache/fineract/#pull-requests
   - [ ] 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 coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/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
   - [ ] Submission is not a "code dump".  (Large changes can be made "in repository" via a branch.  Ask on the developer mailing list for guidance, if required.)
   
   FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2556322116


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/support/FeignResponseHeaderHolder.java:
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.client.feign.support;
+
+import feign.Response;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Thread-local holder for the last Feign response headers. This is primarily used by E2E tests that need to assert on
+ * HTTP headers when using Feign clients that otherwise only expose the deserialized body.
+ */
+public final class FeignResponseHeaderHolder {

Review Comment:
   I’m concerned that using a ThreadLocal store may not be the right approach here. Since the header checks happen after the client call, the header values may already be removed or modified by that point.
   It would be safer to use the endpoints that return ApiResponse via the withHttpInformation methods, so we can retrieve both the response data and the headers directly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2545760647


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/ExternalAssetOwnersApiExtension.java:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.client.feign.services;
+
+import feign.Headers;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+import java.util.Map;
+import org.apache.fineract.client.models.ExternalAssetOwnerRequest;
+import org.apache.fineract.client.models.PostInitiateTransferResponse;
+
+public interface ExternalAssetOwnersApiExtension {
+
+    @RequestLine("POST /v1/external-asset-owners/transfers/{id}")
+    @Headers("Content-Type: application/json")
+    PostInitiateTransferResponse transferRequestWithIdWithBody(@Param("id") Long id, ExternalAssetOwnerRequest body,

Review Comment:
   yes, openapi does not generate header parameter, so I needed a way to pass these



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555937940


##########
fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties:
##########
@@ -31,12 +31,12 @@ fineract-test.testrail.username=${TESTRAIL_USERNAME:}
 fineract-test.testrail.password=${TESTRAIL_PASSWORD:}
 fineract-test.testrail.run-id=${TESTRAIL_RUN_ID:0}
 
-fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:}
+fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:tcp://localhost:63000}

Review Comment:
   No need for default value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2556322116


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/support/FeignResponseHeaderHolder.java:
##########
@@ -0,0 +1,44 @@
+/**
+ * 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.client.feign.support;
+
+import feign.Response;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+/**
+ * Thread-local holder for the last Feign response headers. This is primarily used by E2E tests that need to assert on
+ * HTTP headers when using Feign clients that otherwise only expose the deserialized body.
+ */
+public final class FeignResponseHeaderHolder {

Review Comment:
   i am having concerns whether it is wise to build and use such thing. The header checks occurs after the client was called, so header informations can be removed / changed already. 
   
   I think we should rather use the endpoints with "withHttpInformation" which return `ApiResponse` to retrieve not only the data, but header informations too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555940338


##########
fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties:
##########
@@ -31,12 +31,12 @@ fineract-test.testrail.username=${TESTRAIL_USERNAME:}
 fineract-test.testrail.password=${TESTRAIL_PASSWORD:}
 fineract-test.testrail.run-id=${TESTRAIL_RUN_ID:0}
 
-fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:}
+fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:tcp://localhost:63000}
 fineract-test.messaging.jms.broker-username=${ACTIVEMQ_BROKER_USERNAME:}
 fineract-test.messaging.jms.broker-password=${ACTIVEMQ_BROKER_PASSWORD:}
-fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:}
+fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:events}

Review Comment:
   No need for default value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555255808


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignBusinessDateHelper.java:
##########
@@ -45,7 +45,7 @@ public void updateBusinessDate(String type, String date) {
                 .dateFormat("yyyy-MM-dd")//
                 .locale(LoanTestData.LOCALE);
 
-        ok(() -> fineractClient.businessDateManagement().updateBusinessDate(request, Collections.emptyMap()));
+        ok(() -> fineractClient.businessDateManagement().updateBusinessDate(null, request, Collections.emptyMap()));

Review Comment:
   there is an idempotency key which is not needed here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2546045803


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/ExternalAssetOwnersApiExtension.java:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.client.feign.services;
+
+import feign.Headers;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+import java.util.Map;
+import org.apache.fineract.client.models.ExternalAssetOwnerRequest;
+import org.apache.fineract.client.models.PostInitiateTransferResponse;
+
+public interface ExternalAssetOwnersApiExtension {
+
+    @RequestLine("POST /v1/external-asset-owners/transfers/{id}")
+    @Headers("Content-Type: application/json")
+    PostInitiateTransferResponse transferRequestWithIdWithBody(@Param("id") Long id, ExternalAssetOwnerRequest body,

Review Comment:
   That`s also a good option, I was thinking about that. I had this solution because it was the least invasive, but in long term you are probably right about this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy merged PR #5164:
URL: https://github.com/apache/fineract/pull/5164


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2559139125


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java:
##########
@@ -83,111 +82,92 @@
 import org.apache.fineract.test.messaging.event.loan.transaction.LoanUndoContractTerminationBusinessEvent;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import retrofit2.Response;
 
 @Slf4j
 @Component
 @RequiredArgsConstructor
 public class EventCheckHelper {
 
     private static final DateTimeFormatter FORMATTER_EVENTS = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+    private static final long TRANSACTION_COMMIT_DELAY_MS = 500L;
 
     @Autowired
-    private ClientApi clientApi;
-    @Autowired
-    private LoansApi loansApi;
+    private FineractFeignClient fineractClient;
     @Autowired
     private EventAssertion eventAssertion;
     @Autowired
-    private ExternalAssetOwnersApi externalAssetOwnersApi;
-    @Autowired
     private GlobalConfigurationHelper configurationHelper;
+    @Autowired
+    private org.apache.fineract.test.messaging.config.EventProperties eventProperties;
+
+    private void waitForTransactionCommit() {
+        if (eventProperties.isEventVerificationEnabled() && TRANSACTION_COMMIT_DELAY_MS > 0) {
+            try {
+                Thread.sleep(TRANSACTION_COMMIT_DELAY_MS);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                throw new RuntimeException("Interrupted while waiting for transaction commit", e);
+            }
+        }
+    }

Review Comment:
   Yes, this was the case previously, but unfortunately on CI we have issues with these, which doesn't happen locally. This was the only solution which worked after many tries



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555702551


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/ExternalAssetOwnersApiExtension.java:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.client.feign.services;
+
+import feign.Headers;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+import java.util.Map;
+import org.apache.fineract.client.models.ExternalAssetOwnerRequest;
+import org.apache.fineract.client.models.PostInitiateTransferResponse;
+
+public interface ExternalAssetOwnersApiExtension {
+
+    @RequestLine("POST /v1/external-asset-owners/transfers/{id}")
+    @Headers("Content-Type: application/json")
+    PostInitiateTransferResponse transferRequestWithIdWithBody(@Param("id") Long id, ExternalAssetOwnerRequest body,

Review Comment:
   @budaidev are you planning to address this based on @galovics recommendations?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "galovics (via GitHub)" <gi...@apache.org>.
galovics commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2543687525


##########
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/ExternalAssetOwnersApiExtension.java:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.client.feign.services;
+
+import feign.Headers;
+import feign.Param;
+import feign.QueryMap;
+import feign.RequestLine;
+import java.util.Map;
+import org.apache.fineract.client.models.ExternalAssetOwnerRequest;
+import org.apache.fineract.client.models.PostInitiateTransferResponse;
+
+public interface ExternalAssetOwnersApiExtension {
+
+    @RequestLine("POST /v1/external-asset-owners/transfers/{id}")
+    @Headers("Content-Type: application/json")
+    PostInitiateTransferResponse transferRequestWithIdWithBody(@Param("id") Long id, ExternalAssetOwnerRequest body,

Review Comment:
   Why are these manually created *Extension interfaces created?
   
   Are they there because of the Map parameter at the end?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2549709832


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignLoanHelper.java:
##########
@@ -45,7 +45,7 @@ public Long createLoanProduct(PostLoanProductsRequest request) {
     }
 
     public Long applyForLoan(PostLoansRequest request) {
-        PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, null));
+        PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, (String) null));

Review Comment:
   this is not required...right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555253410


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignLoanHelper.java:
##########
@@ -45,7 +45,7 @@ public Long createLoanProduct(PostLoanProductsRequest request) {
     }
 
     public Long applyForLoan(PostLoansRequest request) {
-        PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, null));
+        PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, (String) null));

Review Comment:
   It's method overload issue unfortunately, it cannot figure the type of the second parameter 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2556341868


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/hook/MessagingHook.java:
##########
@@ -18,16 +18,50 @@
  */
 package org.apache.fineract.test.stepdef.hook;
 
+import static org.awaitility.Awaitility.await;
+
 import io.cucumber.java.Before;
+import java.time.Duration;
+import java.util.concurrent.atomic.AtomicBoolean;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.test.messaging.config.EventProperties;
 import org.apache.fineract.test.messaging.store.EventStore;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.config.JmsListenerEndpointRegistry;
+import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
+@Slf4j
 public class MessagingHook {
 
     @Autowired
     private EventStore eventStore;
 
-    @Before
+    @Autowired(required = false)
+    private JmsListenerEndpointRegistry registry;
+
+    @Autowired(required = false)
+    private EventProperties eventProperties;
+
+    private static final AtomicBoolean jmsStartupDelayCompleted = new AtomicBoolean(false);
+    private static final Duration STARTUP_TIMEOUT = Duration.ofSeconds(20);
+
+    @Before(order = 0)
+    public void waitForJmsListenerStartup() {

Review Comment:
   Do we need readiness check two different places? I think it was already done once in `ExternalEventSuiteInitializer`, no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2549711043


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignBusinessDateHelper.java:
##########
@@ -45,7 +45,7 @@ public void updateBusinessDate(String type, String date) {
                 .dateFormat("yyyy-MM-dd")//
                 .locale(LoanTestData.LOCALE);
 
-        ok(() -> fineractClient.businessDateManagement().updateBusinessDate(request, Collections.emptyMap()));
+        ok(() -> fineractClient.businessDateManagement().updateBusinessDate(null, request, Collections.emptyMap()));

Review Comment:
   what is the first param that to be `null`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2549711736


##########
fineract-e2e-tests-runner/src/test/resources/features/LoanReschedule.feature:
##########
@@ -701,7 +701,7 @@ Feature: LoanReschedule
       | rescheduleFromDate | submittedOnDate | adjustedDueDate | approvedOnDate  | enclosingTransaction |
       | 16 January 2024    | 10 January 2024 | 31 January 2024 | 10 January 2024 | true                 |
 
-  @TestRailId:C3318 @AdvancedPaymentAllocation
+  @Skip @TestRailId:C3318 @AdvancedPaymentAllocation

Review Comment:
   Should not be skipped, no?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2549712427


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java:
##########
@@ -105,11 +104,6 @@ public LoanProductsApi loanProductsApi() {
         return fineractClient.createService(LoanProductsApi.class);
     }
 
-    @Bean
-    public LoanProductsCustomApi loanProductsCustomApi() {
-        return fineractClient.createService(LoanProductsCustomApi.class);
-    }
-

Review Comment:
   Is this not used?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2559149443


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/hook/MessagingHook.java:
##########
@@ -18,16 +18,50 @@
  */
 package org.apache.fineract.test.stepdef.hook;
 
+import static org.awaitility.Awaitility.await;
+
 import io.cucumber.java.Before;
+import java.time.Duration;
+import java.util.concurrent.atomic.AtomicBoolean;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.fineract.test.messaging.config.EventProperties;
 import org.apache.fineract.test.messaging.store.EventStore;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.config.JmsListenerEndpointRegistry;
+import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
+@Slf4j
 public class MessagingHook {
 
     @Autowired
     private EventStore eventStore;
 
-    @Before
+    @Autowired(required = false)
+    private JmsListenerEndpointRegistry registry;
+
+    @Autowired(required = false)
+    private EventProperties eventProperties;
+
+    private static final AtomicBoolean jmsStartupDelayCompleted = new AtomicBoolean(false);
+    private static final Duration STARTUP_TIMEOUT = Duration.ofSeconds(20);
+
+    @Before(order = 0)
+    public void waitForJmsListenerStartup() {

Review Comment:
   that was again an attempted fix for the timing issue which only apply on the CI run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "budaidev (via GitHub)" <gi...@apache.org>.
budaidev commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2559145720


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/ApiConfiguration.java:
##########
@@ -105,11 +104,6 @@ public LoanProductsApi loanProductsApi() {
         return fineractClient.createService(LoanProductsApi.class);
     }
 
-    @Bean
-    public LoanProductsCustomApi loanProductsCustomApi() {
-        return fineractClient.createService(LoanProductsCustomApi.class);
-    }
-

Review Comment:
   Removed the whole file, since it was needed only for the retrofit client



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2556335156


##########
fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java:
##########
@@ -83,111 +82,92 @@
 import org.apache.fineract.test.messaging.event.loan.transaction.LoanUndoContractTerminationBusinessEvent;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import retrofit2.Response;
 
 @Slf4j
 @Component
 @RequiredArgsConstructor
 public class EventCheckHelper {
 
     private static final DateTimeFormatter FORMATTER_EVENTS = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+    private static final long TRANSACTION_COMMIT_DELAY_MS = 500L;
 
     @Autowired
-    private ClientApi clientApi;
-    @Autowired
-    private LoansApi loansApi;
+    private FineractFeignClient fineractClient;
     @Autowired
     private EventAssertion eventAssertion;
     @Autowired
-    private ExternalAssetOwnersApi externalAssetOwnersApi;
-    @Autowired
     private GlobalConfigurationHelper configurationHelper;
+    @Autowired
+    private org.apache.fineract.test.messaging.config.EventProperties eventProperties;
+
+    private void waitForTransactionCommit() {
+        if (eventProperties.isEventVerificationEnabled() && TRANSACTION_COMMIT_DELAY_MS > 0) {
+            try {
+                Thread.sleep(TRANSACTION_COMMIT_DELAY_MS);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                throw new RuntimeException("Interrupted while waiting for transaction commit", e);
+            }
+        }
+    }

Review Comment:
   Why do we need this? I believe the event checker by default wait till it got the required event. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] FINERACT-2380: move retrofit client based test to feign [fineract]

Posted by "adamsaghy (via GitHub)" <gi...@apache.org>.
adamsaghy commented on code in PR #5164:
URL: https://github.com/apache/fineract/pull/5164#discussion_r2555937075


##########
fineract-e2e-tests-core/src/test/resources/fineract-test-application.properties:
##########
@@ -31,12 +31,12 @@ fineract-test.testrail.username=${TESTRAIL_USERNAME:}
 fineract-test.testrail.password=${TESTRAIL_PASSWORD:}
 fineract-test.testrail.run-id=${TESTRAIL_RUN_ID:0}
 
-fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:}
+fineract-test.messaging.jms.broker-url=${ACTIVEMQ_BROKER_URL:tcp://localhost:63000}
 fineract-test.messaging.jms.broker-username=${ACTIVEMQ_BROKER_USERNAME:}
 fineract-test.messaging.jms.broker-password=${ACTIVEMQ_BROKER_PASSWORD:}
-fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:}
+fineract-test.messaging.jms.topic-name=${ACTIVEMQ_TOPIC_NAME:events}
 
-fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:false}
+fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:true}

Review Comment:
   This should be `false` default.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org