Skip to content

Commit

Permalink
Merge branch 'public-release/v2.0.0-231' into zowe-release/v2.0.0-231
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Apr 18, 2024
2 parents 08f24b2 + 09acbf0 commit 69ae375
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class JobFetchProviderTestSpec : ShouldSpec({
every { mockedResponse.isSuccessful } returns false
every { mockedResponse.code() } returns 404
every { mockedResponse.body() } returns emptyList()
every { mockedResponse.message() } returns "Unknown error"

val exception = shouldThrow<InvocationTargetException> {
fetchResponseMethodRef.invoke(jobFetchProviderForTest, mockedQuery, progressMockk)
Expand All @@ -252,6 +253,7 @@ class JobFetchProviderTestSpec : ShouldSpec({
jobFetchProviderForTest::class.java.declaredMethods.first { it.name == "cleanupUnusedFile" }
cleanupUnusedFileMethodRef.trySetAccessible()
dataOpsManagerService.testInstance = object : TestDataOpsManagerImpl(componentManager) {
@Suppress("UNCHECKED_CAST")
override fun <A : FileAttributes, F : VirtualFile> getAttributesService(
attributesClass: Class<out A>,
vFileClass: Class<out F>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import com.intellij.ide.projectView.PresentationData
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl
import com.intellij.ui.SimpleTextAttributes
import org.zowe.explorer.config.connect.ConnectionConfig
import org.zowe.explorer.config.ws.DSMask
Expand All @@ -30,7 +27,6 @@ import org.zowe.explorer.explorer.FilesWorkingSetImpl
import org.zowe.explorer.testutils.WithApplicationShouldSpec
import org.zowe.explorer.testutils.testServiceImpl.TestDataOpsManagerImpl
import org.zowe.explorer.utils.service
import io.kotest.core.spec.style.ShouldSpec
import io.mockk.*
import java.time.LocalDateTime

Expand Down Expand Up @@ -59,12 +55,11 @@ class FileFetchNodeTestSpec: WithApplicationShouldSpec({
val mockedExplorerTreeStructure = mockk<ExplorerTreeStructureBase>()

every { mockedWorkingSet.explorer } returns mockedExplorer
every { mockedExplorer.componentManager } returns mockk()
every { mockedExplorer.componentManager.service<DataOpsManager>() } returns dataOpsManagerService
every { mockedExplorerTreeStructure.registerNode(any()) } just Runs
every { mockedWorkingSet.connectionConfig } returns mockk()

dataOpsManagerService.testInstance = object: TestDataOpsManagerImpl(componentManager) {
@Suppress("UNCHECKED_CAST")
override fun <R : Any, Q : Query<R, Unit>, File : VirtualFile> getFileFetchProvider(
requestClass: Class<out R>,
queryClass: Class<out Query<*, *>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@
package org.zowe.explorer.explorer.ui

import com.intellij.ide.util.treeView.AbstractTreeNode
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import org.zowe.explorer.config.ws.UssPath
import org.zowe.explorer.dataops.DataOpsManager
import org.zowe.explorer.dataops.attributes.AttributesService
import org.zowe.explorer.dataops.attributes.FileAttributes
import org.zowe.explorer.dataops.attributes.RemoteUssAttributes
import org.zowe.explorer.dataops.attributes.RemoteUssAttributesService
import org.zowe.explorer.dataops.getAttributesService
import org.zowe.explorer.dataops.sort.SortQueryKeys
import org.zowe.explorer.explorer.FileExplorer
import org.zowe.explorer.explorer.FilesWorkingSetImpl
import org.zowe.explorer.testutils.WithApplicationShouldSpec
import org.zowe.explorer.testutils.testServiceImpl.TestDataOpsManagerImpl
import org.zowe.explorer.utils.service
import org.zowe.explorer.vfs.MFVirtualFile
import io.kotest.assertions.assertSoftly
Expand All @@ -45,10 +49,19 @@ class UssDirNodeTestSpec : WithApplicationShouldSpec({

val mockedUssAttributesService = mockk<RemoteUssAttributesService>()

val dataOpsManagerService = ApplicationManager.getApplication().service<DataOpsManager>() as TestDataOpsManagerImpl
val componentManager = dataOpsManagerService.componentManager
dataOpsManagerService.testInstance = object : TestDataOpsManagerImpl(componentManager) {
@Suppress("UNCHECKED_CAST")
override fun <A : FileAttributes, F : VirtualFile> getAttributesService(
attributesClass: Class<out A>,
vFileClass: Class<out F>
): AttributesService<A, F> {
return mockedUssAttributesService as AttributesService<A, F>
}
}

every { mockedWorkingSet.explorer } returns mockedExplorer
every { mockedExplorer.componentManager } returns mockk()
every { mockedExplorer.componentManager.service<DataOpsManager>() } returns mockk()
every { mockedExplorer.componentManager.service<DataOpsManager>().getAttributesService<RemoteUssAttributes, MFVirtualFile>() } returns mockedUssAttributesService
every { mockedExplorerTreeStructure.registerNode(any()) } just Runs

context("sort children nodes") {
Expand Down

0 comments on commit 69ae375

Please sign in to comment.