-
Notifications
You must be signed in to change notification settings - Fork 2.2k
FINERACT-2380: move retrofit client based test to feign #5164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
ebd35e9 to
975c81c
Compare
e57c6b4 to
dde008c
Compare
|
|
||
| @RequestLine("POST /v1/external-asset-owners/transfers/{id}") | ||
| @Headers("Content-Type: application/json") | ||
| PostInitiateTransferResponse transferRequestWithIdWithBody(@Param("id") Long id, ExternalAssetOwnerRequest body, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these manually created *Extension interfaces created?
Are they there because of the Map parameter at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, openapi does not generate header parameter, so I needed a way to pass these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then I'd say don't do this but make the generation use a custom mustache template which generates the headers Map into the code. That's what we did for the retrofit clients too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9698a3d to
475e56b
Compare
|
|
||
| public Long applyForLoan(PostLoansRequest request) { | ||
| PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, null)); | ||
| PostLoansResponse response = ok(() -> fineractClient.loans().calculateLoanScheduleOrSubmitLoanApplication(request, (String) null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not required...right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's method overload issue unfortunately, it cannot figure the type of the second parameter
| .locale(LoanTestData.LOCALE); | ||
|
|
||
| ok(() -> fineractClient.businessDateManagement().updateBusinessDate(request, Collections.emptyMap())); | ||
| ok(() -> fineractClient.businessDateManagement().updateBusinessDate(null, request, Collections.emptyMap())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the first param that to be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is an idempotency key which is not needed here
| | 16 January 2024 | 10 January 2024 | 31 January 2024 | 10 January 2024 | true | | ||
|
|
||
| @TestRailId:C3318 @AdvancedPaymentAllocation | ||
| @Skip @TestRailId:C3318 @AdvancedPaymentAllocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be skipped, no?
| @Bean | ||
| public LoanProductsCustomApi loanProductsCustomApi() { | ||
| return fineractClient.createService(LoanProductsCustomApi.class); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not used?
a7b9637 to
acc2b50
Compare
| 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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be false default.
| 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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for default value.
| 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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for default value.
acc2b50 to
c0ee888
Compare
| * 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? I believe the event checker by default wait till it got the required event.
| private static final Duration STARTUP_TIMEOUT = Duration.ofSeconds(20); | ||
|
|
||
| @Before(order = 0) | ||
| public void waitForJmsListenerStartup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need readiness check two different places? I think it was already done once in ExternalEventSuiteInitializer, no?
c0ee888 to
d48889b
Compare
Description
Describe the changes made and why they were made.
Ignore if these details are present on the associated Apache Fineract JIRA ticket.
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.