Skip to content

Commit

Permalink
Adjust settlement/authorisation timeouts in acceptance tests, and rev…
Browse files Browse the repository at this point in the history
…iew version info loader implementation (#289)
  • Loading branch information
dili91 authored May 17, 2024
1 parent 3d6a592 commit 90273ca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ tasks.register('acceptance-tests', Test) {

dependencies {
// Utilities
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
implementation group: 'org.apache.commons', name: 'commons-configuration2', version: '2.10.1'


// HTTP client
def retrofitVersion = '2.9.0'
implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: retrofitVersion
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Main properties
group=com.truelayer
archivesBaseName=truelayer-java
version=13.0.1
version=13.0.2

# Artifacts properties
sonatype_repository_url=https://s01.oss.sonatype.org/service/local/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.truelayer.java.versioninfo;

import static java.util.Objects.requireNonNull;

import com.truelayer.java.Constants;
import com.truelayer.java.TrueLayerException;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;

/**
* Class the loads the version of the library during the client initialization.
Expand All @@ -15,18 +18,23 @@ public class LibraryInfoLoader {
private static final String CONFIG_FILE_PREXIF = "truelayer-java";

public VersionInfo load() {
PropertiesConfiguration libraryVersionProps = getVersionInfoPropertiesFile();
Properties libraryVersionProps = getVersionInfoProperties();

return VersionInfo.builder()
.libraryName(libraryVersionProps.getString(Constants.VersionInfo.NAME))
.libraryVersion(libraryVersionProps.getString(Constants.VersionInfo.VERSION))
.libraryName(libraryVersionProps.getProperty(Constants.VersionInfo.NAME))
.libraryVersion(libraryVersionProps.getProperty(Constants.VersionInfo.VERSION))
.build();
}

private PropertiesConfiguration getVersionInfoPropertiesFile() {
private Properties getVersionInfoProperties() {
try {
return new Configurations().properties(CONFIG_FILE_PREXIF + "." + "version" + ".properties");
} catch (ConfigurationException e) {
Properties versionInfoProps = new Properties();
versionInfoProps.load(Files.newInputStream(Paths.get(requireNonNull(getClass()
.getClassLoader()
.getResource(CONFIG_FILE_PREXIF + "." + "version" + ".properties"))
.getPath())));
return versionInfoProps;
} catch (IOException e) {
throw new TrueLayerException("Unable to load library version file", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ private void authorizeMandate(AuthorizationFlowResponse authorizationFlowRespons
private void waitForMandateToBeAuthorized(String mandateId) {
await().with()
.pollInterval(1, TimeUnit.SECONDS)
.atMost(5, TimeUnit.SECONDS)
.atMost(30, TimeUnit.SECONDS)
.until(() -> {
// get mandate by id
ApiResponse<MandateDetail> getMandateResponse =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public void onTimeout(TimeoutEvent timeoutEvent) {
}
})
.pollInterval(1, TimeUnit.SECONDS)
.atMost(15, TimeUnit.SECONDS)
.atMost(30, TimeUnit.SECONDS)
.until(() -> {
// get payment by id
ApiResponse<PaymentDetail> getPaymentResponse =
Expand Down

0 comments on commit 90273ca

Please sign in to comment.