From 17933ae16cddb077251d690dc07be6504dcf48ab Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Tue, 25 Jun 2024 22:22:49 +0530 Subject: [PATCH 01/10] parallel execution --- build.gradle | 6 ++ .../org/mifos/integrationtest/TestRunner.java | 39 +++++++++--- .../config/MockServerConfig.java | 2 +- .../config/WireMockServerSingleton.java | 60 +++++++++++++++++++ .../cucumber/stepdef/MockServerStepDef.java | 29 ++++----- .../batch_demo_csv/batchTransaction.csv | 4 ++ .../batchTransactionGsmaClosedLoop.csv | 16 ++--- .../resources/voucherManagementTest.feature | 2 - 8 files changed, 126 insertions(+), 32 deletions(-) create mode 100644 src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java create mode 100644 src/test/java/resources/batch_demo_csv/batchTransaction.csv diff --git a/build.gradle b/build.gradle index dfdc50234..877e4e616 100644 --- a/build.gradle +++ b/build.gradle @@ -172,6 +172,8 @@ dependencies { testImplementation 'org.apache.commons:commons-csv:1.5' testImplementation 'org.awaitility:awaitility:4.2.0' implementation 'commons-validator:commons-validator:1.7' + implementation 'io.github.prashant-ramcharan:courgette-jvm:6.12.0' + } tasks.named('test') { @@ -195,6 +197,10 @@ test { systemProperty "cucumber.filter.tags", System.getProperty("cucumber.filter.tags") systemProperty "cucumber.filter.name", System.getProperty("cucumber.filter.name") } +task parallelRun(type: Test) { + include '**/TestRunner.class' + outputs.upToDateWhen { false } +} task cucumberCli() { dependsOn assemble, testClasses doLast { diff --git a/src/test/java/org/mifos/integrationtest/TestRunner.java b/src/test/java/org/mifos/integrationtest/TestRunner.java index d6cbae096..2e4ac95d5 100644 --- a/src/test/java/org/mifos/integrationtest/TestRunner.java +++ b/src/test/java/org/mifos/integrationtest/TestRunner.java @@ -1,11 +1,36 @@ package org.mifos.integrationtest; -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; +import courgette.api.CourgetteAfterAll; +import courgette.api.CourgetteBeforeAll; +import courgette.api.CourgetteOptions; +import courgette.api.CourgetteRunLevel; +import courgette.api.CourgetteTestOutput; +import courgette.api.CucumberOptions; +import courgette.api.junit.Courgette; import org.junit.runner.RunWith; +import org.mifos.integrationtest.config.WireMockServerSingleton; -@RunWith(Cucumber.class) -@CucumberOptions(features = { "src/test/java/resources" }, glue = { "org.mifos.integrationtest.cucumber" }, plugin = { - "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", "json:build/cucumber-report.json", - "junit:build/cucumber.xml" }) -public class TestRunner {} +//@RunWith(Cucumber.class) +//@CucumberOptions(features = { "src/test/java/resources" }, glue = { "org.mifos.integrationtest.cucumber" }, plugin = { +// "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", "json:build/cucumber-report.json", +// "junit:build/cucumber.xml" }) + +@RunWith(Courgette.class) +@CourgetteOptions(threads = 3, runLevel = CourgetteRunLevel.FEATURE, rerunFailedScenarios = false, testOutput = CourgetteTestOutput.CONSOLE, generateCourgetteRunLog = true, + + reportTitle = "Paymenthub Test results", reportTargetDir = "build", cucumberOptions = @CucumberOptions(features = "src/test/java/resources", glue = "org.mifos.integrationtest.cucumber", tags = "@gov", publish = true, plugin = { + "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", + "json:build/cucumber-report.json", "junit:build/cucumber.xml" })) +@SuppressWarnings({ "FinalClass", "HideUtilityClassConstructor" }) +public class TestRunner { + + @CourgetteBeforeAll + public void setupWireMockServer() { + //WireMockServerSingleton.getInstance(); // Start WireMock server + } + + @CourgetteAfterAll + public void stopWireMockServer() { + //WireMockServerSingleton.getInstance().stop(); // Stop WireMock server + } +} diff --git a/src/test/java/org/mifos/integrationtest/config/MockServerConfig.java b/src/test/java/org/mifos/integrationtest/config/MockServerConfig.java index d8514b9e8..cf0317827 100644 --- a/src/test/java/org/mifos/integrationtest/config/MockServerConfig.java +++ b/src/test/java/org/mifos/integrationtest/config/MockServerConfig.java @@ -27,7 +27,7 @@ public WireMockServer getMockServer() { @Override public String getBaseUri() { - return "http://localhost:" + getMockServer().port(); + return "http://localhost:" + WireMockServerSingleton.getInstance().port(); } } diff --git a/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java new file mode 100644 index 000000000..90f349b3f --- /dev/null +++ b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java @@ -0,0 +1,60 @@ +package org.mifos.integrationtest.config; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.FatalStartupException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +@SuppressWarnings({ "FinalClass", "HideUtilityClassConstructor" }) +public class WireMockServerSingleton { + + static Logger logger = LoggerFactory.getLogger(WireMockServerSingleton.class); + private static transient final ThreadLocal threadLocalInstance = new ThreadLocal<>(); + + public static WireMockServer getInstance() { + WireMockServer instance = threadLocalInstance.get(); + if (instance == null || !instance.isRunning()) { + synchronized (WireMockServerSingleton.class) { + instance = threadLocalInstance.get(); // Double-check idiom + if (instance == null || !instance.isRunning()) { + instance = startWireMockServerWithRetry(3); // Retry 3 times + threadLocalInstance.set(instance); + } + } + } + return instance; + } + + private static WireMockServer startWireMockServerWithRetry(int maxRetries) { + WireMockServer server = null; + for (int attempt = 1; attempt <= maxRetries; attempt++) { + //int port = getRandomPort(); + server = new WireMockServer(53013); + try { + server.start(); + logger.info("WireMock started on port {}", server.port()); + return server; + } catch (FatalStartupException e) { + logger.error("Failed to start WireMock on port {} (Attempt {}/{}). Retrying...", 53013, attempt, maxRetries, e); + // Optionally, add a short delay here if needed + } + } + throw new IllegalStateException("Failed to start WireMock server after " + maxRetries + " attempts."); + } + + private int getRandomPort() { + // This returns a port number in the range 1024-65535 + return 1024 + (int) (Math.random() * ((65535 - 1024) + 1)); + } + + public static int getPort() { + WireMockServer instance = threadLocalInstance.get(); + if (instance != null && instance.isRunning()) { + return instance.port(); + } else { + throw new IllegalStateException("WireMock server is not running."); + } + } +} diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java index 55bd7288a..47d78f89d 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java @@ -28,6 +28,7 @@ import io.restassured.builder.ResponseSpecBuilder; import io.restassured.specification.RequestSender; import org.mifos.integrationtest.common.HttpMethod; +import org.mifos.integrationtest.config.WireMockServerSingleton; import org.springframework.beans.factory.annotation.Value; public class MockServerStepDef extends BaseStepDef { @@ -39,13 +40,13 @@ public class MockServerStepDef extends BaseStepDef { @Given("I can inject MockServer") public void checkIfMockServerIsInjected() { - assertThat(mockServer).isNotNull(); + assertThat(WireMockServerSingleton.getInstance()).isNotNull(); } @Then("I should be able to get instance of mock server") public void getInstanceOfMockServer() throws InterruptedException { - assertThat(mockServer.getMockServer()).isNotNull(); - assertThat(mockServer.getMockServer().port()).isEqualTo(mockServerPortFromConfig); + assertThat(WireMockServerSingleton.getInstance()).isNotNull(); + assertThat(WireMockServerSingleton.getPort()).isEqualTo(mockServerPortFromConfig); } @ParameterType(name = "httpMethod", value = ".*") @@ -59,16 +60,16 @@ public HttpMethod httpMethod(String httpMethod) { public void startStub(String endpoint, HttpMethod httpMethod, int status) { switch (httpMethod) { case GET -> { - stubFor(get(urlPathMatching(endpoint)).willReturn(status(status))); + WireMockServerSingleton.getInstance().stubFor(get(urlPathMatching(endpoint)).willReturn(status(status))); } case POST -> { - stubFor(post(urlPathMatching(endpoint)).willReturn(status(status))); + WireMockServerSingleton.getInstance().stubFor(post(urlPathMatching(endpoint)).willReturn(status(status))); } case PUT -> { - stubFor(put(urlPathMatching(endpoint)).willReturn(status(status))); + WireMockServerSingleton.getInstance().stubFor(put(urlPathMatching(endpoint)).willReturn(status(status))); } case DELETE -> { - stubFor(delete(urlPathMatching(endpoint)).willReturn(status(status))); + WireMockServerSingleton.getInstance().stubFor(delete(urlPathMatching(endpoint)).willReturn(status(status))); } } } @@ -99,16 +100,16 @@ public void verifyStub(HttpMethod httpMethod, String endpoint, int numberOfReque await().atMost(awaitMost, SECONDS).pollInterval(pollInterval, SECONDS).untilAsserted(() -> { switch (httpMethod) { case GET -> { - verify(numberOfRequest, getRequestedFor(urlEqualTo(endpoint))); + WireMockServerSingleton.getInstance().verify(numberOfRequest, getRequestedFor(urlEqualTo(endpoint))); } case POST -> { - verify(numberOfRequest, postRequestedFor(urlEqualTo(endpoint))); + WireMockServerSingleton.getInstance().verify(numberOfRequest, postRequestedFor(urlEqualTo(endpoint))); } case PUT -> { - verify(numberOfRequest, putRequestedFor(urlEqualTo(endpoint))); + WireMockServerSingleton.getInstance().verify(numberOfRequest, putRequestedFor(urlEqualTo(endpoint))); } case DELETE -> { - verify(numberOfRequest, deleteRequestedFor(urlEqualTo(endpoint))); + WireMockServerSingleton.getInstance().verify(numberOfRequest, deleteRequestedFor(urlEqualTo(endpoint))); } } }); @@ -116,13 +117,13 @@ public void verifyStub(HttpMethod httpMethod, String endpoint, int numberOfReque @And("I can start mock server") public void startMockServer() { - mockServer.getMockServer().start(); - configureFor("localhost", mockServer.getMockServer().port()); + WireMockServerSingleton.getInstance().start(); + configureFor("localhost", WireMockServerSingleton.getPort()); } @And("I can stop mock server") public void stopMockServer() { - mockServer.getMockServer().stop(); + WireMockServerSingleton.getInstance().stop(); } @Given("I will start the mock server") diff --git a/src/test/java/resources/batch_demo_csv/batchTransaction.csv b/src/test/java/resources/batch_demo_csv/batchTransaction.csv new file mode 100644 index 000000000..0826b736a --- /dev/null +++ b/src/test/java/resources/batch_demo_csv/batchTransaction.csv @@ -0,0 +1,4 @@ +id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note +0,e6474bda-7b00-4c21-96e6-6791e9ae67db,mojaloop,msisdn,342,msisdn,7415,3,USD,Test Payee Payment +1,74a103ab-63bb-4bf7-85c7-8bb0163724b2,mojaloop,msisdn,343,msisdn,7415,2,USD,Test Payee Payment +2,edfdb7bd-955a-47d4-815f-9af43d80aca8,mojaloop,msisdn,344,msisdn,7416,1,USD,Test Payee Payment \ No newline at end of file diff --git a/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv b/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv index f03d5970e..483b2bd9a 100644 --- a/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv +++ b/src/test/java/resources/batch_demo_csv/batchTransactionGsmaClosedLoop.csv @@ -1,9 +1,9 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,3e2dcaf6-7f66-4460-aa03-2be3a12222eb,closedloop,msisdn,5397,msisdn,5141,10,USD,Test Payee Payment -1,b9760d58-676a-4353-a555-3a3b63f1760a,closedloop,msisdn,5398,msisdn,5142,5,USD,Test Payee Payment -2,00ffd1a8-c7a7-4943-b68f-11df7c2763a5,closedloop,msisdn,5399,msisdn,5143,5,USD,Test Payee Payment -3,74a81c70-0335-45b9-877b-43b3b6ec2f16,closedloop,msisdn,5400,msisdn,5144,5,USD,Test Payee Payment -4,777035ca-a4d9-4725-b905-0c840b567c51,closedloop,msisdn,5401,msisdn,5145,5,USD,Test Payee Payment -5,f50f0d85-7fec-44ad-8a3f-0811b4926db6,gsma,msisdn,5402,msisdn,5146,6,USD,Test Payee Payment -6,9c780986-28a9-45eb-896e-1139ef2a15c2,gsma,msisdn,5403,msisdn,5147,7,USD,Test Payee Payment -7,09abfde9-73c8-45d9-a89c-9623eacddcd3,gsma,msisdn,5404,msisdn,5148,8,USD,Test Payee Payment \ No newline at end of file +0,400959c1-d989-4653-8c9d-3265451d9411,closedloop,msisdn,333,msisdn,7403,10,USD,Test Payee Payment +1,a3780a16-6189-46e3-88bd-ad240d5042f4,closedloop,msisdn,334,msisdn,7404,5,USD,Test Payee Payment +2,60c0f751-e2bb-4bf5-8084-a75818f4144b,closedloop,msisdn,335,msisdn,7405,5,USD,Test Payee Payment +3,6309dae0-e5df-4dec-8c7d-32dd2cc4eb28,closedloop,msisdn,336,msisdn,7406,5,USD,Test Payee Payment +4,8463c206-49cb-46c5-bca1-feb7e76e3368,closedloop,msisdn,337,msisdn,7407,5,USD,Test Payee Payment +5,f6b35c81-10bd-42dd-9e91-c17a64bb324c,gsma,msisdn,338,msisdn,7408,6,USD,Test Payee Payment +6,d4c8feab-b5ba-4f1b-a6ed-a7c4f362c6c2,gsma,msisdn,339,msisdn,7409,7,USD,Test Payee Payment +7,0000aaf3-df3b-4f1b-995d-35d89f679221,gsma,msisdn,340,msisdn,7410,8,USD,Test Payee Payment \ No newline at end of file diff --git a/src/test/java/resources/voucherManagementTest.feature b/src/test/java/resources/voucherManagementTest.feature index 2921cd332..4edbe52f7 100644 --- a/src/test/java/resources/voucherManagementTest.feature +++ b/src/test/java/resources/voucherManagementTest.feature @@ -3,8 +3,6 @@ Feature: Voucher Management Api Test @gov Scenario: Create Voucher Api Test - When I can inject MockServer - Then I can start mock server And I can register the stub with "/createVoucher" endpoint for "PUT" request with status of 200 Given I can create an VoucherRequestDTO for voucher creation When I call the create voucher API with expected status of 202 and stub "/createVoucher" From 13791a1a6e048ac53a182ec10ff6eb23c8af8cd2 Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Tue, 25 Jun 2024 22:42:03 +0530 Subject: [PATCH 02/10] checkstyle --- build.gradle | 1 - src/test/java/org/mifos/integrationtest/TestRunner.java | 9 ++++----- .../integrationtest/config/WireMockServerSingleton.java | 6 +++--- .../cucumber/stepdef/MockServerStepDef.java | 2 -- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 877e4e616..ca1e297a9 100644 --- a/build.gradle +++ b/build.gradle @@ -173,7 +173,6 @@ dependencies { testImplementation 'org.awaitility:awaitility:4.2.0' implementation 'commons-validator:commons-validator:1.7' implementation 'io.github.prashant-ramcharan:courgette-jvm:6.12.0' - } tasks.named('test') { diff --git a/src/test/java/org/mifos/integrationtest/TestRunner.java b/src/test/java/org/mifos/integrationtest/TestRunner.java index 2e4ac95d5..b827573ed 100644 --- a/src/test/java/org/mifos/integrationtest/TestRunner.java +++ b/src/test/java/org/mifos/integrationtest/TestRunner.java @@ -8,7 +8,6 @@ import courgette.api.CucumberOptions; import courgette.api.junit.Courgette; import org.junit.runner.RunWith; -import org.mifos.integrationtest.config.WireMockServerSingleton; //@RunWith(Cucumber.class) //@CucumberOptions(features = { "src/test/java/resources" }, glue = { "org.mifos.integrationtest.cucumber" }, plugin = { @@ -19,18 +18,18 @@ @CourgetteOptions(threads = 3, runLevel = CourgetteRunLevel.FEATURE, rerunFailedScenarios = false, testOutput = CourgetteTestOutput.CONSOLE, generateCourgetteRunLog = true, reportTitle = "Paymenthub Test results", reportTargetDir = "build", cucumberOptions = @CucumberOptions(features = "src/test/java/resources", glue = "org.mifos.integrationtest.cucumber", tags = "@gov", publish = true, plugin = { - "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", - "json:build/cucumber-report.json", "junit:build/cucumber.xml" })) + "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", + "json:build/cucumber-report.json", "junit:build/cucumber.xml" })) @SuppressWarnings({ "FinalClass", "HideUtilityClassConstructor" }) public class TestRunner { @CourgetteBeforeAll public void setupWireMockServer() { - //WireMockServerSingleton.getInstance(); // Start WireMock server + // WireMockServerSingleton.getInstance(); // Start WireMock server } @CourgetteAfterAll public void stopWireMockServer() { - //WireMockServerSingleton.getInstance().stop(); // Stop WireMock server + // WireMockServerSingleton.getInstance().stop(); // Stop WireMock server } } diff --git a/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java index 90f349b3f..9ced9e059 100644 --- a/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java +++ b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java @@ -11,7 +11,7 @@ public class WireMockServerSingleton { static Logger logger = LoggerFactory.getLogger(WireMockServerSingleton.class); - private static transient final ThreadLocal threadLocalInstance = new ThreadLocal<>(); + private static final transient ThreadLocal threadLocalInstance = new ThreadLocal<>(); public static WireMockServer getInstance() { WireMockServer instance = threadLocalInstance.get(); @@ -30,7 +30,7 @@ public static WireMockServer getInstance() { private static WireMockServer startWireMockServerWithRetry(int maxRetries) { WireMockServer server = null; for (int attempt = 1; attempt <= maxRetries; attempt++) { - //int port = getRandomPort(); + // int port = getRandomPort(); server = new WireMockServer(53013); try { server.start(); @@ -44,7 +44,7 @@ private static WireMockServer startWireMockServerWithRetry(int maxRetries) { throw new IllegalStateException("Failed to start WireMock server after " + maxRetries + " attempts."); } - private int getRandomPort() { + private int getRandomPort() { // This returns a port number in the range 1024-65535 return 1024 + (int) (Math.random() * ((65535 - 1024) + 1)); } diff --git a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java index 47d78f89d..6b5925917 100644 --- a/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java +++ b/src/test/java/org/mifos/integrationtest/cucumber/stepdef/MockServerStepDef.java @@ -10,10 +10,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.put; import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.status; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static com.google.common.truth.Truth.assertThat; import static java.util.concurrent.TimeUnit.SECONDS; import static org.awaitility.Awaitility.await; From b944c3ef154b062f09c3c9eef777d48b3c07d5db Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Thu, 4 Jul 2024 17:13:35 +0530 Subject: [PATCH 03/10] gradle command --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8442e19cb..f27caf296 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -227,7 +227,7 @@ jobs: export CALLBACK_URL="https://$NGROK_PUBLIC_URL" echo -n "Public url ." echo $CALLBACK_URL - ./gradlew test -Dcucumber.filter.tags="@gov" + ./gradlew test -Dcucumber.tags="@gov" echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: @@ -264,7 +264,7 @@ jobs: export CALLBACK_URL="https://$NGROK_PUBLIC_URL" echo -n "Public url ." echo $CALLBACK_URL - ./gradlew test -Dcucumber.filter.tags="@amsIntegration" + ./gradlew test -Dcucumber.tags="@amsIntegration" echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: From a95b7d29c9d38eaa7b749193b1df3b30fe4b613f Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:15:12 +0530 Subject: [PATCH 04/10] gradle task changes --- build.gradle | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/build.gradle b/build.gradle index ca1e297a9..f312c0d1c 100644 --- a/build.gradle +++ b/build.gradle @@ -175,52 +175,11 @@ dependencies { implementation 'io.github.prashant-ramcharan:courgette-jvm:6.12.0' } -tasks.named('test') { - useJUnitPlatform() +tasks.withType(Test) { + systemProperties = System.getProperties() } - -configurations { - cucumberRuntime { - extendsFrom testImplementation - } - testlogger { - // pick a theme - mocha, standard, plain, mocha-parallel, standard-parallel or plain-parallel - theme 'mocha' - showSkipped false - showStackTraces true - } -} - -test { - systemProperty "cucumber.filter.tags", System.getProperty("cucumber.filter.tags") - systemProperty "cucumber.filter.name", System.getProperty("cucumber.filter.name") -} task parallelRun(type: Test) { include '**/TestRunner.class' outputs.upToDateWhen { false } } -task cucumberCli() { - dependsOn assemble, testClasses - doLast { - javaexec { - main = "io.cucumber.core.cli.Main" - classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output - args = [ - '--plugin', - 'html:cucumber-report', - '--plugin', - 'json:cucumber.json', - '--plugin', - 'pretty', - '--plugin', - 'html:build/cucumber-report.html', - '--plugin', - 'json:build/cucumber-report.json', - '--glue', - 'org.mifos.integrationtest.cucumber', - 'src/test/java/resources' - ] - } - } -} From cc84e80a16f91ffe1b2141fcc46e26b64797e906 Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:40:01 +0530 Subject: [PATCH 05/10] modify feature file --- src/test/java/resources/batch.feature | 2 +- .../java/resources/batch_demo_csv/batchTransactionGsma.csv | 6 +++--- src/test/java/resources/billPay.feature | 1 - src/test/java/resources/identityMapperTest.feature | 1 - src/test/java/resources/mockserver.feature | 2 -- src/test/java/resources/mojaloop.feature | 3 --- src/test/java/resources/voucherManagementTest.feature | 1 - 7 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/test/java/resources/batch.feature b/src/test/java/resources/batch.feature index 7405897c2..f64c1522e 100644 --- a/src/test/java/resources/batch.feature +++ b/src/test/java/resources/batch.feature @@ -294,7 +294,7 @@ Feature: Batch Details API test Then I should be able to extract response body from callback for batch When I make the "POST" request to "/callback" endpoint with expected status of 200 Then I should be able to extract response body from callback for batch - And I can stop mock server + @gov @batch-teardown Scenario: BD-019 Batch summary response result file URL Test Given I have the demo csv file "ph-ee-bulk-demo-6.csv" diff --git a/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv b/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv index e8e8fcd26..6ce5696bd 100644 --- a/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv +++ b/src/test/java/resources/batch_demo_csv/batchTransactionGsma.csv @@ -1,4 +1,4 @@ id,request_id,payment_mode,payer_identifier_type,payer_identifier,payee_identifier_type,payee_identifier,amount,currency,note -0,1fe8af66-9a34-4b92-bbd5-1a116b635bb5,gsma,msisdn,4004,msisdn,3815,10,USD,Test Payee Payment -1,dbbe52aa-20a0-4eb9-80a0-ad6df8068e40,gsma,msisdn,4005,msisdn,3816,5,USD,Test Payee Payment -2,021955bc-8a96-45d3-bec0-69e365d5369c,gsma,msisdn,4006,msisdn,3817,1,USD,Test Payee Payment \ No newline at end of file +0,36b9ffcf-6ade-4629-864b-239024f57857,gsma,msisdn,1702,msisdn,1334,10,USD,Test Payee Payment +1,32b52e7f-15d3-407e-819d-f5f10b6e332d,gsma,msisdn,1703,msisdn,1335,5,USD,Test Payee Payment +2,bd7ffee2-2801-4630-bcef-99ec6938eab2,gsma,msisdn,1704,msisdn,1336,1,USD,Test Payee Payment \ No newline at end of file diff --git a/src/test/java/resources/billPay.feature b/src/test/java/resources/billPay.feature index a28c4898b..4b6cee702 100644 --- a/src/test/java/resources/billPay.feature +++ b/src/test/java/resources/billPay.feature @@ -187,7 +187,6 @@ Feature: Bill Payment P2G Test And I should get transactionId in response # And I will sleep for 5000 millisecond Then I should be able to extract response body from callback for bill already paid - Then I can stop mock server @gov Scenario: BP-004B Bill Payments API fails due to bill marked as paid after a timeout (PFI to PBB) diff --git a/src/test/java/resources/identityMapperTest.feature b/src/test/java/resources/identityMapperTest.feature index 553102ad4..418850abf 100644 --- a/src/test/java/resources/identityMapperTest.feature +++ b/src/test/java/resources/identityMapperTest.feature @@ -299,7 +299,6 @@ Feature: Identity Account Mapper Api Test Scenario: IAM-005 Account Lookup Api Consistency Test When I call the account lookup API 10 times with expected status of 202 and stub "/accountLookup" # Then I will sleep for 3000 millisecond - And I can stop mock server diff --git a/src/test/java/resources/mockserver.feature b/src/test/java/resources/mockserver.feature index c68b0a722..9a6e09290 100644 --- a/src/test/java/resources/mockserver.feature +++ b/src/test/java/resources/mockserver.feature @@ -5,7 +5,6 @@ Feature: Testing the startup and working of mockserver Given I can inject MockServer And I can start mock server Then I should be able to get instance of mock server - And I can stop mock server Scenario: MS-002 Mockserver stub test Given I can inject MockServer @@ -13,4 +12,3 @@ Feature: Testing the startup and working of mockserver And I can register the stub with "/testMockServer" endpoint for "POST" request with status of 200 When I make the "POST" request to "/testMockServer" endpoint with expected status of 200 Then I should be able to verify that the "POST" method to "/testMockServer" endpoint received 1 request - And I can stop mock server diff --git a/src/test/java/resources/mojaloop.feature b/src/test/java/resources/mojaloop.feature index 3cae45cf8..500379dad 100644 --- a/src/test/java/resources/mojaloop.feature +++ b/src/test/java/resources/mojaloop.feature @@ -16,7 +16,6 @@ Feature: Mojaloop test Then I call the get parties api in ml connector for "payee" # Then I will sleep for 5000 millisecond Then I should be able to verify the callback for lookup - Then I can stop mock server Scenario: ML connector partial payee quotation test Given I am setting up Mojaloop @@ -33,7 +32,6 @@ Feature: Mojaloop test Then I call the get quotation api in ml connector for "payee" # Then I will sleep for 5000 millisecond Then I should be able to verify the callback for quotation - Then I can stop mock server Scenario: ML connector partial payee transfer test Given I am setting up Mojaloop @@ -54,7 +52,6 @@ Feature: Mojaloop test Then I call the transfer api in ml connector for "payee" # Then I will sleep for 5000 millisecond Then I should be able to verify the callback for transfer - Then I can stop mock server Scenario: Payer Fund Transfer Flow test Given I am setting up Mojaloop diff --git a/src/test/java/resources/voucherManagementTest.feature b/src/test/java/resources/voucherManagementTest.feature index 4edbe52f7..e4f77ccc4 100644 --- a/src/test/java/resources/voucherManagementTest.feature +++ b/src/test/java/resources/voucherManagementTest.feature @@ -54,7 +54,6 @@ Feature: Voucher Management Api Test Scenario: Fetch Voucher Api Test Then I will call the fetch voucher API with expected status of 200 And I will assert the fields from fetch voucher response - And I can stop mock server @gov Scenario: VC-001,002,003,004,005 Error Validity check for Create Voucher API for negative request body From f97d0a385b996ccf49eb7e80628535da821664ad Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Wed, 10 Jul 2024 18:45:35 +0530 Subject: [PATCH 06/10] report format change --- .circleci/config.yml | 4 +- build.gradle | 122 +++++++++--------- .../org/mifos/integrationtest/TestRunner.java | 34 +++-- 3 files changed, 81 insertions(+), 79 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f27caf296..2e3372723 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -231,7 +231,7 @@ jobs: echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: - path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml + path: build/cucumber.xml - store_artifacts: path: build/test-results test-chart-ams: @@ -268,7 +268,7 @@ jobs: echo -n "Test execution is completed, kill ngrok" pkill ngrok - store_test_results: - path: build/test-results/test/TEST-org.fynarfin.integrationtest.TestRunner.xml + path: build/cucumber.xml - store_artifacts: path: build/test-results workflows: diff --git a/build.gradle b/build.gradle index f312c0d1c..fc3faa318 100644 --- a/build.gradle +++ b/build.gradle @@ -8,10 +8,11 @@ plugins { id 'com.adarshr.test-logger' version '3.2.0' } -apply plugin:'com.diffplug.spotless' +apply plugin: 'com.diffplug.spotless' + spotless { format 'misc', { - target '**/*.md', '**/*.properties', '**/.gitignore', '**/.openapi-generator-ignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql' + target '**/*.md', '**/*.properties', '**/.gitignore', '**/.openapi-generator-ignore', '**/*.yml', '**/*.xml', '**/*.json', '**/*.sql' targetExclude '**/build/**', '**/bin/**', '**/.settings/**', '**/.idea/**', '**/.gradle/**', '**/gradlew.bat', '**/licenses/**', '**/banner.txt', '.vscode/**' indentWithSpaces(4) endWithNewline() @@ -31,53 +32,50 @@ spotless { } configure(this) { - // NOTE: order matters! apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' apply plugin: 'checkstyle' + configurations { implementation.setCanBeResolved(true) api.setCanBeResolved(true) } + tasks.withType(JavaCompile) { options.compilerArgs += [ - "-Xlint:unchecked", - "-Xlint:cast", - "-Xlint:auxiliaryclass", - "-Xlint:deprecation", - "-Xlint:dep-ann", - "-Xlint:divzero", - "-Xlint:empty", - "-Xlint:exports", - "-Xlint:fallthrough", - "-Xlint:finally", - "-Xlint:module", - "-Xlint:opens", - "-Xlint:options", - "-Xlint:overloads", - "-Xlint:overrides", - "-Xlint:path", - "-Xlint:processing", - "-Xlint:removal", - "-Xlint:requires-automatic", - "-Xlint:requires-transitive-automatic", - "-Xlint:try", - "-Xlint:varargs", - "-Xlint:preview", - "-Xlint:static", - // -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code - // and during an IntelliJ recompilation, it fails - //"-Werror", - "-Xmaxwarns", - 1500, - "-Xmaxerrs", - 1500 + "-Xlint:unchecked", + "-Xlint:cast", + "-Xlint:auxiliaryclass", + "-Xlint:deprecation", + "-Xlint:dep-ann", + "-Xlint:divzero", + "-Xlint:empty", + "-Xlint:exports", + "-Xlint:fallthrough", + "-Xlint:finally", + "-Xlint:module", + "-Xlint:opens", + "-Xlint:options", + "-Xlint:overloads", + "-Xlint:overrides", + "-Xlint:path", + "-Xlint:processing", + "-Xlint:removal", + "-Xlint:requires-automatic", + "-Xlint:requires-transitive-automatic", + "-Xlint:try", + "-Xlint:varargs", + "-Xlint:preview", + "-Xlint:static", + "-Xmaxwarns", + 1500, + "-Xmaxerrs", + 1500 ] options.deprecation = true } - // Configuration for the spotless plugin - // https://github.com/diffplug/spotless/tree/main/plugin-gradle + spotless { java { targetExclude '**/build/**', '**/bin/**', '**/out/**' @@ -86,43 +84,35 @@ configure(this) { eclipse().configFile "$rootDir/config/formatter.xml" endWithNewline() trimTrailingWhitespace() - // Enforce style modifier order custom 'Modifier ordering', { def modifierRanking = [ - public : 1, - protected : 2, - private : 3, - abstract : 4, - default : 5, - static : 6, - final : 7, - transient : 8, - volatile : 9, - synchronized: 10, - native : 11, - strictfp : 12] - // Find any instance of multiple modifiers. Lead with a non-word character to avoid - // accidental matching against for instance, "an alternative default value" + public : 1, + protected : 2, + private : 3, + abstract : 4, + default : 5, + static : 6, + final : 7, + transient : 8, + volatile : 9, + synchronized: 10, + native : 11, + strictfp : 12 + ] it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { - // Do not replace the leading non-word character. Identify the modifiers it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { - // Sort the modifiers according to the ranking above it.split().sort({ modifierRanking[it] }).join(' ') + ' ' - } - ) - } - ) + }) + }) } } lineEndings 'UNIX' } - // If we are running Gradle within Eclipse to enhance classes, - // set the classes directory to point to Eclipse's default build directory + if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') { sourceSets.main.java.outputDir = file("$projectDir/bin/main") } - // Configuration for the Checkstyle plugin - // https://docs.gradle.org/current/userguide/checkstyle_plugin.html + dependencies { checkstyle 'com.puppycrawl.tools:checkstyle:10.3.1' checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.42.0' @@ -154,13 +144,11 @@ dependencies { testImplementation('io.rest-assured:rest-assured:5.1.1') { exclude group: 'org.codehaus.groovy' } - testCompileOnly 'org.projectlombok:lombok:1.18.24' testAnnotationProcessor 'org.projectlombok:lombok:1.18.24' implementation 'io.cucumber:cucumber-java:7.8.1' implementation 'io.cucumber:cucumber-spring:7.8.1' testImplementation 'io.cucumber:cucumber-junit:7.8.1' - testRuntimeOnly("org.junit.vintage:junit-vintage-engine") checkstyle 'com.puppycrawl.tools:checkstyle:10.9.3' checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.44.1' @@ -177,6 +165,14 @@ dependencies { tasks.withType(Test) { systemProperties = System.getProperties() + testLogging { + events "passed", "skipped", "failed", "standardOut", "standardError" + showStandardStreams = true + } + reports { + junitXml.destination = file("build/test-results/test") + html.destination = file("build/reports/tests/test") + } } task parallelRun(type: Test) { diff --git a/src/test/java/org/mifos/integrationtest/TestRunner.java b/src/test/java/org/mifos/integrationtest/TestRunner.java index b827573ed..39354ece8 100644 --- a/src/test/java/org/mifos/integrationtest/TestRunner.java +++ b/src/test/java/org/mifos/integrationtest/TestRunner.java @@ -15,21 +15,27 @@ // "junit:build/cucumber.xml" }) @RunWith(Courgette.class) -@CourgetteOptions(threads = 3, runLevel = CourgetteRunLevel.FEATURE, rerunFailedScenarios = false, testOutput = CourgetteTestOutput.CONSOLE, generateCourgetteRunLog = true, - - reportTitle = "Paymenthub Test results", reportTargetDir = "build", cucumberOptions = @CucumberOptions(features = "src/test/java/resources", glue = "org.mifos.integrationtest.cucumber", tags = "@gov", publish = true, plugin = { - "html:cucumber-report", "json:cucumber.json", "pretty", "html:build/cucumber-report.html", - "json:build/cucumber-report.json", "junit:build/cucumber.xml" })) +@CourgetteOptions( + threads = 3, + runLevel = CourgetteRunLevel.FEATURE, + rerunFailedScenarios = false, + testOutput = CourgetteTestOutput.CONSOLE, + generateCourgetteRunLog = true, + reportTitle = "Paymenthub Test results", + reportTargetDir = "build", + cucumberOptions = @CucumberOptions( + features = "src/test/java/resources", + glue = "org.mifos.integrationtest.cucumber", + publish = true, + plugin = { + "pretty", // Pretty console output + "html:build/cucumber-report.html", // HTML report + "json:build/cucumber-report.json", // JSON report + "junit:build/cucumber.xml" // JUnit XML report + } + ) +) @SuppressWarnings({ "FinalClass", "HideUtilityClassConstructor" }) public class TestRunner { - @CourgetteBeforeAll - public void setupWireMockServer() { - // WireMockServerSingleton.getInstance(); // Start WireMock server - } - - @CourgetteAfterAll - public void stopWireMockServer() { - // WireMockServerSingleton.getInstance().stop(); // Stop WireMock server - } } From d818bfa7a0aeb77d95500f6d3549e4630447403b Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Wed, 10 Jul 2024 18:54:24 +0530 Subject: [PATCH 07/10] checkstyle --- build.gradle | 80 +++++++++---------- .../org/mifos/integrationtest/TestRunner.java | 28 ++----- 2 files changed, 46 insertions(+), 62 deletions(-) diff --git a/build.gradle b/build.gradle index fc3faa318..78ffcbe38 100644 --- a/build.gradle +++ b/build.gradle @@ -44,34 +44,34 @@ configure(this) { tasks.withType(JavaCompile) { options.compilerArgs += [ - "-Xlint:unchecked", - "-Xlint:cast", - "-Xlint:auxiliaryclass", - "-Xlint:deprecation", - "-Xlint:dep-ann", - "-Xlint:divzero", - "-Xlint:empty", - "-Xlint:exports", - "-Xlint:fallthrough", - "-Xlint:finally", - "-Xlint:module", - "-Xlint:opens", - "-Xlint:options", - "-Xlint:overloads", - "-Xlint:overrides", - "-Xlint:path", - "-Xlint:processing", - "-Xlint:removal", - "-Xlint:requires-automatic", - "-Xlint:requires-transitive-automatic", - "-Xlint:try", - "-Xlint:varargs", - "-Xlint:preview", - "-Xlint:static", - "-Xmaxwarns", - 1500, - "-Xmaxerrs", - 1500 + "-Xlint:unchecked", + "-Xlint:cast", + "-Xlint:auxiliaryclass", + "-Xlint:deprecation", + "-Xlint:dep-ann", + "-Xlint:divzero", + "-Xlint:empty", + "-Xlint:exports", + "-Xlint:fallthrough", + "-Xlint:finally", + "-Xlint:module", + "-Xlint:opens", + "-Xlint:options", + "-Xlint:overloads", + "-Xlint:overrides", + "-Xlint:path", + "-Xlint:processing", + "-Xlint:removal", + "-Xlint:requires-automatic", + "-Xlint:requires-transitive-automatic", + "-Xlint:try", + "-Xlint:varargs", + "-Xlint:preview", + "-Xlint:static", + "-Xmaxwarns", + 1500, + "-Xmaxerrs", + 1500 ] options.deprecation = true } @@ -86,18 +86,18 @@ configure(this) { trimTrailingWhitespace() custom 'Modifier ordering', { def modifierRanking = [ - public : 1, - protected : 2, - private : 3, - abstract : 4, - default : 5, - static : 6, - final : 7, - transient : 8, - volatile : 9, - synchronized: 10, - native : 11, - strictfp : 12 + public : 1, + protected : 2, + private : 3, + abstract : 4, + default : 5, + static : 6, + final : 7, + transient : 8, + volatile : 9, + synchronized: 10, + native : 11, + strictfp : 12 ] it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { diff --git a/src/test/java/org/mifos/integrationtest/TestRunner.java b/src/test/java/org/mifos/integrationtest/TestRunner.java index 39354ece8..6b08cb9c2 100644 --- a/src/test/java/org/mifos/integrationtest/TestRunner.java +++ b/src/test/java/org/mifos/integrationtest/TestRunner.java @@ -1,7 +1,5 @@ package org.mifos.integrationtest; -import courgette.api.CourgetteAfterAll; -import courgette.api.CourgetteBeforeAll; import courgette.api.CourgetteOptions; import courgette.api.CourgetteRunLevel; import courgette.api.CourgetteTestOutput; @@ -15,26 +13,12 @@ // "junit:build/cucumber.xml" }) @RunWith(Courgette.class) -@CourgetteOptions( - threads = 3, - runLevel = CourgetteRunLevel.FEATURE, - rerunFailedScenarios = false, - testOutput = CourgetteTestOutput.CONSOLE, - generateCourgetteRunLog = true, - reportTitle = "Paymenthub Test results", - reportTargetDir = "build", - cucumberOptions = @CucumberOptions( - features = "src/test/java/resources", - glue = "org.mifos.integrationtest.cucumber", - publish = true, - plugin = { - "pretty", // Pretty console output - "html:build/cucumber-report.html", // HTML report - "json:build/cucumber-report.json", // JSON report - "junit:build/cucumber.xml" // JUnit XML report - } - ) -) +@CourgetteOptions(threads = 3, runLevel = CourgetteRunLevel.FEATURE, rerunFailedScenarios = false, testOutput = CourgetteTestOutput.CONSOLE, generateCourgetteRunLog = true, reportTitle = "Paymenthub Test results", reportTargetDir = "build", cucumberOptions = @CucumberOptions(features = "src/test/java/resources", glue = "org.mifos.integrationtest.cucumber", publish = true, plugin = { + "pretty", // Pretty console output + "html:build/cucumber-report.html", // HTML report + "json:build/cucumber-report.json", // JSON report + "junit:build/cucumber.xml" // JUnit XML report +})) @SuppressWarnings({ "FinalClass", "HideUtilityClassConstructor" }) public class TestRunner { From c882ad6033bac2c3e032fa40d507a3f1b8474c31 Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Fri, 12 Jul 2024 07:51:06 +0530 Subject: [PATCH 08/10] test --- .circleci/config.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e3372723..2c94289c7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -317,17 +317,9 @@ workflows: - AWS - Helm - slack - - test-chart-ams: - requires: - - deploying-bpmns - context: - - AWS - - Helm - - slack - - Ngrok - test-chart-gov: requires: - - test-chart-ams + - deploying-bpmns context: - AWS - Helm From b77a3bc827767b8880a076d3f06bbeef572ab2a8 Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:20:29 +0530 Subject: [PATCH 09/10] remove wiremock inject --- src/test/java/resources/bulkPayment.feature | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/java/resources/bulkPayment.feature b/src/test/java/resources/bulkPayment.feature index e137bb633..4ac4267e1 100644 --- a/src/test/java/resources/bulkPayment.feature +++ b/src/test/java/resources/bulkPayment.feature @@ -5,8 +5,6 @@ Feature: Test ability to make payment to individual with bank account Given I have tenant as "paymentbb1" And I have the demo csv file "bulk_payment.csv" And I create a list of payee identifiers from csv file - When I can inject MockServer - Then I can start mock server And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 And I create a IdentityMapperDTO for registering beneficiary Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" @@ -146,8 +144,6 @@ Feature: Test ability to make payment to individual with bank account Then add last row to csv with current payer and payee, payment mode as "gsma" and transfer amount 8 and id 7 - When I can inject MockServer - Then I can start mock server And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 And I create a IdentityMapperDTO for registering beneficiary Then I call the register beneficiary API with expected status of 202 and stub "/registerBeneficiary" From 5bc9f9b196897c6fcd08aa8c97f21bc3e80f75e1 Mon Sep 17 00:00:00 2001 From: Apurb Rajdhan <103931815+apurbraj@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:19:19 +0530 Subject: [PATCH 10/10] wiremock --- .../integrationtest/config/WireMockServerSingleton.java | 5 ----- src/test/java/resources/bulkPayment.feature | 1 - 2 files changed, 6 deletions(-) diff --git a/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java index 9ced9e059..0e393b3f5 100644 --- a/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java +++ b/src/test/java/org/mifos/integrationtest/config/WireMockServerSingleton.java @@ -44,11 +44,6 @@ private static WireMockServer startWireMockServerWithRetry(int maxRetries) { throw new IllegalStateException("Failed to start WireMock server after " + maxRetries + " attempts."); } - private int getRandomPort() { - // This returns a port number in the range 1024-65535 - return 1024 + (int) (Math.random() * ((65535 - 1024) + 1)); - } - public static int getPort() { WireMockServer instance = threadLocalInstance.get(); if (instance != null && instance.isRunning()) { diff --git a/src/test/java/resources/bulkPayment.feature b/src/test/java/resources/bulkPayment.feature index 4ac4267e1..086061e2f 100644 --- a/src/test/java/resources/bulkPayment.feature +++ b/src/test/java/resources/bulkPayment.feature @@ -27,7 +27,6 @@ Feature: Test ability to make payment to individual with bank account Given I have tenant as "paymentbb2" And I have the demo csv file "bulk_payment_closedl_mock_mojaloop.csv" And I create a list of payee identifiers from csv file - When I can inject MockServer Then I can start mock server And I can register the stub with "/registerBeneficiary" endpoint for "PUT" request with status of 200 And I create a IdentityMapperDTO for registering beneficiary