mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Test-only methods moved to test framework
This commit is contained in:
@@ -27,6 +27,7 @@ import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -144,7 +145,9 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
}
|
||||
|
||||
private static String getConvertedHomePath(Sdk sdk) {
|
||||
String path = sdk.getHomePath().replace('/', File.separatorChar);
|
||||
String homePath = sdk.getHomePath();
|
||||
assert homePath != null : sdk;
|
||||
String path = FileUtil.toSystemDependentName(homePath);
|
||||
if (!path.endsWith(File.separator)) {
|
||||
path += File.separator;
|
||||
}
|
||||
@@ -252,14 +255,14 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public void setupSdkPaths(Sdk sdk) {
|
||||
final File jdkHome = new File(sdk.getHomePath());
|
||||
VirtualFile[] classes = findClasses(jdkHome, false);
|
||||
List<VirtualFile> classes = findClasses(jdkHome, false);
|
||||
VirtualFile sources = findSources(jdkHome);
|
||||
VirtualFile docs = findDocs(jdkHome, "docs/api");
|
||||
|
||||
final SdkModificator sdkModificator = sdk.getSdkModificator();
|
||||
final Set<VirtualFile> previousRoots = new LinkedHashSet<VirtualFile>(Arrays.asList(sdkModificator.getRoots(OrderRootType.CLASSES)));
|
||||
sdkModificator.removeRoots(OrderRootType.CLASSES);
|
||||
previousRoots.removeAll(new HashSet<VirtualFile>(Arrays.asList(classes)));
|
||||
previousRoots.removeAll(new HashSet<VirtualFile>(classes));
|
||||
for (VirtualFile aClass : classes) {
|
||||
sdkModificator.addRoot(aClass, OrderRootType.CLASSES);
|
||||
}
|
||||
@@ -354,23 +357,6 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
return getVersionNumber(versionString).compareTo(versionNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sdk createJdk(final String jdkName, final String home, final boolean isJre) {
|
||||
ProjectJdkImpl jdk = new ProjectJdkImpl(jdkName, this);
|
||||
SdkModificator sdkModificator = jdk.getSdkModificator();
|
||||
|
||||
String path = home.replace(File.separatorChar, '/');
|
||||
sdkModificator.setHomePath(path);
|
||||
jdk.setVersionString(jdkName); // must be set after home path, otherwise setting home path clears the version string
|
||||
|
||||
File jdkHomeFile = new File(home);
|
||||
addClasses(jdkHomeFile, sdkModificator, isJre);
|
||||
addSources(jdkHomeFile, sdkModificator);
|
||||
addDocs(jdkHomeFile, sdkModificator);
|
||||
sdkModificator.commitChanges();
|
||||
return jdk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaSdkVersion getVersion(@NotNull Sdk sdk) {
|
||||
String version = sdk.getVersionString();
|
||||
@@ -397,78 +383,34 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
return sdkVersion != null && sdkVersion.isAtLeast(version);
|
||||
}
|
||||
|
||||
private static File getPathForJdkNamed(@NonNls String name) {
|
||||
File mockJdkCEPath = new File(PathManager.getHomePath(), "java/" + name);
|
||||
if (mockJdkCEPath.exists()) {
|
||||
return mockJdkCEPath;
|
||||
}
|
||||
return new File(PathManager.getHomePath(), "community/java/" + name);
|
||||
}
|
||||
public static Sdk getMockJdk17() {
|
||||
return getMockJdk17("java 1.7");
|
||||
}
|
||||
public static Sdk getMockJdk17(@NonNls String name) {
|
||||
return createMockJdk(getMockJdk17Path().getPath(), name, getInstance());
|
||||
}
|
||||
public static Sdk getMockJdk14() {
|
||||
File mockJdkCEPath = getMockJdk14Path();
|
||||
return createMockJdk(mockJdkCEPath.getPath(), "java 1.4", getInstance());
|
||||
}
|
||||
|
||||
public static File getMockJdk14Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.4");
|
||||
}
|
||||
public static File getMockJdk17Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.7");
|
||||
}
|
||||
|
||||
public static Sdk getWebMockJdk17() {
|
||||
Sdk jdk = getMockJdk17();
|
||||
addWebJarsTo(jdk);
|
||||
return jdk;
|
||||
}
|
||||
|
||||
public static void addWebJarsTo(Sdk jdk) {
|
||||
@Override
|
||||
public Sdk createJdk(@NotNull String jdkName, @NotNull String home, boolean isJre) {
|
||||
ProjectJdkImpl jdk = new ProjectJdkImpl(jdkName, this);
|
||||
SdkModificator sdkModificator = jdk.getSdkModificator();
|
||||
File jar = new File(PathManager.getHomePath(), "lib/jsp-api.jar");
|
||||
VirtualFile root = JarFileSystem.getInstance().getJarRootForLocalFile(LocalFileSystem.getInstance().findFileByIoFile(jar));
|
||||
sdkModificator.addRoot(root, OrderRootType.CLASSES);
|
||||
File jar2 = new File(PathManager.getHomePath(), "lib/servlet-api.jar");
|
||||
VirtualFile root2 = JarFileSystem.getInstance().getJarRootForLocalFile(LocalFileSystem.getInstance().findFileByIoFile(jar2));
|
||||
sdkModificator.addRoot(root2, OrderRootType.CLASSES);
|
||||
sdkModificator.commitChanges();
|
||||
}
|
||||
|
||||
private static Sdk createMockJdk(String jdkHome, @NonNls final String versionName, JavaSdk javaSdk) {
|
||||
File jdkHomeFile = new File(jdkHome);
|
||||
if (!jdkHomeFile.exists()) return null;
|
||||
|
||||
final Sdk jdk = new ProjectJdkImpl(versionName, javaSdk);
|
||||
final SdkModificator sdkModificator = jdk.getSdkModificator();
|
||||
|
||||
String path = jdkHome.replace(File.separatorChar, '/');
|
||||
String path = home.replace(File.separatorChar, '/');
|
||||
sdkModificator.setHomePath(path);
|
||||
sdkModificator.setVersionString(versionName); // must be set after home path, otherwise setting home path clears the version string
|
||||
sdkModificator.setVersionString(jdkName); // must be set after home path, otherwise setting home path clears the version string
|
||||
|
||||
File jdkHomeFile = new File(home);
|
||||
addClasses(jdkHomeFile, sdkModificator, isJre);
|
||||
addSources(jdkHomeFile, sdkModificator);
|
||||
addClasses(jdkHomeFile, sdkModificator, false);
|
||||
addClasses(jdkHomeFile, sdkModificator, true);
|
||||
addDocs(jdkHomeFile, sdkModificator);
|
||||
sdkModificator.commitChanges();
|
||||
|
||||
return jdk;
|
||||
}
|
||||
|
||||
private static void addClasses(File file, SdkModificator sdkModificator, final boolean isJre) {
|
||||
VirtualFile[] classes = findClasses(file, isJre);
|
||||
for (VirtualFile virtualFile : classes) {
|
||||
private static void addClasses(File file, SdkModificator sdkModificator, boolean isJre) {
|
||||
for (VirtualFile virtualFile : findClasses(file, isJre)) {
|
||||
sdkModificator.addRoot(virtualFile, OrderRootType.CLASSES);
|
||||
}
|
||||
}
|
||||
|
||||
private static VirtualFile[] findClasses(File file, boolean isJre) {
|
||||
List<File> rootFiles = JavaSdkUtil.getJdkClassesRoots(file, isJre);
|
||||
private static List<VirtualFile> findClasses(File file, boolean isJre) {
|
||||
List<VirtualFile> result = ContainerUtil.newArrayList();
|
||||
|
||||
ArrayList<VirtualFile> result = new ArrayList<VirtualFile>();
|
||||
List<File> rootFiles = JavaSdkUtil.getJdkClassesRoots(file, isJre);
|
||||
for (File child : rootFiles) {
|
||||
String url = VfsUtil.getUrlForLibraryRoot(child);
|
||||
VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
@@ -476,7 +418,8 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
result.add(vFile);
|
||||
}
|
||||
}
|
||||
return VfsUtilCore.toVirtualFileArray(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void addSources(File file, SdkModificator sdkModificator) {
|
||||
@@ -489,22 +432,22 @@ public class JavaSdkImpl extends JavaSdk {
|
||||
@Nullable
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public static VirtualFile findSources(File file) {
|
||||
File srcfile = new File(file, "src");
|
||||
File jarfile = new File(file, "src.jar");
|
||||
if (!jarfile.exists()) {
|
||||
jarfile = new File(file, "src.zip");
|
||||
File srcDir = new File(file, "src");
|
||||
File jarFile = new File(file, "src.jar");
|
||||
if (!jarFile.exists()) {
|
||||
jarFile = new File(file, "src.zip");
|
||||
}
|
||||
|
||||
if (jarfile.exists()) {
|
||||
VirtualFile vFile = findInJar(jarfile, "src");
|
||||
if (jarFile.exists()) {
|
||||
VirtualFile vFile = findInJar(jarFile, "src");
|
||||
if (vFile != null) return vFile;
|
||||
// try 1.4 format
|
||||
vFile = findInJar(jarfile, "");
|
||||
vFile = findInJar(jarFile, "");
|
||||
return vFile;
|
||||
}
|
||||
else {
|
||||
if (!srcfile.exists() || !srcfile.isDirectory()) return null;
|
||||
String path = srcfile.getAbsolutePath().replace(File.separatorChar, '/');
|
||||
if (!srcDir.exists() || !srcDir.isDirectory()) return null;
|
||||
String path = srcDir.getAbsolutePath().replace(File.separatorChar, '/');
|
||||
return LocalFileSystem.getInstance().findFileByPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -21,9 +21,9 @@ import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return JavaSdkImpl.getMockJdk17("java 1.7");
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.analysis.PackagesScopesProvider;
|
||||
@@ -27,6 +42,7 @@ import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopeManager;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
|
||||
import com.intellij.psi.search.scope.packageSet.PatternPackageSet;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -43,7 +59,7 @@ public class AdvHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_4);
|
||||
return JavaSdkImpl.getMockJdk14();
|
||||
return IdeaTestUtil.getMockJdk14();
|
||||
}
|
||||
|
||||
public void testPackageLocals() throws Exception {
|
||||
@@ -220,8 +236,8 @@ public class AdvHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
ModuleManager moduleManager = ModuleManager.getInstance(getProject());
|
||||
final Module java4 = moduleManager.findModuleByName("java4");
|
||||
Module java5 = moduleManager.findModuleByName("java5");
|
||||
ModuleRootModificationUtil.setModuleSdk(java4, JavaSdkImpl.getMockJdk17("java 1.4"));
|
||||
ModuleRootModificationUtil.setModuleSdk(java5, JavaSdkImpl.getMockJdk17("java 1.5"));
|
||||
ModuleRootModificationUtil.setModuleSdk(java4, IdeaTestUtil.getMockJdk17("java 1.4"));
|
||||
ModuleRootModificationUtil.setModuleSdk(java5, IdeaTestUtil.getMockJdk17("java 1.5"));
|
||||
ModuleRootModificationUtil.addDependency(java5, java4);
|
||||
|
||||
assert root != null;
|
||||
|
||||
+2
-2
@@ -23,11 +23,11 @@ import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return getTestName(false).contains("Jdk14") ? JavaSdkImpl.getMockJdk14() : super.getProjectJDK();
|
||||
return getTestName(false).contains("Jdk14") ? IdeaTestUtil.getMockJdk14() : super.getProjectJDK();
|
||||
}
|
||||
|
||||
public void testReferenceTypeParams() throws Exception { doTest(false); }
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class RedundantCast18Test extends InspectionTestCase {
|
||||
@@ -34,7 +35,7 @@ public class RedundantCast18Test extends InspectionTestCase {
|
||||
public void testExpectedSupertype() throws Exception { doTest(); }
|
||||
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = JavaSdkImpl.getMockJdk17();
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
|
||||
return sdk;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.dependencies;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -7,6 +22,7 @@ import com.intellij.cyclicDependencies.CyclicDependenciesBuilder;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
@@ -22,7 +38,7 @@ public class CyclicDependenciesTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/cycle/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
+17
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.dependencies;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -14,6 +29,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
@@ -34,7 +50,7 @@ public class UsagesInAnalyzingDependenciesTest extends PsiTestCase{
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/dependencies/search/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.find;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -17,6 +32,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.fixtures.TempDirTestFixture;
|
||||
@@ -317,7 +333,7 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
}
|
||||
VirtualFile projectDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(new File(testDir).getCanonicalPath().replace(File.separatorChar, '/'));
|
||||
|
||||
Sdk jdk = JavaSdkImpl.getMockJdk17();
|
||||
Sdk jdk = IdeaTestUtil.getMockJdk17();
|
||||
PsiTestUtil.removeAllRoots(myModule, jdk);
|
||||
PsiTestUtil.addContentRoot(myModule, projectDir);
|
||||
for (VirtualFile sourceDir : mySourceDirs) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class ArrayIndexOutOfBoundsTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/arrayIndexOutOfBounds/src";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.vfs.VirtualFileFilter;
|
||||
import com.intellij.psi.impl.java.stubs.PsiMethodStub;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
@@ -52,7 +53,7 @@ public class ClsRepositoryUseTest extends PsiTestCase {
|
||||
public void run() {
|
||||
try {
|
||||
VirtualFile vDir = getRootFile();
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
addLibraryToRoots(vDir, OrderRootType.CLASSES);
|
||||
// PsiTestUtil.addSourceContentToRoots(myProject, vDir);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.vfs.VirtualFileFilter;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -34,7 +35,7 @@ public class ModifyAnnotationsTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/repositoryUse/modifyAnnotations";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17("mock 1.5"));
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("mock 1.5"));
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.Timings;
|
||||
@@ -48,7 +49,7 @@ public class PsiConcurrencyStressTest extends PsiTestCase {
|
||||
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
String root = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/src";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -19,6 +34,7 @@ import com.intellij.psi.stubs.StubTree;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
@@ -37,7 +53,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/codeEditor/smartPsiElementPointers";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.psi.search.searches.AnnotatedMembersSearch;
|
||||
import com.intellij.psi.search.searches.AnnotatedPackagesSearch;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
@@ -48,7 +49,7 @@ public class Src15RepositoryUseTest extends PsiTestCase {
|
||||
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
String root = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/src15";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17("mock 1.5"));
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("mock 1.5"));
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -22,6 +37,7 @@ import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.text.BlockSupport;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
@@ -41,7 +57,7 @@ public class SrcRepositoryUseTest extends PsiTestCase{
|
||||
|
||||
LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
String root = PathManagerEx.getTestDataPath() + "/psi/repositoryUse/src";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi.impl.cache.impl;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -19,6 +34,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.TodoAttributes;
|
||||
import com.intellij.psi.search.TodoPattern;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
@@ -41,7 +57,7 @@ public class IdCacheTest extends CodeInsightTestCase{
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath()+ "/psi/impl/cache/";
|
||||
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myRootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
|
||||
myCacheFile = FileUtil.createTempFile("cache", "");
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
package com.intellij.psi.resolve;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.infos.MethodCandidateInfo;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.ResolveTestCase;
|
||||
|
||||
public class ResolveMethodTest extends ResolveTestCase {
|
||||
@@ -32,13 +32,14 @@ public class ResolveMethodTest extends ResolveTestCase {
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
return JavaSdkImpl.getMockJdk14();
|
||||
return IdeaTestUtil.getMockJdk14();
|
||||
}
|
||||
|
||||
private PsiElement resolve() throws Exception {
|
||||
PsiReference ref = configureByFile("method/" + getTestName(false) + ".java");
|
||||
return ref.resolve();
|
||||
}
|
||||
|
||||
private JavaResolveResult advancedResolve() throws Exception {
|
||||
PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)configureByFile("method/" + getTestName(false) + ".java");
|
||||
return ref.advancedResolve(true);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi.search;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -9,6 +24,7 @@ import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
@@ -20,7 +36,7 @@ public class FindUsages15Test extends PsiTestCase{
|
||||
|
||||
LanguageLevelProjectExtension.getInstance(myJavaFacade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/findUsages15/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17("java 1.5"));
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("java 1.5"));
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
|
||||
@@ -50,7 +51,7 @@ public class FindUsagesTest extends PsiTestCase{
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/findUsages/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi.search;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -22,7 +37,7 @@ public class InheritorsTest extends PsiTestCase{
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/inheritors/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.psi.search;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -11,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.containers.IntArrayList;
|
||||
@@ -24,7 +40,7 @@ public class PlainTextUsagesTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/psi/search/plainTextUsages/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -18,11 +18,14 @@ package com.intellij.refactoring;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiLocalVariable;
|
||||
import com.intellij.psi.PsiMethodCallExpression;
|
||||
import com.intellij.psi.PsiReferenceExpression;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer;
|
||||
import com.intellij.testFramework.IdeaTestCase;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -56,7 +59,7 @@ public abstract class AbstractJavaInplaceIntroduceTest extends AbstractInplaceIn
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -10,6 +25,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.refactoring.copy.CopyClassesHandler;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -35,7 +51,7 @@ public class CopyClassTest extends CodeInsightTestCase {
|
||||
private void doTest(final String oldName, final String copyName) throws Exception {
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/" + getTestName(true);
|
||||
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17("java 1.5"));
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17("java 1.5"));
|
||||
myRootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
|
||||
PsiElement element = performAction(oldName, copyName);
|
||||
@@ -67,7 +83,7 @@ public class CopyClassTest extends CodeInsightTestCase {
|
||||
private void doMultifileTest() throws Exception {
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
|
||||
String rootBefore = root + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
final HashMap<PsiFile, PsiClass[]> map = new HashMap<PsiFile, PsiClass[]>();
|
||||
@@ -99,7 +115,7 @@ public class CopyClassTest extends CodeInsightTestCase {
|
||||
private void doPackageCopy() throws Exception {
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/copyClass/multifile/" + getTestName(true);
|
||||
String rootBefore = root + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
final VirtualFile targetVDir = rootDir.findChild("p2");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.copy.CopyHandler;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class CopyTest extends CodeInsightTestCase {
|
||||
|
||||
private void doTest() throws Exception {
|
||||
String rootBefore = getRoot();
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
PsiPackage pack1 = myJavaFacade.findPackage("pack1");
|
||||
PsiPackage pack2 = myJavaFacade.findPackage("pack2");
|
||||
@@ -49,7 +50,7 @@ public class CopyTest extends CodeInsightTestCase {
|
||||
|
||||
public void testMultipleClasses() throws Exception {
|
||||
String rootBefore = getRoot();
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
final VirtualFile root = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
final PsiClass aClass = myJavaFacade.findClass("pack1.Klass");
|
||||
assertNotNull(aClass);
|
||||
@@ -71,7 +72,7 @@ public class CopyTest extends CodeInsightTestCase {
|
||||
|
||||
public void testMultipleFiles() throws Exception {
|
||||
String rootBefore = getRoot();
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
final VirtualFile root = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
final VirtualFile first = root.findFileByRelativePath("from/1.txt");
|
||||
@@ -96,7 +97,7 @@ public class CopyTest extends CodeInsightTestCase {
|
||||
|
||||
public void testPackageInfo() throws Exception {
|
||||
String rootBefore = getRoot();
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
final VirtualFile root = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
final VirtualFile first = root.findFileByRelativePath("from/package-info.java");
|
||||
|
||||
@@ -1,8 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -133,7 +147,7 @@ public class ExtractSuperClassTest extends RefactoringTestCase {
|
||||
String targetPackageName,
|
||||
RefactoringTestUtil.MemberDescriptor... membersToFind) throws Exception {
|
||||
String rootBefore = getRoot() + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk14());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk14());
|
||||
final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
PsiClass psiClass = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
|
||||
assertNotNull(psiClass);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -52,7 +52,7 @@ public class MoveClassAndFileTest extends RefactoringTestCase {
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClassAndFile/" + testName;
|
||||
|
||||
String rootBefore = root + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
performAction(newPackageName, fileNameNearFirstClass, classNames);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -10,6 +25,7 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.SingleSourceRootMoveDestination;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -79,7 +95,7 @@ public class MoveClassTest extends RefactoringTestCase {
|
||||
String root = JavaTestUtil.getJavaTestDataPath() + "/refactoring/moveClass/" + testName;
|
||||
|
||||
String rootBefore = root + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
|
||||
performAction(classNames, newPackageName);
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.refactoring;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -119,7 +134,7 @@ public class MoveClassToInnerTest extends RefactoringTestCase {
|
||||
|
||||
private VirtualFile prepareTest() throws Exception {
|
||||
String rootBefore = getRoot() + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
return PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.refactoring.inline;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -45,7 +44,7 @@ public class InlineMethodMultifileTest extends RefactoringTestCase {
|
||||
|
||||
private void doTest(String className, String methodName) throws Exception {
|
||||
String rootBefore = getRoot() + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
PsiClass aClass = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
|
||||
assertTrue(aClass != null);
|
||||
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.refactoring.inline;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -38,7 +53,7 @@ public class InlineToAnonymousClassMultifileTest extends RefactoringTestCase {
|
||||
|
||||
private void doTest(String className) throws Exception {
|
||||
String rootBefore = getRoot() + "/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
final VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, rootBefore, myFilesToDelete);
|
||||
PsiClass classToInline = myJavaFacade.findClass(className, ProjectScope.getAllScope(myProject));
|
||||
assertEquals(null, InlineToAnonymousClassHandler.getCannotInlineMessage(classToInline));
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.roots;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -6,6 +21,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.ModuleTestCase;
|
||||
import junit.framework.Assert;
|
||||
|
||||
@@ -18,7 +34,7 @@ public class InheritedJdkTest extends ModuleTestCase {
|
||||
}
|
||||
|
||||
public void test1() throws Exception {
|
||||
final Sdk jdk = JavaSdkImpl.getMockJdk17("java 1.4");
|
||||
final Sdk jdk = IdeaTestUtil.getMockJdk17("java 1.4");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -44,7 +60,7 @@ public class InheritedJdkTest extends ModuleTestCase {
|
||||
assertFalse("JDK is not inherited after setJdk(null)", rootManager.isSdkInherited());
|
||||
assertNull("No JDK assigned", rootManager.getSdk());
|
||||
|
||||
final Sdk jdk1 = JavaSdkImpl.getMockJdk17("jjj");
|
||||
final Sdk jdk1 = IdeaTestUtil.getMockJdk17("jjj");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -64,7 +80,7 @@ public class InheritedJdkTest extends ModuleTestCase {
|
||||
assertTrue("JDK is inherited after inheritSdk()", rootManager.isSdkInherited());
|
||||
assertNull("No JDK assigned", rootManager.getSdk());
|
||||
|
||||
final Sdk mockJdk = JavaSdkImpl.getMockJdk17("mock 1.4");
|
||||
final Sdk mockJdk = IdeaTestUtil.getMockJdk17("mock 1.4");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -100,7 +116,7 @@ public class InheritedJdkTest extends ModuleTestCase {
|
||||
}, null));
|
||||
assertNull("Non-existing JDK", rootManager.getSdk());
|
||||
|
||||
final Sdk jdk1 = JavaSdkImpl.getMockJdk17("jdk1");
|
||||
final Sdk jdk1 = IdeaTestUtil.getMockJdk17("jdk1");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.intellij.roots;
|
||||
|
||||
import com.intellij.application.options.ReplacePathToMacroMap;
|
||||
@@ -15,6 +30,7 @@ import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.ModuleTestCase;
|
||||
import com.intellij.ide.highlighter.ModuleFileType;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
@@ -83,7 +99,7 @@ public class ModuleRootsExternalizationTest extends ModuleTestCase {
|
||||
PsiTestUtil.addContentRoot(module, contentFile);
|
||||
PsiTestUtil.addSourceRoot(module, sourceFile);
|
||||
PsiTestUtil.addSourceRoot(module, testSourceFile, true);
|
||||
ModuleRootModificationUtil.setModuleSdk(module, JavaSdkImpl.getMockJdk17());
|
||||
ModuleRootModificationUtil.setModuleSdk(module, IdeaTestUtil.getMockJdk17());
|
||||
PsiTestUtil.addExcludedRoot(module, excludeFile);
|
||||
PsiTestUtil.setCompilerOutputPath(module, classesFile.getUrl(), false);
|
||||
PsiTestUtil.setCompilerOutputPath(module, testClassesFile.getUrl(), true);
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.ModuleTestCase;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class RootsChangedTest extends ModuleTestCase {
|
||||
final Module moduleB = createModule("b.iml");
|
||||
assertEventsCount(2);
|
||||
|
||||
final Sdk jdk = JavaSdkImpl.getMockJdk17();
|
||||
final Sdk jdk = IdeaTestUtil.getMockJdk17();
|
||||
ProjectJdkTable.getInstance().addJdk(jdk);
|
||||
assertEventsCount(0);
|
||||
|
||||
@@ -111,11 +112,11 @@ public class RootsChangedTest extends ModuleTestCase {
|
||||
final Module moduleB = createModule("b.iml");
|
||||
assertEventsCount(2);
|
||||
|
||||
final Sdk jdk = JavaSdkImpl.getMockJdk17("AAA");
|
||||
final Sdk jdk = IdeaTestUtil.getMockJdk17("AAA");
|
||||
ProjectJdkTable.getInstance().addJdk(jdk);
|
||||
assertEventsCount(0);
|
||||
|
||||
final Sdk jdkBBB = JavaSdkImpl.getMockJdk17("BBB");
|
||||
final Sdk jdkBBB = IdeaTestUtil.getMockJdk17("BBB");
|
||||
ProjectJdkTable.getInstance().addJdk(jdk);
|
||||
assertEventsCount(0);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -33,7 +33,7 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType, Applicatio
|
||||
return ApplicationManager.getApplication().getComponent(JavaSdk.class);
|
||||
}
|
||||
|
||||
public final Sdk createJdk(final String jdkName, String jreHome) {
|
||||
public final Sdk createJdk(@NotNull String jdkName, @NotNull String jreHome) {
|
||||
return createJdk(jdkName, jreHome, true);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType, Applicatio
|
||||
*/
|
||||
public abstract int compareTo(@NotNull String versionString, @NotNull String versionNumber);
|
||||
|
||||
public abstract Sdk createJdk(@NonNls String jdkName, String home, boolean isJre);
|
||||
public abstract Sdk createJdk(@NonNls String jdkName, @NotNull String home, boolean isJre);
|
||||
|
||||
@Nullable
|
||||
public abstract JavaSdkVersion getVersion(@NotNull Sdk sdk);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -55,7 +55,7 @@ public abstract class IdeaTestCase extends PlatformTestCase {
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectJdk() {
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -15,10 +15,21 @@
|
||||
*/
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class IdeaTestUtil extends PlatformTestUtil {
|
||||
public static void main(String[] args) {
|
||||
@@ -51,4 +62,51 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
modifiable.setLanguageLevel(level);
|
||||
modifiable.commit();
|
||||
}
|
||||
|
||||
public static Sdk getMockJdk17() {
|
||||
return getMockJdk17("java 1.7");
|
||||
}
|
||||
|
||||
public static Sdk getMockJdk17(@NotNull String name) {
|
||||
return JavaSdk.getInstance().createJdk(name, getMockJdk17Path().getPath(), false);
|
||||
}
|
||||
|
||||
public static Sdk getMockJdk14() {
|
||||
return JavaSdk.getInstance().createJdk("java 1.4", getMockJdk14Path().getPath(), false);
|
||||
}
|
||||
|
||||
public static File getMockJdk14Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.4");
|
||||
}
|
||||
|
||||
public static File getMockJdk17Path() {
|
||||
return getPathForJdkNamed("mockJDK-1.7");
|
||||
}
|
||||
|
||||
private static File getPathForJdkNamed(String name) {
|
||||
File mockJdkCEPath = new File(PathManager.getHomePath(), "java/" + name);
|
||||
return mockJdkCEPath.exists() ? mockJdkCEPath : new File(PathManager.getHomePath(), "community/java/" + name);
|
||||
}
|
||||
|
||||
public static Sdk getWebMockJdk17() {
|
||||
Sdk jdk = getMockJdk17();
|
||||
addWebJarsTo(jdk);
|
||||
return jdk;
|
||||
}
|
||||
|
||||
public static void addWebJarsTo(@NotNull Sdk jdk) {
|
||||
SdkModificator sdkModificator = jdk.getSdkModificator();
|
||||
sdkModificator.addRoot(findJar("lib/jsp-api.jar"), OrderRootType.CLASSES);
|
||||
sdkModificator.addRoot(findJar("lib/servlet-api.jar"), OrderRootType.CLASSES);
|
||||
sdkModificator.commitChanges();
|
||||
}
|
||||
|
||||
private static VirtualFile findJar(String name) {
|
||||
String path = PathManager.getHomePath() + '/' + name;
|
||||
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path);
|
||||
assert file != null : "not found: " + path;
|
||||
VirtualFile jar = JarFileSystem.getInstance().getJarRootForLocalFile(file);
|
||||
assert jar != null : "no .jar for: " + path;
|
||||
return jar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
@@ -220,11 +219,10 @@ public abstract class InspectionTestCase extends PsiTestCase {
|
||||
|
||||
@Override
|
||||
protected void setUpJdk() {
|
||||
|
||||
}
|
||||
|
||||
protected Sdk getTestProjectSdk() {
|
||||
Sdk sdk = JavaSdkImpl.getMockJdk17();
|
||||
Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
|
||||
return sdk;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.testFramework;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.impl.JavaPsiFacadeEx;
|
||||
@@ -29,6 +28,7 @@ import com.intellij.psi.impl.JavaPsiFacadeEx;
|
||||
public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightTestCase {
|
||||
private LanguageLevel myOldLanguageLevel;
|
||||
|
||||
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
|
||||
protected LightCodeInsightTestCase() {
|
||||
IdeaTestCase.initPlatformPrefix();
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightT
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class LightIdeaTestCase extends LightPlatformTestCase {
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -128,7 +127,7 @@ public abstract class PsiTestCase extends ModuleTestCase {
|
||||
|
||||
myTestDataBefore = loadData(dataName);
|
||||
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
VirtualFile vDir = PsiTestUtil.createTestProjectStructure(myProject, myModule, myDataRoot, myFilesToDelete);
|
||||
|
||||
final VirtualFile vFile = vDir.findChild(myTestDataBefore.getTextFile());
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -15,16 +15,16 @@
|
||||
*/
|
||||
package com.intellij.testFramework.fixtures;
|
||||
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -37,7 +37,7 @@ public class DefaultLightProjectDescriptor implements LightProjectDescriptor {
|
||||
|
||||
@Override
|
||||
public Sdk getSdk() {
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -20,8 +20,8 @@ import com.intellij.compiler.CompilerConfigurationImpl;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.projectRoots.impl.MockJdkWrapper;
|
||||
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
|
||||
import com.intellij.openapi.roots.*;
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
|
||||
import com.intellij.testFramework.fixtures.ModuleFixture;
|
||||
@@ -141,11 +142,11 @@ abstract class JavaModuleFixtureBuilderImpl<T extends ModuleFixture> extends Mod
|
||||
|
||||
final Sdk jdk;
|
||||
if (myJdk != null) {
|
||||
jdk = JavaSdkImpl.getInstance().createJdk(module.getName() + "_jdk", myJdk, false);
|
||||
jdk = JavaSdk.getInstance().createJdk(module.getName() + "_jdk", myJdk, false);
|
||||
((ProjectJdkImpl)jdk).setVersionString("java 1.5");
|
||||
}
|
||||
else {
|
||||
jdk = JavaSdkImpl.getMockJdk17();
|
||||
jdk = IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
if (jdk != null) {
|
||||
model.setSdk(new MockJdkWrapper(CompilerConfigurationImpl.getTestsExternalCompilerHome(), jdk));
|
||||
|
||||
@@ -1,9 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.resources;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.siyeh.ig.resources.IOResourceInspection;
|
||||
|
||||
@@ -15,7 +31,7 @@ public class IOResourceInspectionTest extends IGInspectionTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
|
||||
+17
-1
@@ -1,9 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
|
||||
/**
|
||||
@@ -14,7 +30,7 @@ public class FinalPrivateMethodInspectionTest extends IGInspectionTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.siyeh.ig.dataflow;
|
||||
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
@@ -24,7 +25,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
public class UnnecessaryLocalVariableInspectionTest extends IGInspectionTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
final Sdk sdk = JavaSdkImpl.getMockJdk17();
|
||||
final Sdk sdk = IdeaTestUtil.getMockJdk17();
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return sdk;
|
||||
}
|
||||
|
||||
+17
-1
@@ -1,9 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.siyeh.ig.migration;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
|
||||
public class TryFinallyCanBeTryWithResourcesInspectionTest extends IGInspectionTestCase {
|
||||
@@ -11,7 +27,7 @@ public class TryFinallyCanBeTryWithResourcesInspectionTest extends IGInspectionT
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
|
||||
+17
-1
@@ -1,16 +1,32 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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 com.siyeh.ig.style;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
|
||||
public class UnnecessarySemicolonInspectionTest extends IGInspectionTestCase {
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
|
||||
return JavaSdkImpl.getMockJdk17();
|
||||
return IdeaTestUtil.getMockJdk17();
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.android.newProject.AndroidModuleBuilder;
|
||||
import org.jetbrains.android.newProject.AndroidModuleWizardStep;
|
||||
@@ -82,7 +83,7 @@ public class AndroidProjectWizardTest extends ProjectWizardTestCase {
|
||||
}
|
||||
|
||||
public void testAddAndroidModuleToJavaProject() throws Exception {
|
||||
ProjectRootManager.getInstance(getProject()).setProjectSdk(JavaSdkImpl.getMockJdk17());
|
||||
ProjectRootManager.getInstance(getProject()).setProjectSdk(IdeaTestUtil.getMockJdk17());
|
||||
Module module = createModuleFromTemplate(AndroidProjectTemplatesFactory.ANDROID, AndroidProjectTemplatesFactory.EMPTY_MODULE, null);
|
||||
assertNotNull(module);
|
||||
Sdk moduleSdk = ModuleRootManager.getInstance(module).getSdk();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.projectRoots.SdkTypeId;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.TestActionEvent;
|
||||
import org.jetbrains.android.sdk.AndroidSdkType;
|
||||
import org.jetbrains.android.util.AndroidBundle;
|
||||
@@ -48,7 +49,7 @@ public class AndroidSdkTypeTest extends ProjectWizardTestCase {
|
||||
|
||||
public void testSatisfied() throws Exception {
|
||||
ProjectSdksModel model = new ProjectSdksModel();
|
||||
model.addSdk(JavaSdkImpl.getMockJdk17());
|
||||
model.addSdk(IdeaTestUtil.getMockJdk17());
|
||||
ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
|
||||
Sdk sdk = jdkTable.createSdk("a", AndroidSdkType.getInstance());
|
||||
mySdks.add(sdk);
|
||||
|
||||
+1
-2
@@ -40,7 +40,6 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.StdModuleTypes;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
@@ -107,7 +106,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
|
||||
@Override
|
||||
protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception {
|
||||
moduleBuilder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
|
||||
moduleBuilder.addJdk(JavaSdkImpl.getMockJdk17Path().getPath());
|
||||
moduleBuilder.addJdk(IdeaTestUtil.getMockJdk17Path().getPath());
|
||||
super.tuneFixture(moduleBuilder);
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -13,14 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.refactoring.move;
|
||||
|
||||
package org.jetbrains.plugins.groovy.refactoring.move
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.psi.impl.source.PostprocessReformattingAspect
|
||||
import com.intellij.testFramework.IdeaTestUtil
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.PsiTestUtil
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase
|
||||
@@ -33,7 +32,7 @@ public abstract class GroovyMoveTestBase extends JavaCodeInsightFixtureTestCase
|
||||
String root = PathManager.homePath.replace(File.separatorChar, '/' as char) + basePath + getTestName(true);
|
||||
|
||||
String rootBefore = "$root/before";
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.mockJdk17);
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.mockJdk17);
|
||||
ArrayList<File> filesToDelete = new ArrayList<File>();
|
||||
VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myFixture.project, myModule, rootBefore, filesToDelete);
|
||||
def localFileSystem = LocalFileSystem.instance
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
@@ -518,7 +519,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase {
|
||||
}
|
||||
|
||||
protected static Sdk createJdk(String versionName) {
|
||||
return JavaSdkImpl.getMockJdk17(versionName);
|
||||
return IdeaTestUtil.getMockJdk17(versionName);
|
||||
}
|
||||
|
||||
protected void compileModules(final String... moduleNames) throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -24,7 +24,6 @@ package com.intellij.uiDesigner.binding;
|
||||
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -33,6 +32,7 @@ import com.intellij.psi.PsiEnumConstant;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -45,7 +45,7 @@ public class FormEnumUsageTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.Query;
|
||||
@@ -44,7 +45,7 @@ public class FormPropertyUsageTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/binding/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 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.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestCase;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class FormSourceCodeGeneratorTest extends PsiTestCase {
|
||||
super.setUp();
|
||||
|
||||
String root = PluginPathManager.getPluginHomePath("ui-designer") + "/testData/sourceCodeGenerator/" + getTestName(true);
|
||||
PsiTestUtil.removeAllRoots(myModule, JavaSdkImpl.getMockJdk17());
|
||||
PsiTestUtil.removeAllRoots(myModule, IdeaTestUtil.getMockJdk17());
|
||||
myTestProjectRoot = PsiTestUtil.createTestProjectStructure(myProject, myModule, root, myFilesToDelete);
|
||||
myGenerator = new FormSourceCodeGenerator(getProject());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user