From 5134ed8dfdd2875ac7a1f6dabdb51432f0e10243 Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Thu, 21 Mar 2024 16:54:03 +0100 Subject: [PATCH 1/4] refactor: bump kubernetes client to 6.12.0 (#248) Signed-off-by: Andre Dietisheim --- build.gradle | 6 +++--- .../com/redhat/devtools/intellij/knative/kn/KnCli.java | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 1e9e170..7393089 100644 --- a/build.gradle +++ b/build.gradle @@ -50,13 +50,13 @@ runIdeForUiTests { buildSearchableOptions.enabled = false dependencies { - implementation 'io.fabric8:knative-client:6.4.1' - implementation 'com.redhat.devtools.intellij:intellij-common:1.9.1' + implementation 'io.fabric8:knative-client:6.12.0' + implementation 'com.redhat.devtools.intellij:intellij-common:1.9.4' implementation 'com.squareup.okio:okio:3.1.0' testImplementation 'org.mockito:mockito-inline:4.6.1' // telemetry contributes annotations 13.0.0, so we need to declare newer version implementation 'org.jetbrains:annotations:23.0.0' - testImplementation 'com.redhat.devtools.intellij:intellij-common:1.9.1:test' + testImplementation 'com.redhat.devtools.intellij:intellij-common:1.9.4:test' } configurations { diff --git a/src/main/java/com/redhat/devtools/intellij/knative/kn/KnCli.java b/src/main/java/com/redhat/devtools/intellij/knative/kn/KnCli.java index ba15fd4..217da22 100644 --- a/src/main/java/com/redhat/devtools/intellij/knative/kn/KnCli.java +++ b/src/main/java/com/redhat/devtools/intellij/knative/kn/KnCli.java @@ -24,19 +24,18 @@ import com.redhat.devtools.intellij.common.utils.ExecHelper; import com.redhat.devtools.intellij.common.utils.ExecProcessHandler; import com.redhat.devtools.intellij.common.utils.NetworkUtils; -import com.redhat.devtools.intellij.knative.telemetry.TelemetryService; import com.redhat.devtools.intellij.knative.func.FuncActionPipelineManager; +import com.redhat.devtools.intellij.knative.telemetry.TelemetryService; import com.redhat.devtools.intellij.knative.ui.createFunc.CreateFuncModel; +import com.redhat.devtools.intellij.knative.ui.repository.Repository; import com.redhat.devtools.intellij.knative.utils.model.GitRepoModel; import com.redhat.devtools.intellij.knative.utils.model.ImageRegistryModel; import com.redhat.devtools.intellij.knative.utils.model.InvokeModel; -import com.redhat.devtools.intellij.knative.ui.repository.Repository; import com.redhat.devtools.intellij.telemetry.core.service.TelemetryMessageBuilder; import io.fabric8.knative.client.KnativeClient; import io.fabric8.kubernetes.api.model.GenericKubernetesResource; -import io.fabric8.kubernetes.client.ConfigBuilder; -import io.fabric8.kubernetes.client.DefaultKubernetesClient; import io.fabric8.kubernetes.client.KubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.Watch; import io.fabric8.kubernetes.client.Watcher; @@ -80,7 +79,7 @@ public KnCli(Project project, String knCommand, String funcCommand) { this.knCommand = knCommand; this.funcCommand = funcCommand; this.project = project; - this.client = new DefaultKubernetesClient(new ConfigBuilder().build()); + this.client = new KubernetesClientBuilder().build(); this.funcActionPipelineManager = new FuncActionPipelineManager(); try { this.envVars = NetworkUtils.buildEnvironmentVariables(client.getMasterUrl().toString()); From e7af144c669aa888c3a5f9f75bd0eb0a7e2ac9cc Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Tue, 16 Apr 2024 12:28:23 +0200 Subject: [PATCH 2/4] replace deprecated apache commons StringUtils Signed-off-by: Andre Dietisheim --- .../intellij/knative/utils/TreeHelperTest.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/test/java/com/redhat/devtools/intellij/knative/utils/TreeHelperTest.java b/src/test/java/com/redhat/devtools/intellij/knative/utils/TreeHelperTest.java index 0d790dc..d1a92ca 100644 --- a/src/test/java/com/redhat/devtools/intellij/knative/utils/TreeHelperTest.java +++ b/src/test/java/com/redhat/devtools/intellij/knative/utils/TreeHelperTest.java @@ -11,30 +11,23 @@ package com.redhat.devtools.intellij.knative.utils; import com.intellij.openapi.ui.SimpleToolWindowPanel; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindow; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.ui.components.JBScrollPane; import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentManager; import com.intellij.ui.treeStructure.Tree; -import com.redhat.devtools.intellij.knative.Constants; import com.redhat.devtools.intellij.knative.BaseTest; +import com.redhat.devtools.intellij.knative.Constants; import com.redhat.devtools.intellij.knative.kn.Kn; import com.redhat.devtools.intellij.knative.tree.KnTreeStructure; -import javax.swing.JViewport; -import org.apache.commons.lang.StringUtils; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.mockito.MockedStatic; +import javax.swing.*; import static com.redhat.devtools.intellij.knative.Constants.KNATIVE_FUNC_TOOL_WINDOW_ID; -import static com.redhat.devtools.intellij.knative.Constants.KNATIVE_LOCAL_FUNC_TOOL_WINDOW_ID; import static com.redhat.devtools.intellij.knative.Constants.KNATIVE_TOOL_WINDOW_ID; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mockStatic; @@ -73,7 +66,7 @@ public void tearDown() throws Exception { } public void testTrimErrorMessage_ErrorMessageLongerThan130_ErrorMessageTrimmed() { - String longErrorMessage = StringUtils.repeat("a", 140); + String longErrorMessage = StringUtil.repeat("a", 140); String resultingErrorMessage = longErrorMessage.substring(0, 130) + "..."; assertEquals(resultingErrorMessage, TreeHelper.trimErrorMessage(longErrorMessage)); } From 1a301e92e0a276a9765b8f87d266f6db0eb8f995 Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Tue, 16 Apr 2024 15:47:19 +0200 Subject: [PATCH 3/4] corrected impl dependency to intellij-kubernetes Signed-off-by: Andre Dietisheim --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 7393089..57020aa 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,7 @@ intellij { 'yaml', 'org.jetbrains.plugins.github', 'com.intellij.kubernetes:' + versionsMap[ideaVersion], - 'com.redhat.devtools.intellij.telemetry:1.1.0.52', - 'com.redhat.devtools.intellij.kubernetes:1.2.3.294'] + 'com.redhat.devtools.intellij.telemetry:1.1.0.52'] updateSinceUntilBuild = false } @@ -51,8 +50,8 @@ buildSearchableOptions.enabled = false dependencies { implementation 'io.fabric8:knative-client:6.12.0' + implementation 'io.fabric8:openshift-client:6.12.0' implementation 'com.redhat.devtools.intellij:intellij-common:1.9.4' - implementation 'com.squareup.okio:okio:3.1.0' testImplementation 'org.mockito:mockito-inline:4.6.1' // telemetry contributes annotations 13.0.0, so we need to declare newer version implementation 'org.jetbrains:annotations:23.0.0' From 2b23720fffdfd457980baed2285a3f2acec70fba Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Tue, 16 Apr 2024 15:47:45 +0200 Subject: [PATCH 4/4] removed deprecated overrides Signed-off-by: Andre Dietisheim --- .../knative/ui/createFunc/FunctionProjectBuilder.java | 5 ----- .../ui/toolwindow/BuildRunDeployWindowToolFactory.java | 6 ------ 2 files changed, 11 deletions(-) diff --git a/src/main/java/com/redhat/devtools/intellij/knative/ui/createFunc/FunctionProjectBuilder.java b/src/main/java/com/redhat/devtools/intellij/knative/ui/createFunc/FunctionProjectBuilder.java index 504b992..5c8b35e 100644 --- a/src/main/java/com/redhat/devtools/intellij/knative/ui/createFunc/FunctionProjectBuilder.java +++ b/src/main/java/com/redhat/devtools/intellij/knative/ui/createFunc/FunctionProjectBuilder.java @@ -98,11 +98,6 @@ public boolean isBackgroundJobRunning() { public void addSettingsListener(@NotNull ProjectGeneratorPeer.SettingsListener listener) { ProjectGeneratorPeer.super.addSettingsListener(listener); } - - @Override - public void addSettingsStateListener(@NotNull WebProjectGenerator.SettingsStateListener listener) { - - } }; } } diff --git a/src/main/java/com/redhat/devtools/intellij/knative/ui/toolwindow/BuildRunDeployWindowToolFactory.java b/src/main/java/com/redhat/devtools/intellij/knative/ui/toolwindow/BuildRunDeployWindowToolFactory.java index e2f7543..7739d22 100644 --- a/src/main/java/com/redhat/devtools/intellij/knative/ui/toolwindow/BuildRunDeployWindowToolFactory.java +++ b/src/main/java/com/redhat/devtools/intellij/knative/ui/toolwindow/BuildRunDeployWindowToolFactory.java @@ -69,12 +69,6 @@ public void projectClosing(@NotNull Project project) { public boolean shouldBeAvailable(@NotNull Project project) { return true; } - - @Override - public boolean isDoNotActivateOnStart() { - return true; - } - } class ContentChangeManagerListener implements ContentManagerListener {