Skip to content

Commit 6bae747

Browse files
#1905: Created a UrlUpdater for Inso Cli (#1907)
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
1 parent 66befb0 commit 6bae747

5 files changed

Lines changed: 325 additions & 2 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package com.devonfw.tools.ide.url.tool.inso;
2+
3+
import com.devonfw.tools.ide.url.model.folder.UrlVersion;
4+
import com.devonfw.tools.ide.url.updater.GithubUrlReleaseUpdater;
5+
import com.devonfw.tools.ide.url.updater.GithubUrlTagUpdater;
6+
import com.devonfw.tools.ide.version.VersionIdentifier;
7+
8+
/**
9+
* {@link GithubUrlTagUpdater} for GitHub Insomnia CLI.
10+
* <p>
11+
* Follows the official installation structure from GitHub's insomnia repository: <a
12+
* href="https://github.com/Kong/insomnia">https://github.com/Kong/insomnia</a>.
13+
* <p>
14+
* Download URL pattern: https://github.com/Kong/insomnia/releases/download/core@${version}/inso-${os}-${version}.${ext} Examples: - <a
15+
* href="https://github.com/Kong/insomnia/releases/download/core@12.5.0/inso-linux-x64-12.5.0.tar.xz">github.com/Kong/insomnia/releases/download/core@12.5.0/inso-linux-x64-12.5.0.tar.xz</a>
16+
* - <a
17+
* href="https://github.com/Kong/insomnia/releases/download/core@12.5.0-beta.0/inso-windows-12.5.0-beta.0.zip">github.com/Kong/insomnia/releases/download/core@12.5.0-beta.0/inso-windows-12.5.0-beta.0.zip</a>
18+
*/
19+
public class InsoUrlUpdater extends GithubUrlReleaseUpdater {
20+
21+
private static final String BASE_URL = "https://github.com";
22+
private static final String BOX_EMOJI = "\uD83D\uDCE6";
23+
private static final VersionIdentifier MIN_INSO_VID = VersionIdentifier.of("11.5.0");
24+
25+
@Override
26+
protected String getGithubOrganization() {
27+
return "Kong";
28+
}
29+
30+
@Override
31+
public String getTool() {
32+
return "inso";
33+
}
34+
35+
@Override
36+
protected String getDownloadBaseUrl() {
37+
return BASE_URL;
38+
}
39+
40+
@Override
41+
protected String getGithubRepository() {
42+
return "insomnia";
43+
}
44+
45+
@Override
46+
protected String getVersionPrefixToRemove() {
47+
return "core@";
48+
}
49+
50+
@Override
51+
public String mapVersion(String version) {
52+
String sanitizedVersion = version.replace(BOX_EMOJI, "").trim();
53+
return super.mapVersion(sanitizedVersion);
54+
}
55+
56+
@Override
57+
public String getCpeVendor() {
58+
return "konghq";
59+
}
60+
61+
@Override
62+
public String getCpeProduct() {
63+
return "insomnia";
64+
}
65+
66+
@Override
67+
protected void addVersion(UrlVersion urlVersion) {
68+
VersionIdentifier vid = urlVersion.getVersionIdentifier();
69+
70+
if (vid.compareVersion(MIN_INSO_VID).isGreater()) {
71+
72+
String baseUrl = createGithubReleaseDownloadUrl("core@${version}", "inso-");
73+
74+
doAddVersion(urlVersion, baseUrl + "linux-x64-${version}.tar.xz", LINUX);
75+
doAddVersion(urlVersion, baseUrl + "macos-${version}.zip", MAC);
76+
doAddVersion(urlVersion, baseUrl + "windows-${version}.zip", WINDOWS);
77+
}
78+
}
79+
}

url-updater/src/main/java/com/devonfw/tools/ide/url/updater/UpdateManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import java.time.Instant;
55
import java.util.List;
66

7+
import com.devonfw.tools.ide.url.tool.inso.InsoUrlUpdater;
8+
79
import org.slf4j.Logger;
810
import org.slf4j.LoggerFactory;
911

