From cb7cdff2e06f68752381a95bdf7380c3d2cbb647 Mon Sep 17 00:00:00 2001 From: Vyacheslav Gerasimov Date: Thu, 30 May 2019 23:21:15 +0300 Subject: [PATCH] 192: Fix ultimate tests compilation for 192 platform --- ...pringReferenceCompletionHandlerTest.kt.192 | 39 ++++++++++++ ...stractSpringReferenceCompletionTest.kt.192 | 34 +++++++++++ ...stractSpringReferenceNavigationTest.kt.192 | 61 +++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionHandlerTest.kt.192 create mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionTest.kt.192 create mode 100644 ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceNavigationTest.kt.192 diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionHandlerTest.kt.192 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionHandlerTest.kt.192 new file mode 100644 index 00000000000..e79bc41f263 --- /dev/null +++ b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionHandlerTest.kt.192 @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.spring.tests.references + +import com.intellij.util.PathUtil +import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractBasicCompletionHandlerTest +import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension +import org.jetbrains.kotlin.idea.test.TestFixtureExtension +import java.io.File + +abstract class AbstractSpringReferenceCompletionHandlerTest : AbstractBasicCompletionHandlerTest() { + override fun setUpFixture(testPath: String) { + super.setUpFixture(testPath) + + TestFixtureExtension + .loadFixture(module) + .configureFileSet(myFixture, listOf(PathUtil.toSystemIndependentName(File(testPath).parent + "/spring-config.xml"))) + } + + override fun tearDownFixture() { + TestFixtureExtension.unloadFixture() + + super.tearDownFixture() + } +} \ No newline at end of file diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionTest.kt.192 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionTest.kt.192 new file mode 100644 index 00000000000..e8b37e01c5d --- /dev/null +++ b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceCompletionTest.kt.192 @@ -0,0 +1,34 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.spring.tests.references + +import org.jetbrains.kotlin.idea.completion.test.AbstractJvmBasicCompletionTest +import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension +import org.jetbrains.kotlin.idea.spring.tests.loadConfigByMainFilePath +import org.jetbrains.kotlin.idea.test.TestFixtureExtension + +abstract class AbstractSpringReferenceCompletionTest : AbstractJvmBasicCompletionTest() { + override fun setUpFixture(testPath: String) { + TestFixtureExtension.loadFixture(module).loadConfigByMainFilePath(testPath, myFixture) + super.setUpFixture(testPath) + } + + override fun tearDownFixture() { + TestFixtureExtension.unloadFixture() + super.tearDownFixture() + } +} \ No newline at end of file diff --git a/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceNavigationTest.kt.192 b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceNavigationTest.kt.192 new file mode 100644 index 00000000000..ab5899e96b0 --- /dev/null +++ b/ultimate/tests/org/jetbrains/kotlin/idea/spring/tests/references/AbstractSpringReferenceNavigationTest.kt.192 @@ -0,0 +1,61 @@ +/* + * Copyright 2010-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.spring.tests.references + +import com.intellij.codeInsight.navigation.GotoTargetHandler +import com.intellij.openapi.editor.Editor +import com.intellij.psi.PsiFile +import org.jetbrains.kotlin.idea.KotlinFileType +import org.jetbrains.kotlin.idea.actions.AbstractNavigationTest +import org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension +import org.jetbrains.kotlin.idea.test.TestFixtureExtension +import org.jetbrains.kotlin.psi.KtStringTemplateExpression +import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType +import org.jetbrains.kotlin.test.InTextDirectivesUtils + +abstract class AbstractSpringReferenceNavigationTest : AbstractNavigationTest() { + override fun getSourceAndTargetElements(editor: Editor, file: PsiFile): GotoTargetHandler.GotoData? { + val stringTemplate = file.findElementAt(editor.caretModel.offset)!!.getNonStrictParentOfType()!! + return GotoTargetHandler.GotoData(stringTemplate, + stringTemplate.references.mapNotNull { it.resolve() }.distinct().toTypedArray(), + emptyList()) + } + + override fun setUp() { + super.setUp() + TestFixtureExtension.loadFixture(module) + } + + override fun configureExtra(mainFileBaseName: String, mainFileText: String) { + if (!InTextDirectivesUtils.isDirectiveDefined(mainFileText, "// NO_XML_CONFIG")) { + TestFixtureExtension + .getFixture()!! + .configureFileSet(myFixture, listOf("${mainFileBaseName}_config.xml")) + } + if (InTextDirectivesUtils.isDirectiveDefined(mainFileText, "// JAVAX_ANNOTATION_RESOURCE")) { + myFixture.configureByText( + KotlinFileType.INSTANCE, + """package javax.annotation; annotation class Resource(val name: String = "")""" + ) + } + } + + override fun tearDown() { + TestFixtureExtension.unloadFixture() + super.tearDown() + } +} \ No newline at end of file