diff --git a/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java b/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java index fa3ed0178..d745bd179 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/io/IdeProgressBarTest.java @@ -12,12 +12,13 @@ import com.devonfw.tools.ide.context.AbstractIdeContextTest; import com.devonfw.tools.ide.context.IdeContext; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Test of {@link IdeProgressBar}. */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class IdeProgressBarTest extends AbstractIdeContextTest { /** @@ -26,7 +27,7 @@ public class IdeProgressBarTest extends AbstractIdeContextTest { * @param tempDir temporary directory to use. */ @Test - public void testProgressBarDownloadWithValidContentLength(@TempDir Path tempDir) { + public void testProgressBarDownloadWithValidContentLength(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { int maxLength = 10_000; @@ -35,7 +36,7 @@ public void testProgressBarDownloadWithValidContentLength(@TempDir Path tempDir) IdeContext context = newContext(tempDir); FileAccess impl = context.getFileAccess(); - impl.download("http://localhost:8080/os/windows_x64_url.tgz", tempDir.resolve("windows_x64_url.tgz")); + impl.download(wmRuntimeInfo.getHttpBaseUrl() + "/os/windows_x64_url.tgz", tempDir.resolve("windows_x64_url.tgz")); assertThat(tempDir.resolve("windows_x64_url.tgz")).exists(); assertProgressBar(context, "Downloading", maxLength); } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMock.java index ec1e02df6..14d212e84 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMock.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMock.java @@ -8,6 +8,7 @@ import com.devonfw.tools.ide.url.model.folder.UrlVersion; import com.devonfw.tools.ide.url.updater.AbstractUrlUpdater; import com.devonfw.tools.ide.url.updater.UrlUpdater; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; /** * Test mock for {@link UrlUpdater} preparing multiple tool versions and distributions. @@ -16,6 +17,18 @@ public class UrlUpdaterMock extends AbstractUrlUpdater { private static final Set versions = new HashSet<>(Arrays.asList("1.0", "1.1", "1.2")); + WireMockRuntimeInfo wmRuntimeInfo; + + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public UrlUpdaterMock(WireMockRuntimeInfo wmRuntimeInfo) { + super(); + this.wmRuntimeInfo = wmRuntimeInfo; + } + @Override protected String getTool() { @@ -34,10 +47,10 @@ protected Set getVersions() { @Override protected void addVersion(UrlVersion urlVersion) { - doAddVersion(urlVersion, "http://localhost:8080/os/windows_x64_url.tgz", WINDOWS, X64, "123"); - doAddVersion(urlVersion, "http://localhost:8080/os/linux_x64_url.tgz", LINUX, X64, "123"); - doAddVersion(urlVersion, "http://localhost:8080/os/mac_x64_url.tgz", MAC, X64, "123"); - doAddVersion(urlVersion, "http://localhost:8080/os/mac_Arm64_url.tgz", MAC, ARM64, "123"); + doAddVersion(urlVersion, this.wmRuntimeInfo.getHttpBaseUrl() + "/os/windows_x64_url.tgz", WINDOWS, X64, "123"); + doAddVersion(urlVersion, this.wmRuntimeInfo.getHttpBaseUrl() + "/os/linux_x64_url.tgz", LINUX, X64, "123"); + doAddVersion(urlVersion, this.wmRuntimeInfo.getHttpBaseUrl() + "/os/mac_x64_url.tgz", MAC, X64, "123"); + doAddVersion(urlVersion, this.wmRuntimeInfo.getHttpBaseUrl() + "/os/mac_Arm64_url.tgz", MAC, ARM64, "123"); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMockSingle.java b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMockSingle.java index c9e5cee73..b31272829 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMockSingle.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterMockSingle.java @@ -6,6 +6,7 @@ import com.devonfw.tools.ide.url.model.folder.UrlVersion; import com.devonfw.tools.ide.url.updater.UrlUpdater; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; /** * Test mock for {@link UrlUpdater} using a single tool version and distribution. @@ -14,6 +15,16 @@ public class UrlUpdaterMockSingle extends UrlUpdaterMock { private static final Set versions = new HashSet<>(List.of("1.0")); + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public UrlUpdaterMockSingle(WireMockRuntimeInfo wmRuntimeInfo) { + + super(wmRuntimeInfo); + } + @Override protected Set getVersions() { return versions; @@ -21,7 +32,7 @@ protected Set getVersions() { @Override protected void addVersion(UrlVersion urlVersion) { - doAddVersion(urlVersion, "http://localhost:8080/os/windows_x64_url.tgz", WINDOWS, X64, "123"); + doAddVersion(urlVersion, wmRuntimeInfo.getHttpBaseUrl() + "/os/windows_x64_url.tgz", WINDOWS, X64, "123"); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterTest.java index 08b9c0e5a..d21ca746c 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/UrlUpdaterTest.java @@ -16,18 +16,19 @@ import com.devonfw.tools.ide.url.model.file.json.StatusJson; import com.devonfw.tools.ide.url.model.file.json.UrlStatus; import com.devonfw.tools.ide.url.model.folder.UrlRepository; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Test of {@link com.devonfw.tools.ide.url.updater.UrlUpdater} using wiremock to simulate network downloads. */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class UrlUpdaterTest extends AbstractUrlUpdaterTest { /** * Test resource location */ - private final static String testdataRoot = "src/test/resources/integrationtest/UrlUpdaterTest"; + private final static String TEST_DATA_ROOT = "src/test/resources/integrationtest/UrlUpdaterTest"; /** * Tests if the {@link com.devonfw.tools.ide.url.updater.UrlUpdater} can automatically add a missing OS (in this case the linux_x64) @@ -36,12 +37,12 @@ public class UrlUpdaterTest extends AbstractUrlUpdaterTest { * @throws IOException test fails */ @Test - public void testUrlUpdaterMissingOsGetsAddedAutomatically(@TempDir Path tempDir) throws IOException { + public void testUrlUpdaterMissingOsGetsAddedAutomatically(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) throws IOException { stubFor(any(urlMatching("/os/.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - UrlUpdaterMock updater = new UrlUpdaterMock(); + UrlUpdaterMock updater = new UrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -72,17 +73,17 @@ public void testUrlUpdaterMissingOsGetsAddedAutomatically(@TempDir Path tempDir) } @Test - public void testUrlUpdaterIsNotUpdatingWhenStatusManualIsTrue(@TempDir Path tempDir) { + public void testUrlUpdaterIsNotUpdatingWhenStatusManualIsTrue(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // arrange stubFor(any(urlMatching("/os/.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(); + UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(wmRuntimeInfo); // act updater.update(urlRepository); - Path versionsPath = Path.of(testdataRoot).resolve("mocked").resolve("mocked").resolve("1.0"); + Path versionsPath = Path.of(TEST_DATA_ROOT).resolve("mocked").resolve("mocked").resolve("1.0"); // assert assertThat(versionsPath.resolve("windows_x64.urls")).doesNotExist(); @@ -100,14 +101,14 @@ public void testUrlUpdaterIsNotUpdatingWhenStatusManualIsTrue(@TempDir Path temp * @param tempDir Temporary directory */ @Test - public void testUrlUpdaterStatusJsonRefreshBugStillExisting(@TempDir Path tempDir) { + public void testUrlUpdaterStatusJsonRefreshBugStillExisting(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { stubFor(any(urlMatching("/os/.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(); + UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(wmRuntimeInfo); - String statusUrl = "http://localhost:8080/os/windows_x64_url.tgz"; + String statusUrl = wmRuntimeInfo.getHttpBaseUrl() + "/os/windows_x64_url.tgz"; String toolName = "mocked"; String editionName = "mocked"; String versionName = "1.0"; @@ -173,13 +174,13 @@ public void testUrlUpdaterStatusJsonRefreshBugStillExisting(@TempDir Path tempDi * @param tempDir Temporary directory */ @Test - public void testUrlUpdaterWithTextContentTypeWillNotCreateStatusJson(@TempDir Path tempDir) { + public void testUrlUpdaterWithTextContentTypeWillNotCreateStatusJson(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given stubFor(any(urlMatching("/os/.*")).willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/plain").withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(); + UrlUpdaterMockSingle updater = new UrlUpdaterMockSingle(wmRuntimeInfo); // when updater.update(urlRepository); diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioJsonUrlUpdaterTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioJsonUrlUpdaterTest.java index 36cf18d90..bb88cd62d 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioJsonUrlUpdaterTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioJsonUrlUpdaterTest.java @@ -11,45 +11,65 @@ import java.nio.file.Path; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import com.devonfw.tools.ide.url.model.folder.UrlRepository; import com.devonfw.tools.ide.url.updater.JsonUrlUpdater; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Test class for integrations of the {@link AndroidStudioUrlUpdater}. */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class AndroidStudioJsonUrlUpdaterTest extends Assertions { /** * Test resource location */ - private final static String testdataRoot = "src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater"; + private final static String TEST_DATA_ROOT = "src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater"; /** This is the SHA256 checksum of aBody (a placeholder body which gets returned by WireMock) */ private static final String EXPECTED_ABODY_CHECKSUM = "de08da1685e537e887fbbe1eb3278fed38aff9da5d112d96115150e8771a0f30"; + private static String androidVersionJson; + private static String androidVersionWithoutChecksumJson; + + /** + * Creates an android-version and android-version-without-checksum json file based on the given test resource in a temporary directory according to the http + * url and port of the {@link WireMockRuntimeInfo}. + * + * @param wmRuntimeInfo wireMock server on a random port + * @throws IOException + */ + @BeforeAll + public static void setupTestVersionJson(WireMockRuntimeInfo wmRuntimeInfo) throws IOException { + //preparing test data with dynamic port + androidVersionJson = Files.readString(Path.of(TEST_DATA_ROOT).resolve("android-version.json")); + androidVersionJson = androidVersionJson.replaceAll("\\$\\{testbaseurl}", wmRuntimeInfo.getHttpBaseUrl()); + + androidVersionWithoutChecksumJson = Files.readString(Path.of(TEST_DATA_ROOT).resolve("android-version-without-checksum.json")); + androidVersionWithoutChecksumJson = androidVersionWithoutChecksumJson.replaceAll("\\$\\{testbaseurl}", wmRuntimeInfo.getHttpBaseUrl()); + } + /** * Test of {@link JsonUrlUpdater} for the creation of {@link AndroidStudioUrlUpdater} to download URLs and checksums. * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir) throws IOException { + public void testJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(testdataRoot).resolve("android-version.json"))))); + stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200).withBody(androidVersionJson.getBytes()))); - stubFor(any(urlMatching("/edgedl/android/studio/ide-zips.*")) - .willReturn(aResponse().withStatus(200).withBody("aBody"))); + stubFor(any(urlMatching("/edgedl/android/studio/ide-zips.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(); + AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -73,20 +93,18 @@ public void testJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path temp * Test if {@link AndroidStudioUrlUpdater} can handle downloads with missing checksums (generate checksum from download file if no checksum was provided) * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFolder(@TempDir Path tempDir) - throws IOException { + public void testJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFolder(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(testdataRoot).resolve("android-version.json"))))); + stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200).withBody(androidVersionJson.getBytes()))); stubFor(get(urlMatching("/edgedl/android/studio/ide-zips.*")).willReturn(aResponse().withStatus(404))); UrlRepository urlRepository = UrlRepository.load(tempDir); - AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(); + AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -103,20 +121,18 @@ public void testJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFolder(@Te * no checksum was provided) * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testJsonUrlUpdaterWithMissingChecksumGeneratesChecksum(@TempDir Path tempDir) throws IOException { + public void testJsonUrlUpdaterWithMissingChecksumGeneratesChecksum(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(testdataRoot).resolve("android-version-without-checksum.json"))))); + stubFor(get(urlMatching("/android-studio-releases-list.*")).willReturn(aResponse().withStatus(200).withBody(androidVersionWithoutChecksumJson.getBytes()))); - stubFor(any(urlMatching("/edgedl/android/studio/ide-zips.*")) - .willReturn(aResponse().withStatus(200).withBody("aBody"))); + stubFor(any(urlMatching("/edgedl/android/studio/ide-zips.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(); + AndroidStudioUrlUpdaterMock updater = new AndroidStudioUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -124,8 +140,7 @@ public void testJsonUrlUpdaterWithMissingChecksumGeneratesChecksum(@TempDir Path Path androidStudioVersionsPath = tempDir.resolve("android-studio").resolve("android-studio").resolve("2023.1.1.2"); // then - assertThat(androidStudioVersionsPath.resolve("windows_x64.urls.sha256")).exists() - .hasContent(EXPECTED_ABODY_CHECKSUM); + assertThat(androidStudioVersionsPath.resolve("windows_x64.urls.sha256")).exists().hasContent(EXPECTED_ABODY_CHECKSUM); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioUrlUpdaterMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioUrlUpdaterMock.java index bc799fcd0..67fd8919e 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioUrlUpdaterMock.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/androidstudio/AndroidStudioUrlUpdaterMock.java @@ -1,18 +1,28 @@ package com.devonfw.tools.ide.tool.androidstudio; import com.devonfw.tools.ide.url.updater.JsonUrlUpdater; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; /** * {@link JsonUrlUpdater} test mock for Android Studio. */ public class AndroidStudioUrlUpdaterMock extends AndroidStudioUrlUpdater { - /** The base URL used for WireMock */ - private final static String TEST_BASE_URL = "http://localhost:8080"; + WireMockRuntimeInfo wmRuntimeInfo; + + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public AndroidStudioUrlUpdaterMock(WireMockRuntimeInfo wmRuntimeInfo) { + super(); + this.wmRuntimeInfo = wmRuntimeInfo; + } @Override protected String getVersionBaseUrl() { - return TEST_BASE_URL; + return wmRuntimeInfo.getHttpBaseUrl(); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijJsonUrlUpdaterTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijJsonUrlUpdaterTest.java index e7e693586..932f98356 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijJsonUrlUpdaterTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijJsonUrlUpdaterTest.java @@ -11,44 +11,64 @@ import java.nio.file.Path; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import com.devonfw.tools.ide.url.model.folder.UrlRepository; import com.devonfw.tools.ide.url.updater.JsonUrlUpdater; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Test class for integrations of the {@link IntellijUrlUpdater} */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class IntellijJsonUrlUpdaterTest extends Assertions { - /** - * Test resource location - */ + /** Test resource location */ private final static String TEST_DATA_ROOT = "src/test/resources/integrationtest/IntellijJsonUrlUpdater"; /** This is the SHA256 checksum of aBody (a placeholder body which gets returned by WireMock) */ private static final String EXPECTED_ABODY_CHECKSUM = "de08da1685e537e887fbbe1eb3278fed38aff9da5d112d96115150e8771a0f30"; + private static String intellijVersionJson; + private static String intellijVersionWithoutChecksumJson; + + /** + * Creates an intellij-version and intellij-version-without-checksum json file based on the given test resource in a temporary directory according to the http + * url and port of the {@link WireMockRuntimeInfo}. + * + * @param wmRuntimeInfo wireMock server on a random port + * @throws IOException + */ + @BeforeAll + public static void setupTestVersionJson(WireMockRuntimeInfo wmRuntimeInfo) throws IOException { + //preparing test data with dynamic port + Path testDataPath = Path.of(TEST_DATA_ROOT); + intellijVersionJson = Files.readString(testDataPath.resolve("intellij-version.json")); + intellijVersionJson = intellijVersionJson.replaceAll("\\$\\{testbaseurl}", wmRuntimeInfo.getHttpBaseUrl()); + + intellijVersionWithoutChecksumJson = Files.readString(testDataPath.resolve("intellij-version-without-checksum.json")); + intellijVersionWithoutChecksumJson = intellijVersionWithoutChecksumJson.replaceAll("\\$\\{testbaseurl}", wmRuntimeInfo.getHttpBaseUrl()); + } + /** * Test of {@link JsonUrlUpdater} for the creation of {@link IntellijUrlUpdater} download URLs and checksums. * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testIntellijJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir) throws IOException { + public void testIntellijJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(TEST_DATA_ROOT).resolve("intellij-version.json"))))); + stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200).withBody(intellijVersionJson.getBytes()))); stubFor(any(urlMatching("/idea/idea.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(); + IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -67,20 +87,18 @@ public void testIntellijJsonUrlUpdaterCreatesDownloadUrlsAndChecksums(@TempDir P * checksum was provided) * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testIntellijJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFolder(@TempDir Path tempDir) - throws IOException { + public void testIntellijJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFolder(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(TEST_DATA_ROOT).resolve("intellij-version.json"))))); + stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200).withBody(intellijVersionJson.getBytes()))); stubFor(any(urlMatching("/idea/idea.*")).willReturn(aResponse().withStatus(404))); UrlRepository urlRepository = UrlRepository.load(tempDir); - IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(); + IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); @@ -97,19 +115,18 @@ public void testIntellijJsonUrlUpdaterWithMissingDownloadsDoesNotCreateVersionFo * checksum was provided) * * @param tempDir Path to a temporary directory - * @throws IOException test fails + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testIntellijJsonUrlUpdaterWithMissingChecksumGeneratesChecksum(@TempDir Path tempDir) throws IOException { + public void testIntellijJsonUrlUpdaterWithMissingChecksumGeneratesChecksum(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(TEST_DATA_ROOT).resolve("intellij-version-withoutchecksum.json"))))); + stubFor(get(urlMatching("/products.*")).willReturn(aResponse().withStatus(200).withBody(intellijVersionWithoutChecksumJson.getBytes()))); stubFor(any(urlMatching("/idea/idea.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(); + IntellijUrlUpdaterMock updater = new IntellijUrlUpdaterMock(wmRuntimeInfo); // when updater.update(urlRepository); diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java index d7d0e4688..0bddf754d 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijTest.java @@ -6,6 +6,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -17,18 +18,17 @@ import com.devonfw.tools.ide.log.IdeLogLevel; import com.devonfw.tools.ide.os.SystemInfo; import com.devonfw.tools.ide.os.SystemInfoMock; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Integration test of {@link Intellij}. */ -// TODO: replace with dynamic ports, see: https://github.com/devonfw/IDEasy/pull/487 -@WireMockTest(httpPort = 8080) +@WireMockTest public class IntellijTest extends AbstractIdeContextTest { private static final String PROJECT_INTELLIJ = "intellij"; private static final String MOCKED_PLUGIN_JAR = "mocked-plugin.jar"; - private final IdeTestContext context = newContext(PROJECT_INTELLIJ); /** @@ -39,10 +39,10 @@ public class IntellijTest extends AbstractIdeContextTest { */ @ParameterizedTest @ValueSource(strings = { "windows", "mac", "linux" }) - public void testIntellijInstall(String os) throws IOException { + public void testIntellijInstall(String os, WireMockRuntimeInfo wmRuntimeInfo) throws IOException { // arrange - setupMockedPlugin(); + setupMockedPlugin(wmRuntimeInfo); SystemInfo systemInfo = SystemInfoMock.of(os); this.context.setSystemInfo(systemInfo); Intellij commandlet = new Intellij(this.context); @@ -66,10 +66,10 @@ public void testIntellijInstall(String os) throws IOException { */ @ParameterizedTest @ValueSource(strings = { "windows", "mac", "linux" }) - public void testIntellijRun(String os) throws IOException { + public void testIntellijRun(String os, WireMockRuntimeInfo wmRuntimeInfo) throws IOException { // arrange - setupMockedPlugin(); + setupMockedPlugin(wmRuntimeInfo); SystemInfo systemInfo = SystemInfoMock.of(os); this.context.setSystemInfo(systemInfo); Intellij commandlet = new Intellij(this.context); @@ -101,7 +101,11 @@ private void checkInstallation(IdeTestContext context) { assertThat(context.getPluginsPath().resolve("intellij").resolve("mockedPlugin").resolve("MockedClass.class")).exists(); } - private void setupMockedPlugin() throws IOException { + private void setupMockedPlugin(WireMockRuntimeInfo wmRuntimeInfo) throws IOException { + + String content = "plugin_id=mockedPlugin\nplugin_active=true\nplugin_url=" + wmRuntimeInfo.getHttpBaseUrl() + "/mockedPlugin"; + Files.write(this.context.getSettingsPath().resolve("intellij").resolve("plugins").resolve("MockedPlugin.properties"), + content.getBytes(StandardCharsets.UTF_8)); Path mockedPlugin = this.context.getIdeRoot().resolve("repository").resolve(MOCKED_PLUGIN_JAR); byte[] contentBytes = Files.readAllBytes(mockedPlugin); @@ -111,4 +115,5 @@ private void setupMockedPlugin() throws IOException { aResponse().withStatus(200).withHeader("Content-Type", "application/java-archive").withHeader("Content-Length", String.valueOf(contentLength)) .withBody(contentBytes))); } + } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijUrlUpdaterMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijUrlUpdaterMock.java index c85bdbd2c..4c570ac31 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijUrlUpdaterMock.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/intellij/IntellijUrlUpdaterMock.java @@ -1,15 +1,27 @@ package com.devonfw.tools.ide.tool.intellij; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; + /** * Mock of {@link IntellijUrlUpdater} to allow integration testing with wiremock. */ public class IntellijUrlUpdaterMock extends IntellijUrlUpdater { - private final static String TEST_BASE_URL = "http://localhost:8080"; + WireMockRuntimeInfo wmRuntimeInfo; + + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public IntellijUrlUpdaterMock(WireMockRuntimeInfo wmRuntimeInfo) { + super(); + this.wmRuntimeInfo = wmRuntimeInfo; + } @Override protected String getVersionBaseUrl() { - return TEST_BASE_URL; + return wmRuntimeInfo.getHttpBaseUrl(); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterMock.java index 8888f36e6..c84ffc177 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterMock.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterMock.java @@ -5,16 +5,27 @@ import java.util.Set; import com.devonfw.tools.ide.url.model.folder.UrlVersion; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; /** * Test mock for {@link PipUrlUpdater} */ public class PipUrlUpdaterMock extends PipUrlUpdater { - private final static String TEST_BASE_URL = "http://localhost:8080"; - private static final Set versions = new HashSet<>(List.of("1.0")); + WireMockRuntimeInfo wmRuntimeInfo; + + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public PipUrlUpdaterMock(WireMockRuntimeInfo wmRuntimeInfo) { + super(); + this.wmRuntimeInfo = wmRuntimeInfo; + } + @Override protected Set getVersions() { @@ -24,6 +35,6 @@ protected Set getVersions() { @Override protected void addVersion(UrlVersion urlVersion) { - doAddVersion(urlVersion, TEST_BASE_URL + "/pip/${version}/get-pip.py"); + doAddVersion(urlVersion, this.wmRuntimeInfo.getHttpBaseUrl() + "/pip/${version}/get-pip.py"); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterTest.java index 4e0f6a5c1..c92e67f24 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/pip/PipUrlUpdaterTest.java @@ -15,12 +15,13 @@ import com.devonfw.tools.ide.url.model.file.json.StatusJson; import com.devonfw.tools.ide.url.model.file.json.UrlStatus; import com.devonfw.tools.ide.url.model.folder.UrlRepository; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * Test of {@link PipUrlUpdater} based on Wiremock. */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class PipUrlUpdaterTest extends AbstractUrlUpdaterTest { /** @@ -31,16 +32,16 @@ public class PipUrlUpdaterTest extends AbstractUrlUpdaterTest { * @param tempDir Temporary directory */ @Test - public void testPipUrlUpdaterWithTextContentTypeWillSucceed(@TempDir Path tempDir) { + public void testPipUrlUpdaterWithTextContentTypeWillSucceed(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given stubFor(any(urlMatching("/pip/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/plain").withBody("aBody"))); UrlRepository urlRepository = UrlRepository.load(tempDir); - PipUrlUpdaterMock updater = new PipUrlUpdaterMock(); + PipUrlUpdaterMock updater = new PipUrlUpdaterMock(wmRuntimeInfo); - String statusUrl = "http://localhost:8080/pip/1.0/get-pip.py"; + String statusUrl = wmRuntimeInfo.getHttpBaseUrl() + "/pip/1.0/get-pip.py"; String toolName = "pip"; String editionName = "pip"; String versionName = "1.0"; diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterMock.java b/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterMock.java index 3ac455af7..9de6ee14e 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterMock.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterMock.java @@ -1,15 +1,27 @@ package com.devonfw.tools.ide.tool.python; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; + /** * {@Link JsonUrlUpdater} test mock for Python */ public class PythonUrlUpdaterMock extends PythonUrlUpdater { - private final static String TEST_BASE_URL = "http://localhost:8080"; + WireMockRuntimeInfo wmRuntimeInfo; + + /** + * The constructor + * + * @param wmRuntimeInfo the {@link WireMockRuntimeInfo} holding the http url and port of the wiremock server. + */ + public PythonUrlUpdaterMock(WireMockRuntimeInfo wmRuntimeInfo) { + super(); + this.wmRuntimeInfo = wmRuntimeInfo; + } @Override protected String getVersionBaseUrl() { - return TEST_BASE_URL; + return wmRuntimeInfo.getHttpBaseUrl(); } } diff --git a/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterTest.java b/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterTest.java index b6094671e..df7dd3c72 100644 --- a/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterTest.java +++ b/cli/src/test/java/com/devonfw/tools/ide/tool/python/PythonUrlUpdaterTest.java @@ -7,44 +7,62 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import com.devonfw.tools.ide.url.model.folder.UrlRepository; +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo; import com.github.tomakehurst.wiremock.junit5.WireMockTest; /** * {@link WireMockTest} using {@link PythonUrlUpdaterMock}. */ -@WireMockTest(httpPort = 8080) +@WireMockTest public class PythonUrlUpdaterTest extends Assertions { - private final static String testdataRoot = "src/test/resources/integrationtest/PythonJsonUrlUpdater"; + /** Test resource location */ + private final static String TEST_DATA_ROOT = "src/test/resources/integrationtest/PythonJsonUrlUpdater"; + private static String pythonVersionJson; + + /** + * Creates a python-version json file based on the given test resource in a temporary directory according to the http url and port of the + * {@link WireMockRuntimeInfo}. + * + * @param wmRuntimeInfo wireMock server on a random port + * @throws IOException + */ + @BeforeAll + public static void setupTestVersionJson(WireMockRuntimeInfo wmRuntimeInfo) throws IOException { + //preparing test data with dynamic port + pythonVersionJson = new String(Files.readAllBytes(Path.of(TEST_DATA_ROOT).resolve("python-version.json")), StandardCharsets.UTF_8); + pythonVersionJson = pythonVersionJson.replaceAll("\\$\\{testbaseurl}", wmRuntimeInfo.getHttpBaseUrl()); + } + /** * Test Python JsonUrlUpdater * - * @param tempPath Path to a temporary directory - * @throws IOException test fails + * @param tempDir Path to a temporary directory + * @param wmRuntimeInfo wireMock server on a random port */ @Test - public void testPythonURl(@TempDir Path tempPath) throws IOException { + public void testPythonURl(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) { // given - stubFor(get(urlMatching("/actions/python-versions/main/.*")).willReturn(aResponse().withStatus(200) - .withBody(Files.readAllBytes(Path.of(testdataRoot).resolve("python-version.json"))))); + stubFor(get(urlMatching("/actions/python-versions/main/.*")).willReturn(aResponse().withStatus(200).withBody(pythonVersionJson.getBytes()))); - stubFor(any(urlMatching("/actions/python-versions/releases/download.*")).willReturn( - aResponse().withStatus(200).withBody("aBody"))); + stubFor(any(urlMatching("/actions/python-versions/releases/download.*")).willReturn(aResponse().withStatus(200).withBody("aBody"))); - UrlRepository urlRepository = UrlRepository.load(tempPath); - PythonUrlUpdaterMock pythonUpdaterMock = new PythonUrlUpdaterMock(); + UrlRepository urlRepository = UrlRepository.load(tempDir); + PythonUrlUpdaterMock pythonUpdaterMock = new PythonUrlUpdaterMock(wmRuntimeInfo); pythonUpdaterMock.update(urlRepository); - Path pythonPath = tempPath.resolve("python").resolve("python").resolve("3.12.0"); + Path pythonPath = tempDir.resolve("python").resolve("python").resolve("3.12.0"); assertThat(pythonPath.resolve("status.json")).exists(); assertThat(pythonPath.resolve("linux_x64.urls")).exists(); diff --git a/cli/src/test/resources/ide-projects/intellij/project/settings/intellij/plugins/MockedPlugin.properties b/cli/src/test/resources/ide-projects/intellij/project/settings/intellij/plugins/MockedPlugin.properties index f11d3a113..e69de29bb 100644 --- a/cli/src/test/resources/ide-projects/intellij/project/settings/intellij/plugins/MockedPlugin.properties +++ b/cli/src/test/resources/ide-projects/intellij/project/settings/intellij/plugins/MockedPlugin.properties @@ -1,4 +0,0 @@ -plugin_id=mockedPlugin -plugin_active=true -plugin_url=http://localhost:8080/mockedPlugin -#plugin_url=https://plugins.jetbrains.com/pluginManager?action=download&id=dev.xframe.foldercompact&build=IC-241.18034.62 diff --git a/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version-without-checksum.json b/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version-without-checksum.json index 010475781..836448672 100644 --- a/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version-without-checksum.json +++ b/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version-without-checksum.json @@ -7,7 +7,7 @@ "download": [ { "size": "1.1 GB", - "link": "http://localhost:8080/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-windows.zip", + "link": "${testbaseurl}/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-windows.zip", "checksum": "" } ], diff --git a/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version.json b/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version.json index 69d7bbd93..76d161ea6 100644 --- a/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version.json +++ b/cli/src/test/resources/integrationtest/AndroidStudioJsonUrlUpdater/android-version.json @@ -7,42 +7,42 @@ "download": [ { "size": "904.7 MB", - "link": "http://localhost:8080/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-cros.deb", + "link": "${testbaseurl}/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-cros.deb", "checksum": "8dd65d06c032f374d409ef8c7f8c90e03934cf43c9da5b2c520676110d4b4fbf" }, { "size": "1.2 GB", - "link": "http://localhost:8080/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-mac_arm.dmg", + "link": "${testbaseurl}edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-mac_arm.dmg", "checksum": "278da82750144ec626a00958a4b25fd70b628252691f278644bedfccdeeb7e8a" }, { "size": "1.2 GB", - "link": "http://localhost:8080/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-mac.dmg", + "link": "${testbaseurl}/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-mac.dmg", "checksum": "cc0e2a8a313d5ef76d896f3a8bdcc1e9740715c2f134486d7d912387206b0b2f" }, { "size": "1.1 GB", - "link": "http://localhost:8080/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-windows.exe", + "link": "${testbaseurl}/edgedl/android/studio/install/2023.1.1.2/android-studio-2023.1.1.2-windows.exe", "checksum": "34b2595e422f1194a209048b0454e9a934ab8f6f3686c9e4c5d57c67f2efb8da" }, { "size": "1.2 GB", - "link": "http://localhost:8080/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-linux.tar.gz", + "link": "${testbaseurl}/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-linux.tar.gz", "checksum": "4c190221010d5613dc0f35f52d0461366e27172ead4e5b07b1102d76a98ccd9e" }, { "size": "1.2 GB", - "link": "http://localhost:8080/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-mac_arm.zip", + "link": "${testbaseurl}/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-mac_arm.zip", "checksum": "5a76ec230208a6ddbaeeadfe275b683bd7009fc3951c228710ee6d57af373852" }, { "size": "1.2 GB", - "link": "http://localhost:8080/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-mac.zip", + "link": "${testbaseurl}/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-mac.zip", "checksum": "302cc162d901d1be1620ab38b78fc9e820cf7f5914d5335e8b1ba7d6e38d0ae1" }, { "size": "1.1 GB", - "link": "http://localhost:8080/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-windows.zip", + "link": "${testbaseurl}/edgedl/android/studio/ide-zips/2023.1.1.2/android-studio-2023.1.1.2-windows.zip", "checksum": "75696de870547664823b39a0cf47bad56a61e1b369233e7d0bc9c58c0033b3a4" } ], diff --git a/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-withoutchecksum.json b/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-without-checksum.json similarity index 63% rename from cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-withoutchecksum.json rename to cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-without-checksum.json index b85bdf3a8..9538e2b69 100644 --- a/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-withoutchecksum.json +++ b/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version-without-checksum.json @@ -6,11 +6,11 @@ "date": "2023-05-16", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.2-aarch64.tar.gz", + "link": "${testbaseurl}/idea/ideaIU-2023.1.2-aarch64.tar.gz", "checksumLink": "" }, "linux": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.2.tar.gz", + "link": "${testbaseurl}/idea/ideaIU-2023.1.2.tar.gz", "checksumLink": "" } }, @@ -20,11 +20,11 @@ "date": "2023-04-28", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.1-aarch64.tar.gz", + "link": "${testbaseurl}/idea/ideaIU-2023.1.1-aarch64.tar.gz", "checksumLink": "" }, "linux": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.1.tar.gz", + "link": "${testbaseurl}/idea/ideaIU-2023.1.1.tar.gz", "checksumLink": "" } }, @@ -39,11 +39,11 @@ "date": "2023-05-16", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.2-aarch64.tar.gz", + "link": "${testbaseurl}/idea/ideaIC-2023.1.2-aarch64.tar.gz", "checksumLink": "" }, "linux": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.2.tar.gz", + "link": "${testbaseurl}/idea/ideaIC-2023.1.2.tar.gz", "checksumLink": "" } }, @@ -53,11 +53,11 @@ "date": "2023-04-28", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.1-aarch64.tar.gz", + "link": "${testbaseurl}/idea/ideaIC-2023.1.1-aarch64.tar.gz", "checksumLink": "" }, "linux": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.1.tar.gz", + "link": "${testbaseurl}/idea/ideaIC-2023.1.1.tar.gz", "checksumLink": "" } }, @@ -65,4 +65,4 @@ } ] } -] \ No newline at end of file +] diff --git a/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version.json b/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version.json index b5ec4ca5d..dc6d226d3 100644 --- a/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version.json +++ b/cli/src/test/resources/integrationtest/IntellijJsonUrlUpdater/intellij-version.json @@ -6,12 +6,12 @@ "date": "2023-05-16", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.2-aarch64.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIU-2023.1.2-aarch64.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIU-2023.1.2-aarch64.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIU-2023.1.2-aarch64.tar.gz.sha256" }, "linux": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.2.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIU-2023.1.2.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIU-2023.1.2.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIU-2023.1.2.tar.gz.sha256" } }, "version": "2023.1.2" @@ -20,12 +20,12 @@ "date": "2023-04-28", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.1-aarch64.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIU-2023.1.1-aarch64.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIU-2023.1.1-aarch64.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIU-2023.1.1-aarch64.tar.gz.sha256" }, "linux": { - "link": "http://localhost:8080/idea/ideaIU-2023.1.1.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIU-2023.1.1.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIU-2023.1.1.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIU-2023.1.1.tar.gz.sha256" } }, "version": "2023.1.1" @@ -39,12 +39,12 @@ "date": "2023-05-16", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.2-aarch64.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIC-2023.1.2-aarch64.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIC-2023.1.2-aarch64.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIC-2023.1.2-aarch64.tar.gz.sha256" }, "linux": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.2.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIC-2023.1.2.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIC-2023.1.2.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIC-2023.1.2.tar.gz.sha256" } }, "version": "2023.1.2" @@ -53,16 +53,16 @@ "date": "2023-04-28", "downloads": { "linuxARM64": { - "link": "http://localhost:8080/ideaIC-2023.1.1-aarch64.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIC-2023.1.1-aarch64.tar.gz.sha256" + "link": "${testbaseurl}/ideaIC-2023.1.1-aarch64.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIC-2023.1.1-aarch64.tar.gz.sha256" }, "linux": { - "link": "http://localhost:8080/idea/ideaIC-2023.1.1.tar.gz", - "checksumLink": "http://localhost:8080/idea/ideaIC-2023.1.1.tar.gz.sha256" + "link": "${testbaseurl}/idea/ideaIC-2023.1.1.tar.gz", + "checksumLink": "${testbaseurl}/idea/ideaIC-2023.1.1.tar.gz.sha256" } }, "version": "2023.1.1" } ] } -] \ No newline at end of file +] diff --git a/cli/src/test/resources/integrationtest/PythonJsonUrlUpdater/python-version.json b/cli/src/test/resources/integrationtest/PythonJsonUrlUpdater/python-version.json index 7afa5ef15..9b6cb097a 100644 --- a/cli/src/test/resources/integrationtest/PythonJsonUrlUpdater/python-version.json +++ b/cli/src/test/resources/integrationtest/PythonJsonUrlUpdater/python-version.json @@ -8,39 +8,39 @@ "filename": "python-3.12.0-darwin-arm64.tar.gz", "arch": "arm64", "platform": "darwin", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-darwin-arm64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-darwin-arm64.tar.gz" }, { "filename": "python-3.12.0-darwin-x64.tar.gz", "arch": "x64", "platform": "darwin", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-darwin-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-darwin-x64.tar.gz" }, { "filename": "python-3.12.0-linux-20.04-x64.tar.gz", "arch": "x64", "platform": "linux", "platform_version": "20.04", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-linux-20.04-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-linux-20.04-x64.tar.gz" }, { "filename": "python-3.12.0-linux-22.04-x64.tar.gz", "arch": "x64", "platform": "linux", "platform_version": "22.04", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-linux-22.04-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-linux-22.04-x64.tar.gz" }, { "filename": "python-3.12.0-win32-x64.zip", "arch": "x64", "platform": "win32", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-win32-x64.zip" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-win32-x64.zip" }, { "filename": "python-3.12.0-win32-x86.zip", "arch": "x86", "platform": "win32", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-win32-x86.zip" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-6381888192/python-3.12.0-win32-x86.zip" } ] }, @@ -53,39 +53,39 @@ "filename": "python-3.12.0-beta.1-darwin-arm64.tar.gz", "arch": "arm64", "platform": "darwin", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-darwin-arm64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-darwin-arm64.tar.gz" }, { "filename": "python-3.12.0-beta.1-darwin-x64.tar.gz", "arch": "x64", "platform": "darwin", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-darwin-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-darwin-x64.tar.gz" }, { "filename": "python-3.12.0-beta.1-linux-20.04-x64.tar.gz", "arch": "x64", "platform": "linux", "platform_version": "20.04", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-linux-20.04-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-linux-20.04-x64.tar.gz" }, { "filename": "python-3.12.0-beta.1-linux-22.04-x64.tar.gz", "arch": "x64", "platform": "linux", "platform_version": "22.04", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-linux-22.04-x64.tar.gz" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-linux-22.04-x64.tar.gz" }, { "filename": "python-3.12.0-beta.1-win32-x64.zip", "arch": "x64", "platform": "win32", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-win32-x64.zip" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-win32-x64.zip" }, { "filename": "python-3.12.0-beta.1-win32-x86.zip", "arch": "x86", "platform": "win32", - "download_url": "http://localhost:8080/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-win32-x86.zip" + "download_url": "${testbaseurl}/actions/python-versions/releases/download/3.12.0-beta.1-5076755295/python-3.12.0-beta.1-win32-x86.zip" } ] }