Skip to content

Commit

Permalink
Merge branch 'private-release/v2.0.0' into private-release/v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KUGDev committed Sep 24, 2024
2 parents 399f9f9 + b4a7556 commit 25ef30d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 40 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ All notable changes to the Zowe IntelliJ Plugin will be documented in this file.
* Feature: TSO CLI gets focus when it is just opened ([9bc02a0b](https://github.com/zowe/zowe-explorer-intellij/commit/9bc02a0b))
* Feature: Notification after a dataset is created is improved ([8d62771c](https://github.com/zowe/zowe-explorer-intellij/commit/8d62771c))
* Feature: Some enhancements to the connection creation dialog ([5a7a56de](https://github.com/zowe/zowe-explorer-intellij/commit/5a7a56de))
* Feature: "Rate us" notification added ([577b81c2](https://github.com/zowe/zowe-explorer-intellij/commit/577b81c2))
* Feature: "reportThrowable" replaced with "notifyError" ([577b81c2](https://github.com/zowe/zowe-explorer-intellij/commit/577b81c2))

### Bugfixes
* Bugfix: Slow operations in EDT ([8e9266d5](https://github.com/zowe/zowe-explorer-intellij/commit/8e9266d5))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ package eu.ibagroup.formainframe.explorer.ui

import com.intellij.ide.dnd.aware.DnDAwareTree
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataKey
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.ex.util.EditorUtil
import com.intellij.openapi.fileEditor.FileEditorManager
Expand Down Expand Up @@ -57,12 +52,7 @@ import eu.ibagroup.formainframe.dataops.content.synchronizer.DocumentedSyncProvi
import eu.ibagroup.formainframe.dataops.content.synchronizer.SaveStrategy
import eu.ibagroup.formainframe.dataops.fetch.FileCacheListener
import eu.ibagroup.formainframe.dataops.fetch.FileFetchProvider
import eu.ibagroup.formainframe.explorer.CutBufferListener
import eu.ibagroup.formainframe.explorer.Explorer
import eu.ibagroup.formainframe.explorer.ExplorerListener
import eu.ibagroup.formainframe.explorer.ExplorerUnit
import eu.ibagroup.formainframe.explorer.UNITS_CHANGED
import eu.ibagroup.formainframe.explorer.WorkingSet
import eu.ibagroup.formainframe.explorer.*
import eu.ibagroup.formainframe.telemetry.NotificationsService
import eu.ibagroup.formainframe.utils.*
import eu.ibagroup.formainframe.utils.crudable.EntityWithUuid
Expand All @@ -82,7 +72,7 @@ val EXPLORER_VIEW = DataKey.create<ExplorerTreeView<*, *, *>>("explorerView")

private val log = log<ExplorerTreeView<*, *, *>>()

fun <ExplorerView: ExplorerTreeView<*, *, *>> AnActionEvent.getExplorerView(clazz: Class<out ExplorerView>): ExplorerView? {
fun <ExplorerView : ExplorerTreeView<*, *, *>> AnActionEvent.getExplorerView(clazz: Class<out ExplorerView>): ExplorerView? {
return getData(EXPLORER_VIEW).castOrNull(clazz)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,26 @@ class ExplorerTreeViewTestSpec : WithApplicationShouldSpec({
return contentSynchronizerMock
}

override fun tryToGetAttributes(file: VirtualFile): FileAttributes? {
override fun tryToGetAttributes(file: VirtualFile): FileAttributes {
return mockk()
}

override fun <A : FileAttributes, F : VirtualFile> getAttributesService(
attributesClass: Class<out A>,
vFileClass: Class<out F>
): AttributesService<A, F> {
return if (attributesClass == RemoteUssAttributes::class.java && vFileClass == MFVirtualFile::class.java) {
attributesServiceMock as AttributesService<A, F>
} else {
super.getAttributesService(attributesClass, vFileClass)
}
}
}
mockkObject(dataOpsManagerService.testInstance)

attributesServiceMock = mockk()
every {
attributesServiceMock.updateAttributes(any<RemoteUssAttributes>(), any<RemoteUssAttributes>())
} returns Unit

every {
dataOpsManagerService.testInstance.getAttributesService(
RemoteUssAttributes::class.java,
MFVirtualFile::class.java
)
} returns attributesServiceMock
}

afterEach {
Expand All @@ -128,21 +131,39 @@ class ExplorerTreeViewTestSpec : WithApplicationShouldSpec({
// updateAttributesForChildrenInEditor
should("update attributes for files in editor if renamed file is their ancestor") {
var numOfCalls = 0
every { dataOpsManagerService.testInstance.tryToGetAttributes(any()) } answers {
numOfCalls++
if (numOfCalls == 1) {
mockk<RemoteUssAttributes> {
every { path } returns "/u/USER/dir/"
every { parentDirPath } returns "/u/USER"

dataOpsManagerService.testInstance = object : TestDataOpsManagerImpl() {
override fun getContentSynchronizer(file: VirtualFile): ContentSynchronizer {
return contentSynchronizerMock
}

override fun tryToGetAttributes(file: VirtualFile): FileAttributes {
numOfCalls++
return if (numOfCalls == 1) {
mockk<RemoteUssAttributes> {
every { path } returns "/u/USER/dir/"
every { parentDirPath } returns "/u/USER"
}
} else {
RemoteUssAttributes(
"/u/USER/dir/file.txt",
false,
mockk(),
"https://hostname:port",
mutableListOf()
)
}
}

override fun <A : FileAttributes, F : VirtualFile> getAttributesService(
attributesClass: Class<out A>,
vFileClass: Class<out F>
): AttributesService<A, F> {
return if (attributesClass == RemoteUssAttributes::class.java && vFileClass == MFVirtualFile::class.java) {
attributesServiceMock as AttributesService<A, F>
} else {
super.getAttributesService(attributesClass, vFileClass)
}
} else {
RemoteUssAttributes(
"/u/USER/dir/file.txt",
false,
mockk(),
"https://hostname:port",
mutableListOf()
)
}
}

Expand All @@ -169,10 +190,27 @@ class ExplorerTreeViewTestSpec : WithApplicationShouldSpec({
}
should("don't update attributes for files in editor if old attributes are not USS attributes") {
var numOfCalls = 0
every { dataOpsManagerService.testInstance.tryToGetAttributes(any()) } answers {
numOfCalls++
if (numOfCalls == 1) mockk<RemoteUssAttributes>()
else mockk<FileAttributes>()

dataOpsManagerService.testInstance = object : TestDataOpsManagerImpl() {
override fun getContentSynchronizer(file: VirtualFile): ContentSynchronizer {
return contentSynchronizerMock
}

override fun tryToGetAttributes(file: VirtualFile): FileAttributes {
numOfCalls++
return if (numOfCalls == 1) mockk<RemoteUssAttributes>() else mockk<FileAttributes>()
}

override fun <A : FileAttributes, F : VirtualFile> getAttributesService(
attributesClass: Class<out A>,
vFileClass: Class<out F>
): AttributesService<A, F> {
return if (attributesClass == RemoteUssAttributes::class.java && vFileClass == MFVirtualFile::class.java) {
attributesServiceMock as AttributesService<A, F>
} else {
super.getAttributesService(attributesClass, vFileClass)
}
}
}

fileExplorerView.updateAttributesForChildrenInEditor(mockk<MFVirtualFile>(), "newDir")
Expand Down

0 comments on commit 25ef30d

Please sign in to comment.