-
Notifications
You must be signed in to change notification settings - Fork 2.1k
FINERACT-2380: create feign client #5082
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
a1ab808
to
06c3fc3
Compare
fineract-client-feign/build.gradle
Outdated
|
||
doFirst { | ||
delete fileTree(tempDir) { | ||
include "src/main/java/org/apache/fineract/client/auth/OAuthOkHttpClient.java" |
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 still needed?
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.
removed
fineract-client-feign/build.gradle
Outdated
into targetDir | ||
filter { line -> | ||
line | ||
.replaceAll("import org\\.joda\\.time\\.\\*;", "") |
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 still needed?
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.
removed, we don't need to support java 8 anyway
fineract-client-feign/build.gradle
Outdated
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
options.encoding = 'UTF-8' | ||
options.compilerArgs << '-parameters' | ||
options.errorprone { | ||
excludedPaths = '.*/build/generated/java/src/main/java/.*' | ||
} |
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 still needed?
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.
removed
...-client-feign/src/main/java/org/apache/fineract/client/feign/services/DocumentsApiFixed.java
Show resolved
Hide resolved
fineract-client-feign/src/main/java/org/apache/fineract/client/feign/services/ImagesApi.java
Show resolved
Hide resolved
...ract-client-feign/src/main/java/org/apache/fineract/client/feign/services/RunReportsApi.java
Show resolved
Hide resolved
* Swagger YAML generation from the JAX RS and OpenAPI annotation to have the correct notation for binary document files | ||
* and images, then this could be removed again. | ||
*/ | ||
public interface DocumentsApiFixed { |
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.
Duplicate?
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.
removed duplicate
* in DefaultApi (see <a href="https://issues.apache.org/jira/browse/FINERACT-1222">FINERACT-1222</a>), but fixed for | ||
* bugs in the code generation (see <a href="https://issues.apache.org/jira/browse/FINERACT-1227">FINERACT-1227</a>). | ||
*/ | ||
public interface ImagesApi { |
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.
Duplicate?
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.
removed duplicate
import java.util.Map; | ||
import org.apache.fineract.client.models.RunReportsResponse; | ||
|
||
public interface RunReportsApi { |
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.
Duplicate?
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.
removed duplicate
*/ | ||
@Slf4j | ||
@Getter | ||
public class CallFailedRuntimeException extends RuntimeException { |
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.
Duplicate?
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.
removed duplicate
/** | ||
* Extension methods for Feign calls. This class is recommended to be statically imported. | ||
*/ | ||
public final class FeignCalls { |
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.
Duplicate?
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.
removed duplicate
* {@link DocumentsApiFixed#updateDocument(String, Long, Long, File, String, String)} and | ||
* {@link ImagesApi#create(String, Long, File)} and {@link ImagesApi#update(String, Long, File)}. | ||
*/ | ||
public final class Parts { |
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 still required?
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, removed it
private static final long serialVersionUID = 141481953116476081L; | ||
|
||
@Column(name = CREATED_BY_DB_FIELD, updatable = false, nullable = false) | ||
@Setter(onMethod_ = @Override) |
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.
any reason to remove these?
String waitForFineractTimeoutSeconds = project.findProperty('waitForFineractTimeoutSeconds') ?: '600' | ||
String waitForFineractCommand = "timeout ${waitForFineractTimeoutSeconds} bash -c 'until curl -k -s --fail \"https://localhost:8443/fineract-provider/actuator/health\" > /dev/null; do sleep 5; echo \"Waiting for Fineract startup...\"; done'" | ||
|
||
tasks.register('waitForFineract') { | ||
doLast { | ||
exec { | ||
commandLine 'bash', '-lc', waitForFineractCommand | ||
} | ||
} | ||
} |
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.
Any reason for 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.
For integration tests we need to wait for the cargo instance to be start, if it is not included it will send the request before the service started. The Retrofit based client worked because it kept retrying
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 would not work if someone tries to run it on windows, no?
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.
Can we have something like this instead?
import java.net.HttpURLConnection
import java.net.URL
tasks.register('waitForFineract') {
doLast {
int timeoutSeconds = (project.findProperty('waitForFineractTimeoutSeconds') ?: '600') as int
int waited = 0
int interval = 5
URL url = new URL("https://localhost:8443/fineract-provider/actuator/health")
println "Waiting for Fineract startup (timeout: ${timeoutSeconds}s)..."
while (waited < timeoutSeconds) {
try {
HttpURLConnection connection = (HttpURLConnection) url.openConnection()
connection.setConnectTimeout(2000)
connection.setReadTimeout(2000)
connection.setRequestMethod("GET")
int responseCode = connection.getResponseCode()
if (responseCode == 200) {
println "Fineract is up!"
return
}
} catch (Exception ignored) { }
sleep(interval * 1000)
waited += interval
println "Still waiting..."
}
throw new GradleException("Fineract did not start within ${timeoutSeconds} seconds")
}
}
// Retrofit client for existing tests | ||
testImplementation project(path: ':fineract-client', configuration: 'runtimeElements') | ||
|
||
// Feign client - exclude services to avoid conflicts with Retrofit client |
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.
if you exclude the generated services, how can any of the integration tests using this client?
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 clarified the comment we don't actually excluded it
1dfd973
to
860fce4
Compare
860fce4
to
5aa67c8
Compare
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.
LGTM
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.