mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[ssr] Remove dependency from Java tests to SSR platform test
Moves Java specific tests into the Java SSR plugin. #IJPL-190621 GitOrigin-RevId: 71b175b4e3591318d8a6d516c580d6ec8051d1d3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0dbe740d84
commit
d029b0b485
@@ -44,6 +44,13 @@ jvm_library(
|
||||
"//java/java-impl:impl",
|
||||
"//platform/duplicates-analysis",
|
||||
"//java/testFramework",
|
||||
"//platform/structuralsearch:structuralSearch-tests_test_lib",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark_test_lib",
|
||||
"//platform/core-ui",
|
||||
"//platform/util/jdom",
|
||||
"//platform/projectModel-api:projectModel",
|
||||
"//platform/code-style-api:codeStyle",
|
||||
],
|
||||
runtime_deps = [":structuralSearch_resources"]
|
||||
)
|
||||
|
||||
@@ -20,5 +20,11 @@
|
||||
<orderEntry type="module" module-name="intellij.java.impl" />
|
||||
<orderEntry type="module" module-name="intellij.platform.duplicates.analysis" />
|
||||
<orderEntry type="module" module-name="intellij.java.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.structuralSearch.tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.core.ui" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.jdom" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.codeStyle" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.structuralsearch.plugin.ui.DetectFileTypeTestCase;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class JavaCommunityDetectFileTypeTest extends DetectFileTypeTestCase {
|
||||
public void testDetectJava() {
|
||||
doTest(JavaFileType.INSTANCE, "class X {{ System.out.println<caret>();}}");
|
||||
}
|
||||
}
|
||||
+35
-7
@@ -1,10 +1,17 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.structuralsearch.JavaPredefinedConfigurations;
|
||||
import com.intellij.structuralsearch.PredefinedConfigurationsTestCase;
|
||||
import com.intellij.structuralsearch.SSRBundle;
|
||||
import com.intellij.structuralsearch.plugin.ui.Configuration;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -15,6 +22,32 @@ import java.util.stream.Stream;
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class JavaPredefinedConfigurationsTest extends PredefinedConfigurationsTestCase {
|
||||
private final Disposable myBeforeParentDisposeDisposable = Disposer.newDisposable();
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
IdeaTestUtil.setProjectLanguageLevel(getProject(), LanguageLevel.JDK_16, myBeforeParentDisposeDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
Disposer.dispose(myBeforeParentDisposeDisposable);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
public void testAll() {
|
||||
final Configuration[] templates = JavaPredefinedConfigurations.createPredefinedTemplates();
|
||||
final Map<String, Configuration> configurationMap = Stream.of(templates).collect(Collectors.toMap(Configuration::getName, x -> x));
|
||||
@@ -560,9 +593,4 @@ public class JavaPredefinedConfigurationsTest extends PredefinedConfigurationsTe
|
||||
protected void doTest(Configuration template, @Language("JAVA") String source, String... results) {
|
||||
doTest(template, source, JavaFileType.INSTANCE, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LanguageLevel getLanguageLevel() {
|
||||
return LanguageLevel.JDK_16;
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,11 +1,13 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.structuralsearch.plugin.ui;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.psi.JavaCodeFragment;
|
||||
import com.intellij.psi.JavaCodeFragmentFactory;
|
||||
import com.intellij.structuralsearch.JavaStructuralSearchProfile;
|
||||
import com.intellij.structuralsearch.plugin.ui.StructuralSearchDialogKeys;
|
||||
import com.intellij.structuralsearch.plugin.ui.StructuralSearchHighlightInfoFilter;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+285
-260
File diff suppressed because it is too large
Load Diff
+27
-3
@@ -1,11 +1,16 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.structuralsearch.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.compiler.PatternCompiler;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -18,12 +23,31 @@ import java.util.List;
|
||||
* @author Maxim.Mossienko
|
||||
*/
|
||||
@SuppressWarnings("ALL")
|
||||
public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
public class JavaStructuralSearchTest extends StructuralSearchTestCase {
|
||||
private final Disposable myBeforeParentDisposeDisposable = Disposer.newDisposable();
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
setLanguageLevel(LanguageLevel.JDK_16);
|
||||
IdeaTestUtil.setProjectLanguageLevel(getProject(), LanguageLevel.JDK_16, myBeforeParentDisposeDisposable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
Disposer.dispose(myBeforeParentDisposeDisposable);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
addSuppressedException(e);
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
protected List<MatchResult> findMatches(@Language("JAVA") String in, String pattern) {
|
||||
+3
-2
@@ -1,8 +1,9 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.structuralsearch.StructuralSearchTestCase;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
|
||||
/**
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch;
|
||||
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.codeInspection.ex.InspectionToolWrapper;
|
||||
@@ -9,6 +9,7 @@ import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.profile.codeInspection.BaseInspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.structuralsearch.MatchOptions;
|
||||
import com.intellij.structuralsearch.inspection.SSBasedInspection;
|
||||
import com.intellij.structuralsearch.plugin.ui.Configuration;
|
||||
import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
|
||||
+4
-4
@@ -1,13 +1,14 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.structuralsearch.plugin.ui
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.structuralsearch.PredefinedConfigurationUtil
|
||||
import com.intellij.structuralsearch.plugin.ui.ConfigurationManager
|
||||
import com.intellij.structuralsearch.plugin.ui.StructuralSearchDialogKeys
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
|
||||
class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
|
||||
fun prepare(text: String) {
|
||||
myFixture.configureByText(JavaFileType.INSTANCE, text)
|
||||
myFixture.editor.putUserData(StructuralSearchDialogKeys.TEST_STRUCTURAL_SEARCH_DIALOG, true)
|
||||
@@ -28,5 +29,4 @@ class TemplatesCompletionTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
assert("All fields of a class" to "Java search template" in elements) // Predefined legacy Java configuration
|
||||
assert("all fields of a class bis" to "Java search template, user defined" in elements) // Newly created configuration
|
||||
}
|
||||
|
||||
}
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch.inspection;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch.inspection;
|
||||
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.codeInspection.ex.InspectionToolsSupplier;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.structuralsearch.inspection.SSBasedInspection;
|
||||
import com.intellij.structuralsearch.plugin.ui.Configuration;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import org.jdom.Element;
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch.inspection;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch.inspection;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator;
|
||||
@@ -11,6 +11,8 @@ import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.structuralsearch.MatchOptions;
|
||||
import com.intellij.structuralsearch.inspection.SSBasedInspection;
|
||||
import com.intellij.structuralsearch.inspection.StructuralSearchProfileActionProvider;
|
||||
import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
+8
-3
@@ -1,5 +1,5 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch.inspection;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.structuralsearch.inspection;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
@@ -10,11 +10,16 @@ import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.structuralsearch.MatchOptions;
|
||||
import com.intellij.structuralsearch.inspection.SSBasedInspection;
|
||||
import com.intellij.structuralsearch.inspection.StructuralSearchProfileActionProvider;
|
||||
import com.intellij.structuralsearch.plugin.replace.ui.ReplaceConfiguration;
|
||||
import com.intellij.structuralsearch.plugin.ui.Configuration;
|
||||
import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.*;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
|
||||
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -66,13 +66,12 @@ jvm_library(
|
||||
"//platform/testFramework",
|
||||
"//platform/testFramework:testFramework_test_lib",
|
||||
"//platform/structuralsearch:structuralSearch",
|
||||
"//java/testFramework",
|
||||
"//xml/impl",
|
||||
"//java/structuralsearch-java:structuralSearch",
|
||||
"//java/structuralsearch-java:structuralSearch_test_lib",
|
||||
"//platform/util/jdom",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark",
|
||||
"//tools/intellij.tools.ide.metrics.benchmark:ide-metrics-benchmark_test_lib",
|
||||
"//platform/testRunner",
|
||||
"//platform/testRunner:testRunner_test_lib",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.structuralSearch" />
|
||||
<orderEntry type="module" module-name="intellij.java.testFramework" />
|
||||
<orderEntry type="module" module-name="intellij.xml.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.structuralSearch" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.jdom" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testRunner" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
+3
-3
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
@@ -9,11 +8,12 @@ import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.compiler.PatternCompiler;
|
||||
import com.intellij.structuralsearch.plugin.replace.ReplaceOptions;
|
||||
import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class StructuralReplaceTestCase extends LightQuickFixTestCase {
|
||||
public abstract class StructuralReplaceTestCase extends LightPlatformCodeInsightTestCase {
|
||||
protected ReplaceOptions options;
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
@@ -11,6 +10,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.compiler.PatternCompiler;
|
||||
import com.intellij.structuralsearch.plugin.ui.UIUtil;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class StructuralSearchTestCase extends LightQuickFixTestCase {
|
||||
public abstract class StructuralSearchTestCase extends LightPlatformCodeInsightTestCase {
|
||||
protected MatchOptions options;
|
||||
|
||||
@Override
|
||||
|
||||
+1
-6
@@ -1,8 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.structuralsearch.plugin.ui;
|
||||
|
||||
import com.intellij.ide.highlighter.HtmlFileType;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
|
||||
/**
|
||||
@@ -17,8 +16,4 @@ public class CommunityDetectFileTypeTest extends DetectFileTypeTestCase {
|
||||
public void testDetectXml() {
|
||||
doTest(XmlFileType.INSTANCE, "<html><head><title>Hello <caret>Wrold</title></head></html>");
|
||||
}
|
||||
|
||||
public void testDetectJava() {
|
||||
doTest(JavaFileType.INSTANCE, "class X {{ System.out.println<caret>();}}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user