FINERACT-2181: Using JUnit 5 for E2E
This commit is contained in:
+5
-5
@@ -61,7 +61,7 @@ public class EventAssertion {
|
||||
}
|
||||
T event = eventFactory.create(eventClazz);
|
||||
try {
|
||||
await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).until(() -> {
|
||||
await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis())).until(() -> {
|
||||
if (removeEventIfFound) {
|
||||
return eventStore.removeEventById(event, id).isPresent();
|
||||
} else {
|
||||
@@ -69,8 +69,8 @@ public class EventAssertion {
|
||||
}
|
||||
});
|
||||
} catch (ConditionTimeoutException e) {
|
||||
Assertions
|
||||
.fail(event.getEventName() + " hasn't been received within " + eventProperties.getEventWaitTimeoutInSec() + " seconds");
|
||||
Assertions.fail(
|
||||
event.getEventName() + " hasn't been received within " + eventProperties.getWaitTimeoutInMillis() / 1000 + " seconds");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class EventAssertion {
|
||||
}
|
||||
T event = eventFactory.create(eventClazz);
|
||||
try {
|
||||
await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).until(() -> {
|
||||
await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis())).until(() -> {
|
||||
if (id == null) {
|
||||
return !eventStore.findByType(event).isEmpty();
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public class EventAssertion {
|
||||
}
|
||||
T event = eventFactory.create(eventClazz);
|
||||
try {
|
||||
await().atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec()))
|
||||
await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis()))
|
||||
.until(() -> eventStore.findByType(event).stream().anyMatch(filter));
|
||||
|
||||
String receivedEventsLogParam = eventStore.getReceivedEvents().stream().map(LoggedEvent::new).map(LoggedEvent::toString)
|
||||
|
||||
+8
-2
@@ -26,8 +26,14 @@ import org.springframework.stereotype.Component;
|
||||
@Getter
|
||||
public class EventProperties {
|
||||
|
||||
@Value("${fineract-test.event.wait-timeout-in-sec}")
|
||||
private int eventWaitTimeoutInSec;
|
||||
@Value("${fineract-test.event.wait-timeout-in-ms}")
|
||||
private long waitTimeoutInMillis;
|
||||
|
||||
@Value("${fineract-test.event.interval-in-ms}")
|
||||
private long intervalInMillis;
|
||||
|
||||
@Value("${fineract-test.event.delay-in-ms}")
|
||||
private long delayInMillis;
|
||||
|
||||
@Value("${fineract-test.event.verification-enabled}")
|
||||
private boolean eventVerificationEnabled;
|
||||
|
||||
+6
-6
@@ -26,13 +26,13 @@ import org.springframework.stereotype.Component;
|
||||
@Getter
|
||||
public class JobPollingProperties {
|
||||
|
||||
@Value("${fineract-test.job.interval-in-sec}")
|
||||
private long pollingIntervalInSec;
|
||||
@Value("${fineract-test.job.interval-in-ms}")
|
||||
private long intervalInMillis;
|
||||
|
||||
@Value("${fineract-test.job.delay-in-sec}")
|
||||
private long pollingDelayInSec;
|
||||
@Value("${fineract-test.job.delay-in-ms}")
|
||||
private long delayInMillis;
|
||||
|
||||
@Value("${fineract-test.job.at-most-in-sec}")
|
||||
private long pollingAtMostInSec;
|
||||
@Value("${fineract-test.job.wait-timeout-in-ms}")
|
||||
private long timeoutInMillis;
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -66,10 +66,10 @@ public class JobService {
|
||||
|
||||
private void waitUntilJobIsFinished(Job job) {
|
||||
String jobName = job.getName();
|
||||
await().atMost(Duration.ofSeconds(jobPollingProperties.getPollingAtMostInSec())) //
|
||||
await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) //
|
||||
.alias("%s didn't finish on time".formatted(jobName)) //
|
||||
.pollInterval(Duration.ofSeconds(jobPollingProperties.getPollingIntervalInSec())) //
|
||||
.pollDelay(Duration.ofSeconds(jobPollingProperties.getPollingDelayInSec())) //
|
||||
.pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) //
|
||||
.pollDelay(Duration.ofMillis(jobPollingProperties.getDelayInMillis())) //
|
||||
.until(() -> {
|
||||
log.info("Waiting for job {} to finish", jobName);
|
||||
Long jobId = jobResolver.resolve(job);
|
||||
|
||||
+19
-10
@@ -26,8 +26,8 @@ import static org.apache.fineract.test.data.loanproduct.DefaultLoanProduct.LP2_A
|
||||
import static org.apache.fineract.test.factory.LoanProductsRequestFactory.CHARGE_OFF_REASONS;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@@ -2453,8 +2453,10 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
LoanStatusEnumDataV1 expectedStatus = getExpectedStatus(loanStatus);
|
||||
await().pollDelay(Duration.ofSeconds(1L)).pollInterval(Duration.ofSeconds(1L))
|
||||
.atMost(Duration.ofSeconds(eventProperties.getEventWaitTimeoutInSec())).untilAsserted(() -> {
|
||||
await().atMost(Duration.ofMillis(eventProperties.getWaitTimeoutInMillis()))//
|
||||
.pollDelay(Duration.ofMillis(eventProperties.getDelayInMillis())) //
|
||||
.pollInterval(Duration.ofMillis(eventProperties.getIntervalInMillis()))//
|
||||
.untilAsserted(() -> {
|
||||
eventAssertion.assertEvent(LoanStatusChangedEvent.class, loanId).extractingData(LoanAccountDataV1::getStatus)
|
||||
.isEqualTo(expectedStatus);
|
||||
});
|
||||
@@ -2479,7 +2481,7 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
public void getLoanLastCOBDate(String date) throws IOException {
|
||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanResponse.body().getLoanId();
|
||||
|
||||
log.debug("Loan ID: {}", loanId);
|
||||
Response<GetLoansLoanIdResponse> loanDetails = loansApi.retrieveLoan(loanId, false, "", "", "").execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(loanDetails);
|
||||
if ("null".equals(date)) {
|
||||
@@ -2497,9 +2499,16 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
|
||||
@When("Admin checks that Loan COB is running until the current business date")
|
||||
public void checkLoanCOBCatchUpRunningUntilCOBBusinessDate() {
|
||||
await().atMost(Duration.ofSeconds(jobPollingProperties.getPollingAtMostInSec())) //
|
||||
.pollInterval(Duration.ofSeconds(jobPollingProperties.getPollingIntervalInSec())) //
|
||||
.pollDelay(Duration.ofSeconds(jobPollingProperties.getPollingDelayInSec())) //
|
||||
await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) //
|
||||
.pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) //
|
||||
.until(() -> {
|
||||
Response<IsCatchUpRunningDTO> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse);
|
||||
IsCatchUpRunningDTO isCatchUpRunning = isCatchUpRunningResponse.body();
|
||||
return isCatchUpRunning.getCatchUpRunning();
|
||||
});
|
||||
await().atMost(Duration.ofMillis(jobPollingProperties.getTimeoutInMillis())) //
|
||||
.pollInterval(Duration.ofMillis(jobPollingProperties.getIntervalInMillis())) //
|
||||
.until(() -> {
|
||||
Response<IsCatchUpRunningDTO> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse);
|
||||
@@ -2676,8 +2685,8 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
|
||||
Response<GetLoansLoanIdTransactionsTransactionIdResponse> originalTransaction = loanTransactionsApi
|
||||
.retrieveTransaction(loanId, originalTransactionId, "").execute();
|
||||
assertNull(String.format("Original transaction external id is not null %n%s", originalTransaction.body()),
|
||||
originalTransaction.body().getExternalId());
|
||||
assertNull(originalTransaction.body().getExternalId(),
|
||||
String.format("Original transaction external id is not null %n%s", originalTransaction.body()));
|
||||
}
|
||||
|
||||
@Then("LoanTransactionAccrualActivityPostBusinessEvent is raised on {string}")
|
||||
|
||||
@@ -36,10 +36,13 @@ 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.event.wait-timeout-in-sec=${EVENT_WAIT_TIMEOUT_IN_SEC:5}
|
||||
fineract-test.event.verification-enabled=${EVENT_VERIFICATION_ENABLED:false}
|
||||
fineract-test.event.wait-timeout-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:5000}
|
||||
fineract-test.event.delay-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100}
|
||||
fineract-test.event.interval-in-ms=${POLLING_EVENT_WAIT_TIMEOUT_IN_MS:100}
|
||||
|
||||
fineract-test.job.interval-in-ms=${POLLING_JOB_INTERVAL_IN_MS:100}
|
||||
fineract-test.job.delay-in-ms=${POLLING_JOB_DELAY_IN_MS:3000}
|
||||
fineract-test.job.wait-timeout-in-ms=${POLLING_JOB_WAIT_TIMEOUT_IN_MS:120000}
|
||||
|
||||
fineract-test.client-read-timeout=${CLIENT_READ_TIMEOUT:60}
|
||||
fineract-test.job.interval-in-sec=${POLLING_INTERVAL_IN_SEC:1}
|
||||
fineract-test.job.delay-in-sec=${POLLING_DELAY_IN_SEC:3}
|
||||
fineract-test.job.at-most-in-sec=${POLLING_AT_MOST_IN_SEC:120}
|
||||
|
||||
Reference in New Issue
Block a user