@@ -74,8 +76,8 @@ public class UpdateManager extends AbstractProcessorWithTimeout {
7476
new DotNetUrlUpdater(),
7577
new EclipseCppUrlUpdater(), new EclipseJeeUrlUpdater(), new EclipseJavaUrlUpdater(), new GCloudUrlUpdater(),
7678
new GcViewerUrlUpdater(), new GhUrlUpdater(), new GoUrlUpdater(), new GraalVmCommunityUpdater(), new GraalVmOracleUrlUpdater(),
77-
new GradleUrlUpdater(), new HelmUrlUpdater(), new IntellijUrlUpdater(), new JasyptUrlUpdater(),
78-
new JavaUrlUpdater(), new JavaAzulUrlUpdater(), new JenkinsUrlUpdater(), new JmcUrlUpdater(), new KotlincUrlUpdater(),
79+
new GradleUrlUpdater(), new HelmUrlUpdater(),new InsoUrlUpdater(), new IntellijUrlUpdater(), new JasyptUrlUpdater(),new JavaAzulUrlUpdater(),
80+
new JavaUrlUpdater(), new JenkinsUrlUpdater(), new JmcUrlUpdater(), new KotlincUrlUpdater(),
7981
new KotlincNativeUrlUpdater(), new LazyDockerUrlUpdater(), new MvnUrlUpdater(),
8082
new NgUrlUpdater(), new NodeUrlUpdater(), new NpmUrlUpdater(), new OcUrlUpdater(), new PgAdminUrlUpdater(), new PipUrlUpdater(), new PycharmUrlUpdater(),
8183
new PythonUrlUpdater(), new QuarkusUrlUpdater(), new RustUrlUpdater(), new DockerRancherDesktopUrlUpdater(), new SonarUrlUpdater(),
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.devonfw.tools.ide.url.tool.inso;
2+
3+
4+
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
5+
6+
/**
7+
* Mock of {@link InsoUrlUpdater} to allow integration testing with WireMock.
8+
*/
9+
public class InsoUrlUpdaterMock extends InsoUrlUpdater {
10+
11+
private final String baseUrl;
12+
13+
InsoUrlUpdaterMock(WireMockRuntimeInfo wireMockRuntimeInfo) {
14+
super();
15+
this.baseUrl = wireMockRuntimeInfo.getHttpBaseUrl();
16+
}
17+
18+
@Override
19+
protected String getDownloadBaseUrl() {
20+
return this.baseUrl;
21+
}
22+
23+
@Override
24+
protected String doGetVersionUrl() {
25+
return this.baseUrl + "/repos/" + getGithubOrganization() + "/" + getGithubRepository() + "/releases";
26+
}
27+
}
28+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.devonfw.tools.ide.url.tool.inso;
2+
3+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
4+
import static com.github.tomakehurst.wiremock.client.WireMock.any;
5+
import static com.github.tomakehurst.wiremock.client.WireMock.get;
6+
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
7+
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
8+
9+
import java.nio.file.Path;
10+
11+
import org.junit.jupiter.api.Test;
12+
import org.junit.jupiter.api.io.TempDir;
13+
14+
import com.devonfw.tools.ide.url.model.folder.UrlRepository;
15+
import com.devonfw.tools.ide.url.updater.AbstractUrlUpdaterTest;
16+
import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo;
17+
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
18+
19+
@WireMockTest
20+
class InsoUrlUpdaterTest extends AbstractUrlUpdaterTest {
21+
22+
/**
23+
* Test of {@link InsoUrlUpdater} for the creation of download URLs and checksums.
24+
*
25+
* @param tempDir Path to a temporary directory.
26+
* @param wmRuntimeInfo the {@link WireMockRuntimeInfo}.
27+
*/
28+
@Test
29+
void testInsoUrlUpdater(@TempDir Path tempDir, WireMockRuntimeInfo wmRuntimeInfo) {
30+
31+
// arrange
32+
stubFor(get(urlMatching("/repos/Kong/insomnia/releases")).willReturn(aResponse().withStatus(200)
33+
.withBody(readAndResolve(PATH_INTEGRATION_TEST.resolve("InsoUrlUpdater").resolve("inso-releases.json"), wmRuntimeInfo))));
34+
35+
stubFor(any(urlMatching("/Kong/insomnia/releases/download/core(@|%40).*"))
36+
.willReturn(aResponse().withStatus(200).withBody(DOWNLOAD_CONTENT)));
37+
38+
UrlRepository urlRepository = UrlRepository.load(tempDir);
39+
InsoUrlUpdaterMock updater = new InsoUrlUpdaterMock(wmRuntimeInfo);
40+
41+
// act
42+
updater.update(urlRepository);
43+
44+
// assert
45+
Path insoDir = tempDir.resolve("inso").resolve("inso");
46+
assertUrlVersionOsX64(insoDir.resolve("12.5.0"));
47+
}
48+
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
[
2+
{
3+
"url": "https://api.github.com/repos/Kong/insomnia/releases/304465489",
4+
"assets_url": "https://api.github.com/repos/Kong/insomnia/releases/304465489/assets",
5+
"upload_url": "https://uploads.github.com/repos/Kong/insomnia/releases/304465489/assets{?name,label}",
6+
"html_url": "https://github.com/Kong/insomnia/releases/tag/core%4012.5.0",
7+
"id": 304465489,
8+
"author": {
9+
"login": "github-actions[bot]",
10+
"id": 41898282,
11+
"node_id": "MDM6Qm90NDE4OTgyODI=",
12+
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
13+
"gravatar_id": "",
14+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
15+
"html_url": "https://github.com/apps/github-actions",
16+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
17+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
18+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
19+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
20+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
21+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
22+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
23+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
24+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
25+
"type": "Bot",
26+
"user_view_type": "public",
27+
"site_admin": false
28+
},
29+
"node_id": "RE_kwDOA2Q21M4SJcZR",
30+
"tag_name": "core@12.5.0",
31+
"target_commitish": "082aa1fa373451e8cf5559b3575f73c67ca70827",
32+
"name": "core@12.5.0 📦",
33+
"draft": false,
34+
"immutable": false,
35+
"prerelease": false,
36+
"created_at": "2026-04-01T21:51:30Z",
37+
"updated_at": "2026-04-02T01:01:11Z",
38+
"published_at": "2026-04-02T00:50:58Z",
39+
"assets": [
40+
{
41+
"url": "https://api.github.com/repos/Kong/insomnia/releases/assets/386661370",
42+
"id": 386661370,
43+
"node_id": "RA_kwDOA2Q21M4XC_v6",
44+
"name": "inso-linux-x64-12.5.0.tar.xz",
45+
"label": "",
46+
"uploader": {
47+
"login": "github-actions[bot]",
48+
"id": 41898282,
49+
"node_id": "MDM6Qm90NDE4OTgyODI=",
50+
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
51+
"gravatar_id": "",
52+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
53+
"html_url": "https://github.com/apps/github-actions",
54+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
55+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
56+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
57+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
58+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
59+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
60+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
61+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
62+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
63+
"type": "Bot",
64+
"user_view_type": "public",
65+
"site_admin": false
66+
},
67+
"content_type": "application/x-xz",
68+
"state": "uploaded",
69+
"size": 50250080,
70+
"digest": "sha256:34d56dea6fd0af9292ad6f3ec10d3f34f7bb4efa4886adefc899d226ad032712",
71+
"download_count": 3290,
72+
"created_at": "2026-04-02T00:53:36Z",
73+
"updated_at": "2026-04-02T00:53:38Z",
74+
"browser_download_url": "https://github.com/Kong/insomnia/releases/download/core%4012.5.0/inso-linux-x64-12.5.0.tar.xz"
75+
},
76+
{
77+
"url": "https://api.github.com/repos/Kong/insomnia/releases/assets/386661443",
78+
"id": 386661443,
79+
"node_id": "RA_kwDOA2Q21M4XC_xD",
80+
"name": "inso-macos-12.5.0.zip",
81+
"label": "",
82+
"uploader": {
83+
"login": "github-actions[bot]",
84+
"id": 41898282,
85+
"node_id": "MDM6Qm90NDE4OTgyODI=",
86+
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
87+
"gravatar_id": "",
88+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
89+
"html_url": "https://github.com/apps/github-actions",
90+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
91+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
92+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
93+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
94+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
95+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
96+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
97+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
98+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
99+
"type": "Bot",
100+
"user_view_type": "public",
101+
"site_admin": false
102+
},
103+
"content_type": "application/zip",
104+
"state": "uploaded",
105+
"size": 85610280,
106+
"digest": "sha256:43de03a8f4e36ff8445e6ee51981cf9518642e151332184e9c2679b8969aa4be",
107+
"download_count": 1093,
108+
"created_at": "2026-04-02T00:53:43Z",
109+
"updated_at": "2026-04-02T00:53:46Z",
110+
"browser_download_url": "https://github.com/Kong/insomnia/releases/download/core%4012.5.0/inso-macos-12.5.0.zip"
111+
},
112+
{
113+
"url": "https://api.github.com/repos/Kong/insomnia/releases/assets/386661388",
114+
"id": 386661388,
115+
"node_id": "RA_kwDOA2Q21M4XC_wM",
116+
"name": "inso-windows-12.5.0.zip",
117+
"label": "",
118+
"uploader": {
119+
"login": "github-actions[bot]",
120+
"id": 41898282,
121+
"node_id": "MDM6Qm90NDE4OTgyODI=",
122+
"avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
123+
"gravatar_id": "",
124+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
125+
"html_url": "https://github.com/apps/github-actions",
126+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
127+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
128+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
129+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
130+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
131+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
132+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
133+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
134+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
135+
"type": "Bot",
136+
"user_view_type": "public",
137+
"site_admin": false
138+
},
139+
"content_type": "application/zip",
140+
"state": "uploaded",
141+
"size": 87466477,
142+
"digest": "sha256:f9399377692c4ca694b7e5d94941bae250b76ff51cb085d5d1d4e39ba7a87d83",
143+
"download_count": 2351,
144+
"created_at": "2026-04-02T00:53:38Z",
145+
"updated_at": "2026-04-02T00:53:43Z",
146+
"browser_download_url": "https://github.com/Kong/insomnia/releases/download/core%4012.5.0/inso-windows-12.5.0.zip"
147+
}
148+
],
149+
"tarball_url": "https://api.github.com/repos/Kong/insomnia/tarball/core@12.5.0",
150+
"zipball_url": "https://api.github.com/repos/Kong/insomnia/zipball/core@12.5.0",
151+
"body": "## What's Changed\n* :rocket: 12.5.0-beta.0 by @insomnia-infra in https://github.com/Kong/insomnia/pull/9749\n* feat: Add toast notifications for update/create credentials by @pavkout in https://github.com/Kong/insomnia/pull/9761\n* fix: delete cloud sync workspace issue by @cwangsmv in https://github.com/Kong/insomnia/pull/9762\n* fix: add line clamp limit for delete workspace model by @cwangsmv in https://github.com/Kong/insomnia/pull/9764\n* fix: Git Hub credentials edit pop up should be close automatically after reauthorize succeed. by @pavkout in https://github.com/Kong/insomnia/pull/9760\n* fix: import state and project scan by @ryan-willis in https://github.com/Kong/insomnia/pull/9766\n* fix: prevent duplicate imports during auto-scan by @ryan-willis in https://github.com/Kong/insomnia/pull/9770\n\n\n**Full Changelog**: https://github.com/Kong/insomnia/compare/core@12.5.0-beta.0...core@12.5.0",
152+
"reactions": {
153+
"url": "https://api.github.com/repos/Kong/insomnia/releases/304465489/reactions",
154+
"total_count": 6,
155+
"+1": 5,
156+
"-1": 0,
157+
"laugh": 0,
158+
"hooray": 0,
159+
"confused": 0,
160+
"heart": 0,
161+
"rocket": 0,
162+
"eyes": 1
163+
},
164+
"mentions_count": 4
165+
}
166+
]

0 commit comments

Comments
 (0)