Skip to content

Commit

Permalink
Merge branch 'private-release/v2.0.0-231' into public-release/v2.0.0-231
Browse files Browse the repository at this point in the history
  • Loading branch information
KUGDev committed Apr 18, 2024
2 parents 698653c + cdeaa9d commit 09acbf0
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 eu.ibagroup.formainframe.config.connect.ConnectionConfig
import eu.ibagroup.formainframe.config.ws.DSMask
Expand All @@ -30,7 +27,6 @@ import eu.ibagroup.formainframe.explorer.FilesWorkingSetImpl
import eu.ibagroup.formainframe.testutils.WithApplicationShouldSpec
import eu.ibagroup.formainframe.testutils.testServiceImpl.TestDataOpsManagerImpl
import eu.ibagroup.formainframe.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 eu.ibagroup.formainframe.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 eu.ibagroup.formainframe.config.ws.UssPath
import eu.ibagroup.formainframe.dataops.DataOpsManager
import eu.ibagroup.formainframe.dataops.attributes.AttributesService
import eu.ibagroup.formainframe.dataops.attributes.FileAttributes
import eu.ibagroup.formainframe.dataops.attributes.RemoteUssAttributes
import eu.ibagroup.formainframe.dataops.attributes.RemoteUssAttributesService
import eu.ibagroup.formainframe.dataops.getAttributesService
import eu.ibagroup.formainframe.dataops.sort.SortQueryKeys
import eu.ibagroup.formainframe.explorer.FileExplorer
import eu.ibagroup.formainframe.explorer.FilesWorkingSetImpl
import eu.ibagroup.formainframe.testutils.WithApplicationShouldSpec
import eu.ibagroup.formainframe.testutils.testServiceImpl.TestDataOpsManagerImpl
import eu.ibagroup.formainframe.utils.service
import eu.ibagroup.formainframe.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 09acbf0

Please sign in to comment.