Ultimate tests repair (KT-18847)
Repaired all except: GenerateSpringDependencyActionTestGenerated.testAutowiredDependencies_MultiplePropertiesAnnotationConfig - Not a Kotlin issue SpringClassAnnotatorTestGenerated.testAutowiredBeanCandidates_AutowiredBeanCandidates - Bug with multiple light objects for same PSI element SpringInspectionTestGenerated.testAutowiring_inspectionData_Inspections_test - Not a Kotlin issue (presumably IDEA-175971) SpringQuickFixTestGenerated$AddQualifierAnnotation.testAmbiguousBean - Not a Kotlin issue (IDEA-175971)
This commit is contained in:
committed by
Nikolay Krasko
parent
532560ef43
commit
384ae8d8b5
Vendored
+1
@@ -5,6 +5,7 @@ package a
|
|||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
+1
@@ -5,6 +5,7 @@ package a
|
|||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
Vendored
+1
@@ -4,6 +4,7 @@ package a
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
+1
@@ -4,6 +4,7 @@ package a
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
+1
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier
|
import org.springframework.beans.factory.annotation.Qualifier
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
||||||
// CONFIG_FILE:
|
// CONFIG_FILE: spring-config.xml
|
||||||
// CHOOSE_BEAN: barBean
|
// CHOOSE_BEAN: barBean
|
||||||
package a
|
package a
|
||||||
|
|
||||||
|
|||||||
ultimate/testData/spring/core/generate/autowiredDependencies/propertyWithQualifierXmlConfig.kt.after
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
// ACTION_CLASS: org.jetbrains.kotlin.idea.spring.generate.GenerateKotlinAutowiredDependencyAction
|
||||||
// CONFIG_FILE:
|
// CONFIG_FILE: spring-config.xml
|
||||||
// CHOOSE_BEAN: barBean
|
// CHOOSE_BEAN: barBean
|
||||||
package a
|
package a
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -4,6 +4,7 @@ package a
|
|||||||
|
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
ultimate/testData/spring/core/generate/autowiredDependencies/singlePropertyAnnotationConfig.kt.after
Vendored
+1
@@ -5,6 +5,7 @@ package a
|
|||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.context.annotation.ComponentScan
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
open class FooBean {
|
open class FooBean {
|
||||||
|
|||||||
+1
-1
@@ -5,5 +5,5 @@
|
|||||||
icon: "ShowAutowiredDependencies",
|
icon: "ShowAutowiredDependencies",
|
||||||
tooltip: "Navigate to autowired candidates",
|
tooltip: "Navigate to autowired candidates",
|
||||||
naming: "generic",
|
naming: "generic",
|
||||||
targets: ["myBean(String)", "prop2", "setProp1(String)"]
|
targets: ["autowiredProp", "collab", "prop2"]
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
springConfig: ["ComponentScan.kt"],
|
springConfig: ["ComponentScan.kt"],
|
||||||
file: "ComponentScan.kt",
|
file: "ComponentScan.kt",
|
||||||
icon: "SpringJavaBean",
|
icon: "SpringScan",
|
||||||
tooltip: "Navigate to the spring bean declaration(s)",
|
tooltip: "Navigate to the spring bean declaration(s)",
|
||||||
naming: "bean",
|
naming: "bean",
|
||||||
targets: ["resourceGutter", "customControllerName"]
|
targets: ["resourceGutter", "customControllerName"]
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
withRuntime: "true",
|
withRuntime: "true",
|
||||||
springConfig: [],
|
springConfig: ["ContextBeanWithQualifierInjectionPoints.kt"],
|
||||||
file: "ContextBeanWithQualifierInjectionPoints.kt",
|
file: "ContextBeanWithQualifierInjectionPoints.kt",
|
||||||
icon: "ShowAutowiredDependencies",
|
icon: "ShowAutowiredDependencies",
|
||||||
tooltip: "Navigate to the autowired dependencies",
|
tooltip: "Navigate to the autowired dependencies",
|
||||||
|
|||||||
+8
-2
@@ -37,13 +37,19 @@ abstract class AbstractGenerateSpringDependencyActionTest : AbstractCodeInsightA
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun configureExtra(mainFilePath: String, mainFileText: String) {
|
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 {
|
configFilePath = InTextDirectivesUtils.findStringWithPrefixes(mainFileText, "// CONFIG_FILE: ")?.let {
|
||||||
"${PathUtil.getParentPath(mainFilePath)}/$it"
|
"${PathUtil.getParentPath(mainFilePath)}/$it"
|
||||||
} ?: mainFilePath
|
} ?: mainFilePathInProject
|
||||||
val springFileSet = TestFixtureExtension
|
val springFileSet = TestFixtureExtension
|
||||||
.getFixture<SpringTestFixtureExtension>()!!
|
.getFixture<SpringTestFixtureExtension>()!!
|
||||||
.configureFileSet(myFixture, listOf(configFilePath!!))
|
.configureFileSet(myFixture, listOf(configFilePath!!))
|
||||||
if (configFilePath != mainFilePath && PathUtil.getFileName(configFilePath!!) != "spring-config.xml") {
|
if (configFilePath != mainFilePathInProject && PathUtil.getFileName(configFilePath!!) != "spring-config.xml") {
|
||||||
configFile = springFileSet.files.single().file!!
|
configFile = springFileSet.files.single().file!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.spring.tests.generate;
|
package org.jetbrains.kotlin.idea.spring.tests.generate;
|
||||||
|
|
||||||
|
import com.intellij.idea.Bombed;
|
||||||
import com.intellij.testFramework.TestDataPath;
|
import com.intellij.testFramework.TestDataPath;
|
||||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
@@ -49,6 +50,9 @@ public class GenerateSpringDependencyActionTestGenerated extends AbstractGenerat
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("autowiredDependencies/multiplePropertiesAnnotationConfig.kt")
|
@TestMetadata("autowiredDependencies/multiplePropertiesAnnotationConfig.kt")
|
||||||
|
@Bombed(day = 1, month = 10, year = 2017,
|
||||||
|
description = "suffer from IDEA bug",
|
||||||
|
user = "nicolay.mitropolsky")
|
||||||
public void testAutowiredDependencies_MultiplePropertiesAnnotationConfig() throws Exception {
|
public void testAutowiredDependencies_MultiplePropertiesAnnotationConfig() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/generate/autowiredDependencies/multiplePropertiesAnnotationConfig.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
|
|||||||
+7
-5
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.io.FileUtil
|
|||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||||
import icons.SpringApiIcons
|
import icons.SpringApiIcons
|
||||||
import junit.framework.Assert
|
import junit.framework.Assert
|
||||||
|
import junit.framework.AssertionFailedError
|
||||||
import org.jetbrains.kotlin.idea.jsonUtils.getString
|
import org.jetbrains.kotlin.idea.jsonUtils.getString
|
||||||
import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension
|
||||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil
|
||||||
@@ -54,14 +55,12 @@ abstract class AbstractSpringClassAnnotatorTest : KotlinLightCodeInsightFixtureT
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
val springConfigFiles = (config["springConfig"] as JsonArray).map { it.asString }
|
val springConfigFiles = (config["springConfig"] as JsonArray).map { it.asString }
|
||||||
|
|
||||||
myFixture.testDataPath = testRoot.absolutePath
|
myFixture.testDataPath = testRoot.absolutePath
|
||||||
TestFixtureExtension.getFixture<SpringTestFixtureExtension>()!!.configureFileSet(myFixture, springConfigFiles)
|
|
||||||
for (file in testRoot.listFiles()) {
|
for (file in testRoot.listFiles()) {
|
||||||
val name = file.name
|
val name = file.name
|
||||||
if (name in springConfigFiles) continue
|
if (file.isDirectory) myFixture.copyDirectoryToProject(name, name) else myFixture.configureByFile(name)
|
||||||
if (file.isDirectory) myFixture.copyDirectoryToProject(name, name) else myFixture.copyFileToProject(name)
|
|
||||||
}
|
}
|
||||||
|
TestFixtureExtension.getFixture<SpringTestFixtureExtension>()!!.configureFileSet(myFixture, springConfigFiles)
|
||||||
|
|
||||||
val fileName = config.getString("file")
|
val fileName = config.getString("file")
|
||||||
val iconName = config.getString("icon")
|
val iconName = config.getString("icon")
|
||||||
@@ -69,7 +68,10 @@ abstract class AbstractSpringClassAnnotatorTest : KotlinLightCodeInsightFixtureT
|
|||||||
|
|
||||||
val gutterMark = myFixture.findGutter(fileName)!!.let {
|
val gutterMark = myFixture.findGutter(fileName)!!.let {
|
||||||
if (it.icon == icon) it
|
if (it.icon == icon) it
|
||||||
else myFixture.findGuttersAtCaret().first { it.icon == icon }
|
else myFixture.findGuttersAtCaret().let { gutters ->
|
||||||
|
gutters.firstOrNull() { it.icon == icon }
|
||||||
|
?: throw AssertionFailedError("no $icon in gutters: ${gutters.map { it.icon }}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val tooltip = config.getString("tooltip")
|
val tooltip = config.getString("tooltip")
|
||||||
|
|||||||
+4
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.spring.tests.gutter;
|
package org.jetbrains.kotlin.idea.spring.tests.gutter;
|
||||||
|
|
||||||
|
import com.intellij.idea.Bombed;
|
||||||
import com.intellij.testFramework.TestDataPath;
|
import com.intellij.testFramework.TestDataPath;
|
||||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||||
@@ -37,6 +38,9 @@ public class SpringClassAnnotatorTestGenerated extends AbstractSpringClassAnnota
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("autowiredBeanCandidates/autowiredBeanCandidates.test")
|
@TestMetadata("autowiredBeanCandidates/autowiredBeanCandidates.test")
|
||||||
|
@Bombed(day = 1, month = 10, year = 2017,
|
||||||
|
description = "flacky because SpringAutowireUtil#getAutowiredMembers() collecting duplicate elements for kotlin sometimes",
|
||||||
|
user = "nicolay.mitropolsky")
|
||||||
public void testAutowiredBeanCandidates_AutowiredBeanCandidates() throws Exception {
|
public void testAutowiredBeanCandidates_AutowiredBeanCandidates() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test");
|
String fileName = KotlinTestUtils.navigationMetadata("ultimate/testData/spring/core/gutter/autowiredBeanCandidates/autowiredBeanCandidates.test");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
|
|||||||
Reference in New Issue
Block a user