From e4e8e09152ded3e2a365c357c0346bd2f13b1e1b Mon Sep 17 00:00:00 2001 From: delarea Date: Mon, 11 Nov 2024 17:44:17 +0200 Subject: [PATCH] Fix tests --- .../client/AccessManagerTest.java | 2 +- .../org/jfrog/build/IntegrationTestsBase.java | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/build-info-extractor/src/test/java/org/jfrog/build/extractor/clientConfiguration/client/AccessManagerTest.java b/build-info-extractor/src/test/java/org/jfrog/build/extractor/clientConfiguration/client/AccessManagerTest.java index be51d1cb5..6f8120596 100644 --- a/build-info-extractor/src/test/java/org/jfrog/build/extractor/clientConfiguration/client/AccessManagerTest.java +++ b/build-info-extractor/src/test/java/org/jfrog/build/extractor/clientConfiguration/client/AccessManagerTest.java @@ -45,7 +45,7 @@ public class AccessManagerTest extends IntegrationTestsBase { @BeforeClass @Override public void init() throws IOException { - super.init(); + super.init(true); String accessUrl = getPlatformUrl() + "access"; accessManager = new AccessManager(accessUrl, getAdminToken(), getLog()); } diff --git a/build-info-extractor/src/testFixtures/java/org/jfrog/build/IntegrationTestsBase.java b/build-info-extractor/src/testFixtures/java/org/jfrog/build/IntegrationTestsBase.java index cae5263ed..e6b321c64 100644 --- a/build-info-extractor/src/testFixtures/java/org/jfrog/build/IntegrationTestsBase.java +++ b/build-info-extractor/src/testFixtures/java/org/jfrog/build/IntegrationTestsBase.java @@ -59,8 +59,7 @@ public static Log getLog() { return log; } - @BeforeClass - public void init() throws IOException { + public void init(boolean isAccessTest) throws IOException { Properties props = new Properties(); // This file is not in GitHub. Create your own in src/test/resources or use environment variables. InputStream inputStream = this.getClass().getResourceAsStream("/artifactory-bi.properties"); @@ -69,8 +68,13 @@ public void init() throws IOException { props.load(inputStream); inputStream.close(); } + String testPort = "8081"; + // Change the port variable only if isAccessTest is true + if (isAccessTest) { + testPort = "8082"; + } - platformUrl = readParam(props, "url", "http://127.0.0.1:8082"); + platformUrl = readParam(props, "url", "http://127.0.0.1:" + testPort); if (!platformUrl.endsWith("/")) { platformUrl += "/"; } @@ -92,6 +96,16 @@ public void init() throws IOException { } } + @BeforeClass + public void init() throws IOException { + init(false); + } + + @BeforeClass + public void accessInit() throws IOException { + init(true); + } + @AfterClass protected void terminate() throws IOException { // Delete the virtual first.