mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[migration to Kotlin APIV 2.3] Update Kotlin code w.r.t. KTLC-281
GitOrigin-RevId: c035a3d0de661e078e394834dd8bc9028826f883
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e723058a7c
commit
9ea2c60113
+20
-5
@@ -13,6 +13,8 @@ import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.assertj.core.api.BDDAssertions.then
|
||||
import org.junit.Test
|
||||
import kotlin.io.path.createTempDirectory
|
||||
import kotlin.io.path.invariantSeparatorsPathString
|
||||
import kotlin.reflect.jvm.jvmName
|
||||
|
||||
class ExternalProjectsDataStorageTest: UsefulTestCase() {
|
||||
@@ -43,7 +45,10 @@ class ExternalProjectsDataStorageTest: UsefulTestCase() {
|
||||
val testSystemId = ProjectSystemId("Test")
|
||||
val externalName = "external_name"
|
||||
val externalProjectInfo = createExternalProjectInfo(
|
||||
testSystemId, externalName, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName).canonicalPath))
|
||||
testSystemId,
|
||||
externalName,
|
||||
createTempDirectory(externalName).invariantSeparatorsPathString
|
||||
)
|
||||
|
||||
dataStorage.update(externalProjectInfo)
|
||||
dataStorage.save()
|
||||
@@ -60,13 +65,23 @@ class ExternalProjectsDataStorageTest: UsefulTestCase() {
|
||||
|
||||
val testSystemId = ProjectSystemId("Test")
|
||||
val externalName1 = "external_name1"
|
||||
dataStorage.update(createExternalProjectInfo(
|
||||
testSystemId, externalName1, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName1).canonicalPath)))
|
||||
dataStorage.update(
|
||||
createExternalProjectInfo(
|
||||
testSystemId,
|
||||
externalName1,
|
||||
createTempDirectory(externalName1).invariantSeparatorsPathString
|
||||
)
|
||||
)
|
||||
dataStorage.load()
|
||||
|
||||
val externalName2 = "external_name2"
|
||||
dataStorage.update(createExternalProjectInfo(
|
||||
testSystemId, externalName2, FileUtil.toSystemIndependentName(createTempDir(suffix = externalName2).canonicalPath)))
|
||||
dataStorage.update(
|
||||
createExternalProjectInfo(
|
||||
testSystemId,
|
||||
externalName2,
|
||||
createTempDirectory(externalName2).invariantSeparatorsPathString
|
||||
)
|
||||
)
|
||||
|
||||
val list = dataStorage.list(testSystemId)
|
||||
then(list).hasSize(2)
|
||||
|
||||
+2
-1
@@ -5,12 +5,13 @@ import com.intellij.openapi.components.reloadApplicationState
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.testFramework.LightPlatformTestCase
|
||||
import org.junit.Assert
|
||||
import kotlin.io.path.createTempDirectory
|
||||
|
||||
class JdkDownloaderStoreTest : LightPlatformTestCase() {
|
||||
fun testState() {
|
||||
val item1 = jdkItemForTest("urk-1", JdkPackageType.ZIP, 123, "sha-1")
|
||||
val item2 = jdkItemForTest("urk-2", JdkPackageType.ZIP, 432, "sha-2")
|
||||
val path1 = createTempDir("path-1").toPath()
|
||||
val path1 = createTempDirectory("path-1")
|
||||
service.registerInstall(item1, path1)
|
||||
|
||||
Assert.assertEquals(listOf(path1), service.findInstallations(item1).toList())
|
||||
|
||||
+2
-1
@@ -23,11 +23,12 @@ import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.io.path.createTempDirectory
|
||||
import kotlin.io.path.invariantSeparatorsPathString
|
||||
|
||||
class SdkDownloaderTest : LightPlatformTestCase() {
|
||||
private val successDownloadTask = object : SdkDownloadTask {
|
||||
val home = createTempDir("planned-home").toPath().invariantSeparatorsPathString
|
||||
val home = createTempDirectory("planned-home").invariantSeparatorsPathString
|
||||
override fun getPlannedHomeDir() = home
|
||||
override fun getSuggestedSdkName() = "suggested name"
|
||||
override fun getPlannedVersion() = "planned version"
|
||||
|
||||
+5
-2
@@ -17,6 +17,9 @@ import com.intellij.util.Consumer
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import kotlin.io.path.absolute
|
||||
import kotlin.io.path.createTempDirectory
|
||||
import kotlin.io.path.pathString
|
||||
|
||||
class ProjectSdksModelTest : LightPlatformTestCase() {
|
||||
private val model = ProjectSdksModel()
|
||||
@@ -71,7 +74,7 @@ class ProjectSdksModelTest : LightPlatformTestCase() {
|
||||
|
||||
private inner class DownloadSdkTest {
|
||||
val type = SimpleJavaSdkType.getInstance()
|
||||
val plannedDir = createTempDir("planned-dir-")
|
||||
val plannedDir = createTempDirectory("planned-dir-").absolute()
|
||||
val sdkName = "test-name"
|
||||
|
||||
fun task(action: () -> Unit) {
|
||||
@@ -94,7 +97,7 @@ class ProjectSdksModelTest : LightPlatformTestCase() {
|
||||
try {
|
||||
model.setupInstallableSdk(type, object : SdkDownloadTask {
|
||||
override fun getSuggestedSdkName() = sdkName
|
||||
override fun getPlannedHomeDir() = plannedDir.absolutePath
|
||||
override fun getPlannedHomeDir() = plannedDir.pathString
|
||||
override fun getPlannedVersion() = "1.2.3"
|
||||
override fun doDownload(indicator: ProgressIndicator) {
|
||||
ApplicationManager.getApplication().assertIsNonDispatchThread()
|
||||
|
||||
@@ -22,8 +22,9 @@ import com.jetbrains.python.testing.PyTrialTestFactory
|
||||
import com.jetbrains.python.testing.PythonTestConfigurationType
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
import java.util.function.Function
|
||||
import kotlin.io.path.createTempDirectory
|
||||
import kotlin.io.path.pathString
|
||||
|
||||
// Twisted trial test case
|
||||
@EnvTestTagsRequired(tags = ["twisted"])
|
||||
@@ -56,6 +57,6 @@ class PyTrialTestProcessRunner(scriptName: String,
|
||||
PyTrialTestFactory(PythonTestConfigurationType.getInstance()), PyTrialTestConfiguration::class.java, scriptName, timesToRerunFailedTests) {
|
||||
override fun configurationCreatedAndWillLaunch(configuration: PyTrialTestConfiguration) {
|
||||
super.configurationCreatedAndWillLaunch(configuration)
|
||||
configuration.additionalArguments = "--temp-directory=" + File(createTempDir(), "trial").path
|
||||
configuration.additionalArguments = "--temp-directory=" + createTempDirectory().resolve("trial").pathString
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user