mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-24 15:52:46 +00:00
Revert "Ultimate tests repair (KT-18847)"
This reverts commit 384ae8d8b5.
This commit is contained in:
committed by
Yan Zhulanow
parent
29fdbe53fe
commit
4870d1d2de
@@ -5,7 +5,6 @@ package a
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -5,7 +5,6 @@ package a
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -4,7 +4,6 @@ package a
|
||||
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -4,7 +4,6 @@ package a
|
||||
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.beans.factory.annotation.Qualifier
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
||||
// CONFIG_FILE: spring-config.xml
|
||||
// CONFIG_FILE:
|
||||
// CHOOSE_BEAN: barBean
|
||||
package a
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
||||
// CONFIG_FILE: spring-config.xml
|
||||
// CONFIG_FILE:
|
||||
// CHOOSE_BEAN: barBean
|
||||
package a
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ package a
|
||||
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -5,7 +5,6 @@ package a
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.stereotype.Component
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@Component
|
||||
open class FooBean {
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
icon: "ShowAutowiredDependencies",
|
||||
tooltip: "Navigate to autowired candidates",
|
||||
naming: "generic",
|
||||
targets: ["autowiredProp", "collab", "prop2"]
|
||||
targets: ["myBean(String)", "prop2", "setProp1(String)"]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
springConfig: ["ComponentScan.kt"],
|
||||
file: "ComponentScan.kt",
|
||||
icon: "SpringScan",
|
||||
icon: "SpringJavaBean",
|
||||
tooltip: "Navigate to the spring bean declaration(s)",
|
||||
naming: "bean",
|
||||
targets: ["resourceGutter", "customControllerName"]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
withRuntime: "true",
|
||||
springConfig: ["ContextBeanWithQualifierInjectionPoints.kt"],
|
||||
springConfig: [],
|
||||
file: "ContextBeanWithQualifierInjectionPoints.kt",
|
||||
icon: "ShowAutowiredDependencies",
|
||||
tooltip: "Navigate to the autowired dependencies",
|
||||
|
||||
@@ -37,19 +37,13 @@ abstract class AbstractGenerateSpringDependencyActionTest : AbstractCodeInsightA
|
||||
}
|
||||
|
||||
override fun configureExtra(mainFilePath: String, mainFileText: String) {
|
||||
val packagePath = mainFileText.lines().let { it.find { it.trim().startsWith("package") } }
|
||||
?.removePrefix("package")
|
||||
?.trim()?.replace(".", "/") ?: ""
|
||||
val mainFilePathInProject = packagePath + "/" + File(mainFilePath).name
|
||||
myFixture.addFileToProject(mainFilePathInProject, mainFileText)
|
||||
|
||||
configFilePath = InTextDirectivesUtils.findStringWithPrefixes(mainFileText, "// CONFIG_FILE: ")?.let {
|
||||
"${PathUtil.getParentPath(mainFilePath)}/$it"
|
||||
} ?: mainFilePathInProject
|
||||
} ?: mainFilePath
|
||||
val springFileSet = TestFixtureExtension
|
||||
.getFixture<SpringTestFixtureExtension>()!!
|
||||
.configureFileSet(myFixture, listOf(configFilePath!!))
|
||||
if (configFilePath != mainFilePathInProject && PathUtil.getFileName(configFilePath!!) != "spring-config.xml") {
|
||||
if (configFilePath != mainFilePath && PathUtil.getFileName(configFilePath!!) != "spring-config.xml") {
|
||||
configFile = springFileSet.files.single().file!!
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import icons.SpringApiIcons
|
||||
import junit.framework.Assert
|
||||
import junit.framework.AssertionFailedError
|
||||
import org.jetbrains.kotlin.idea.jsonUtils.getString
|
||||
import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||
@@ -57,12 +56,14 @@ abstract class AbstractSpringClassAnnotatorTest : KotlinLightCodeInsightFixtureT
|
||||
|
||||
try {
|
||||
val springConfigFiles = (config["springConfig"] as JsonArray).map { it.asString }
|
||||
|
||||
myFixture.testDataPath = testRoot.absolutePath
|
||||
TestFixtureExtension.getFixture<SpringTestFixtureExtension>()!!.configureFileSet(myFixture, springConfigFiles)
|
||||
for (file in testRoot.listFiles()) {
|
||||
val name = file.name
|
||||
if (file.isDirectory) myFixture.copyDirectoryToProject(name, name) else myFixture.configureByFile(name)
|
||||
if (name in springConfigFiles) continue
|
||||
if (file.isDirectory) myFixture.copyDirectoryToProject(name, name) else myFixture.copyFileToProject(name)
|
||||
}
|
||||
TestFixtureExtension.getFixture<SpringTestFixtureExtension>()!!.configureFileSet(myFixture, springConfigFiles)
|
||||
|
||||
val fileName = config.getString("file")
|
||||
val iconName = config.getString("icon")
|
||||
@@ -70,10 +71,7 @@ abstract class AbstractSpringClassAnnotatorTest : KotlinLightCodeInsightFixtureT
|
||||
|
||||
val gutterMark = myFixture.findGutter(fileName)!!.let {
|
||||
if (it.icon == icon) it
|
||||
else myFixture.findGuttersAtCaret().let { gutters ->
|
||||
gutters.firstOrNull() { it.icon == icon }
|
||||
?: throw AssertionFailedError("no $icon in gutters: ${gutters.map { it.icon }}")
|
||||
}
|
||||
else myFixture.findGuttersAtCaret().first { it.icon == icon }
|
||||
}
|
||||
|
||||
val tooltip = config.getString("tooltip")
|
||||
|
||||
Reference in New Issue
Block a user