Skip to content

Commit

Permalink
IJMP-1318: comparison of zVersion and owner temporary removed from eq…
Browse files Browse the repository at this point in the history
…uals method.

Signed-off-by: Krus_V <[email protected]>
  • Loading branch information
VKrus committed Nov 13, 2023
1 parent 843d7f8 commit 05a3cb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ class ConnectionConfig : ConnectionConfigBase {
if (name != other.name) return false
if (url != other.url) return false
if (isAllowSelfSigned != other.isAllowSelfSigned) return false
if (zVersion != other.zVersion) return false
if (zoweConfigPath != other.zoweConfigPath) return false
if (owner != other.owner) return false
// TODO: uncomment next 2 lines when the task https://jira.ibagroup.eu/browse/IJMP-1412 will be completed.
// if (zVersion != other.zVersion) return false
// if (owner != other.owner) return false

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ class ZOSMFConnectionConfigurable : BoundSearchableConfigurable("z/OSMF Connecti
val wasModified = isModified
applySandbox<Credentials>()
applySandbox<ConnectionConfig>()
zoweConfigStates.values.forEach { updateZoweConfigIfNeeded(it) }
zoweConfigStates.values.forEach {
if (isModified) {
updateZoweConfigIfNeeded(it)
}
}
if (wasModified) {
panel?.updateUI()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,6 @@ class ZoweConfigServiceImpl(override val myProject: Project) : ZoweConfigService
fun ZoweConfig.toConnectionConfig(zVersion: ZVersion = ZVersion.ZOS_2_1): ConnectionConfig =
toConnectionConfig(getOrCreateUuid(), zVersion)

/**
* Compares only significant for real connection fields between 2 connections.
* @param connectionA first connection instance to compare.
* @param connectionB second connection instance to compare.
* @return true if all significant fields fo connections are equal and false otherwise.
*/
fun compareConnections(connectionA: ConnectionConfig, connectionB: ConnectionConfig): Boolean {
if (connectionA.name != connectionB.name) return false
if (connectionA.url != connectionB.url) return false
if (connectionA.isAllowSelfSigned != connectionB.isAllowSelfSigned) return false
if (connectionA.zVersion != connectionB.zVersion) return false
if (connectionA.zoweConfigPath != connectionB.zoweConfigPath) return false

return true
}

/**
* @see ZoweConfigService.getZoweConfigState
Expand All @@ -207,7 +192,7 @@ class ZoweConfigServiceImpl(override val myProject: Project) : ZoweConfigService
val zoweUsername = zoweConfig.user ?: return ZoweConfigState.ERROR
val zowePassword = zoweConfig.password ?: return ZoweConfigState.ERROR

return if (compareConnections(existingConnection, newConnection) &&
return if (existingConnection == newConnection &&
getUsername(newConnection) == zoweUsername &&
getPassword(newConnection) == zowePassword
) {
Expand Down

0 comments on commit 05a3cb4

Please sign in to comment.