File tree Expand file tree Collapse file tree 7 files changed +24
-4
lines changed
main/kotlin/com/github/yusufugurozbek/testcontainers/port/updater
test/kotlin/com/github/yusufugurozbek/testcontainers/port/updater/common Expand file tree Collapse file tree 7 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ jobs:
114
114
115
115
# Run Qodana inspections
116
116
- name : Qodana - Code Inspection
117
- uses : JetBrains/qodana-action@v2022.2.3
117
+ uses : JetBrains/qodana-action@v2022.3.0
118
118
119
119
# Prepare plugin archive content for creating artifact
120
120
- name : Prepare Plugin Artifact
Original file line number Diff line number Diff line change 1
1
# Testcontainers Port Updater Changelog
2
2
3
3
## [ Unreleased]
4
+ - Bump dependencies to their latest versions
5
+ - Fix unnecessary updates on the data source URL
6
+ - Bump Gradle version to 7.6
4
7
5
8
## [ 1.0.4] - 2022-12-12
6
9
- Support latest IntelliJ 2022.3
Original file line number Diff line number Diff line change 3
3
4
4
pluginGroup = com.github.yusufugurozbek.testcontainers.port.updater
5
5
pluginName = Testcontainers Port Updater
6
- pluginVersion = 1.0.4
6
+ pluginVersion = 1.0.5
7
7
8
8
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
9
9
pluginSinceBuild = 222
@@ -17,7 +17,7 @@ platformVersion = 2022.3
17
17
platformPlugins = com.intellij.database
18
18
19
19
# Gradle Releases -> https://github.com/gradle/gradle/releases
20
- gradleVersion = 7.5.1
20
+ gradleVersion = 7.6
21
21
22
22
# Opt-out flag for bundling Kotlin standard library -> https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library
23
23
# suppress inspection "UnusedProperty"
Original file line number Diff line number Diff line change 1
1
distributionBase =GRADLE_USER_HOME
2
2
distributionPath =wrapper/dists
3
- distributionUrl =https\://services.gradle.org/distributions/gradle-7.5.1 -bin.zip
3
+ distributionUrl =https\://services.gradle.org/distributions/gradle-7.6 -bin.zip
4
4
zipStoreBase =GRADLE_USER_HOME
5
5
zipStorePath =wrapper/dists
Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ fun String.equalsIgnoringPort(other: String): Boolean {
8
8
9
9
return thisWithoutNumbers == otherWithoutNumbers
10
10
}
11
+
12
+ fun String.hasPort (): Boolean {
13
+ return PORT_REGEX .containsMatchIn(this )
14
+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.github.yusufugurozbek.testcontainers.port.updater.DatasourceUrlExtrac
4
4
import com.github.yusufugurozbek.testcontainers.port.updater.api.DatasourceUpdater
5
5
import com.github.yusufugurozbek.testcontainers.port.updater.common.TpuNotifier
6
6
import com.github.yusufugurozbek.testcontainers.port.updater.common.equalsIgnoringPort
7
+ import com.github.yusufugurozbek.testcontainers.port.updater.common.hasPort
7
8
import com.github.yusufugurozbek.testcontainers.port.updater.settings.TpuSettingsState
8
9
import com.intellij.database.dataSource.LocalDataSource
9
10
import com.intellij.database.psi.DbPsiFacade
@@ -18,6 +19,8 @@ class DatasourceUpdaterImpl(var project: Project) : DatasourceUpdater {
18
19
urlExtractor.extract(logEntryText)?.let { newUrl ->
19
20
DbPsiFacade .getInstance(project).dataSources
20
21
.mapNotNull { DbImplUtil .getMaybeLocalDataSource(it) }
22
+ .filter { it.url != newUrl }
23
+ .filter { it.url?.hasPort() == true && newUrl.hasPort() }
21
24
.filter { it.url?.equalsIgnoringPort(newUrl) ? : false }
22
25
.forEach { update(it, newUrl) }
23
26
}
Original file line number Diff line number Diff line change @@ -21,4 +21,14 @@ internal class StringUtilsKtTest : BasePlatformTestCase() {
21
21
val jdbcStringB = " jdbc:sqlserver://localhost:55001/test"
22
22
assertFalse(jdbcStringA.equalsIgnoringPort(jdbcStringB))
23
23
}
24
+
25
+ fun `test hasPort successfully detects the port` () {
26
+ val jdbcString = " jdbc:postgresql://localhost:55001/test"
27
+ assertTrue(jdbcString.hasPort())
28
+ }
29
+
30
+ fun `test hasPort successfully detects no port` () {
31
+ val jdbcString = " jdbc:postgresql://localhost/test"
32
+ assertFalse(jdbcString.hasPort())
33
+ }
24
34
}
You can’t perform that action at this time.
0 commit comments