diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java index c107e5ce1c63..519b39e0e34c 100644 --- a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java +++ b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java @@ -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 classes = findClasses(jdkHome, false); VirtualFile sources = findSources(jdkHome); VirtualFile docs = findDocs(jdkHome, "docs/api"); final SdkModificator sdkModificator = sdk.getSdkModificator(); final Set previousRoots = new LinkedHashSet(Arrays.asList(sdkModificator.getRoots(OrderRootType.CLASSES))); sdkModificator.removeRoots(OrderRootType.CLASSES); - previousRoots.removeAll(new HashSet(Arrays.asList(classes))); + previousRoots.removeAll(new HashSet(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 rootFiles = JavaSdkUtil.getJdkClassesRoots(file, isJre); + private static List findClasses(File file, boolean isJre) { + List result = ContainerUtil.newArrayList(); - ArrayList result = new ArrayList(); + List 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); } } diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java index acc63b9e59cb..92c4d7c351b2 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java @@ -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 diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingTest.java index cd2914873945..a5cdf9d20882 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingTest.java @@ -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; diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java index aaffb7add958..d3d76f535d9a 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast18Test.java b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast18Test.java index f347d3b35aa4..7dd819d9f836 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast18Test.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/RedundantCast18Test.java @@ -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; } diff --git a/java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java b/java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java index 7f790977104f..70eded740c4a 100644 --- a/java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java +++ b/java/java-tests/testSrc/com/intellij/dependencies/CyclicDependenciesTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/dependencies/UsagesInAnalyzingDependenciesTest.java b/java/java-tests/testSrc/com/intellij/dependencies/UsagesInAnalyzingDependenciesTest.java index 47730354fb94..79d8488dcc6e 100644 --- a/java/java-tests/testSrc/com/intellij/dependencies/UsagesInAnalyzingDependenciesTest.java +++ b/java/java-tests/testSrc/com/intellij/dependencies/UsagesInAnalyzingDependenciesTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java index 0fbce3182562..0274aade1b96 100644 --- a/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java +++ b/java/java-tests/testSrc/com/intellij/find/FindManagerTest.java @@ -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) { diff --git a/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java b/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java index a8a4286798ae..f82d43007201 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ArrayIndexOutOfBoundsTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java index b7e517502222..22a3b81138e1 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java b/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java index 34ba1f8aad32..1895c674590f 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ModifyAnnotationsTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java index 79dbeaf650c8..af5ca8dc598e 100644 --- a/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/PsiConcurrencyStressTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/SmartPsiElementPointersTest.java b/java/java-tests/testSrc/com/intellij/psi/SmartPsiElementPointersTest.java index b3425818034f..b3dba9d46fb5 100644 --- a/java/java-tests/testSrc/com/intellij/psi/SmartPsiElementPointersTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/SmartPsiElementPointersTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java index 06b0cc1f13c8..7424659f0afd 100644 --- a/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/Src15RepositoryUseTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java index fa6ede986b0b..8400116eb98d 100644 --- a/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/SrcRepositoryUseTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java index df764a72bb7b..b86eef0fb3c4 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/IdCacheTest.java @@ -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", ""); diff --git a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethodTest.java b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethodTest.java index b91df431fe78..274483b52350 100644 --- a/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethodTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/resolve/ResolveMethodTest.java @@ -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); diff --git a/java/java-tests/testSrc/com/intellij/psi/search/FindUsages15Test.java b/java/java-tests/testSrc/com/intellij/psi/search/FindUsages15Test.java index 818b044c32d5..45923fa78402 100644 --- a/java/java-tests/testSrc/com/intellij/psi/search/FindUsages15Test.java +++ b/java/java-tests/testSrc/com/intellij/psi/search/FindUsages15Test.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java index 676425af10a7..7e9bb8425a10 100644 --- a/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/search/FindUsagesTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/search/InheritorsTest.java b/java/java-tests/testSrc/com/intellij/psi/search/InheritorsTest.java index 2c8548a361c0..11aa9b6a260d 100644 --- a/java/java-tests/testSrc/com/intellij/psi/search/InheritorsTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/search/InheritorsTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/psi/search/PlainTextUsagesTest.java b/java/java-tests/testSrc/com/intellij/psi/search/PlainTextUsagesTest.java index 6aa4ba710f5c..03ebf7740629 100644 --- a/java/java-tests/testSrc/com/intellij/psi/search/PlainTextUsagesTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/search/PlainTextUsagesTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java index 8845dc17956e..5c760cedc1fd 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/AbstractJavaInplaceIntroduceTest.java @@ -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 diff --git a/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java b/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java index 048f9274129a..8c619e86fccb 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/CopyClassTest.java @@ -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 map = new HashMap(); @@ -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"); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/CopyTest.java b/java/java-tests/testSrc/com/intellij/refactoring/CopyTest.java index a0eee1b2a83d..02deb5520cff 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/CopyTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/CopyTest.java @@ -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"); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/ExtractSuperClassTest.java b/java/java-tests/testSrc/com/intellij/refactoring/ExtractSuperClassTest.java index d2056055c9f3..1541af66adec 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/ExtractSuperClassTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/ExtractSuperClassTest.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); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java index 81123c052f90..b91a6e19e846 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassAndFileTest.java @@ -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); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassTest.java index 1bf2be572521..4c4a4980a76d 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassTest.java @@ -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); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassToInnerTest.java b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassToInnerTest.java index 3d2f3efcfc5f..7a7cac1da5d9 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/MoveClassToInnerTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/MoveClassToInnerTest.java @@ -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); } diff --git a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodMultifileTest.java b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodMultifileTest.java index c071452f6f6e..af19fc3349b0 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodMultifileTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineMethodMultifileTest.java @@ -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); diff --git a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineToAnonymousClassMultifileTest.java b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineToAnonymousClassMultifileTest.java index 0fc435f1c54e..ff5424fbc45a 100644 --- a/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineToAnonymousClassMultifileTest.java +++ b/java/java-tests/testSrc/com/intellij/refactoring/inline/InlineToAnonymousClassMultifileTest.java @@ -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)); diff --git a/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java b/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java index 6e0c60c0b06f..8a54ba0973d0 100644 --- a/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/InheritedJdkTest.java @@ -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() { diff --git a/java/java-tests/testSrc/com/intellij/roots/ModuleRootsExternalizationTest.java b/java/java-tests/testSrc/com/intellij/roots/ModuleRootsExternalizationTest.java index 5dbcdb250afa..86ab670283aa 100644 --- a/java/java-tests/testSrc/com/intellij/roots/ModuleRootsExternalizationTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/ModuleRootsExternalizationTest.java @@ -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); diff --git a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java index c2f75d32dd41..8d61ad0b94b4 100644 --- a/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java +++ b/java/java-tests/testSrc/com/intellij/roots/RootsChangedTest.java @@ -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); diff --git a/java/openapi/src/com/intellij/openapi/projectRoots/JavaSdk.java b/java/openapi/src/com/intellij/openapi/projectRoots/JavaSdk.java index c0fe5fc92dc2..88a5c55c1c2a 100644 --- a/java/openapi/src/com/intellij/openapi/projectRoots/JavaSdk.java +++ b/java/openapi/src/com/intellij/openapi/projectRoots/JavaSdk.java @@ -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); diff --git a/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java b/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java index ba9226c1e76a..8144d1cdf508 100644 --- a/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/IdeaTestCase.java @@ -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 diff --git a/java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java b/java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java index 98d260e93b6e..0f94f6a6e540 100644 --- a/java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java +++ b/java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java @@ -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; + } } diff --git a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java index 7d8c773a0012..a93ea6bb718d 100644 --- a/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/InspectionTestCase.java @@ -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; } diff --git a/java/testFramework/src/com/intellij/testFramework/LightCodeInsightTestCase.java b/java/testFramework/src/com/intellij/testFramework/LightCodeInsightTestCase.java index 32a13288f3dd..0ecf5ff90972 100644 --- a/java/testFramework/src/com/intellij/testFramework/LightCodeInsightTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/LightCodeInsightTestCase.java @@ -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 diff --git a/java/testFramework/src/com/intellij/testFramework/LightIdeaTestCase.java b/java/testFramework/src/com/intellij/testFramework/LightIdeaTestCase.java index d906bbf6c3a6..8da3a59bca32 100644 --- a/java/testFramework/src/com/intellij/testFramework/LightIdeaTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/LightIdeaTestCase.java @@ -42,7 +42,7 @@ public abstract class LightIdeaTestCase extends LightPlatformTestCase { @Override protected Sdk getProjectJDK() { - return JavaSdkImpl.getMockJdk17(); + return IdeaTestUtil.getMockJdk17(); } @Override diff --git a/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java b/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java index b618b57116cf..63bbdb23f6a0 100644 --- a/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java +++ b/java/testFramework/src/com/intellij/testFramework/PsiTestCase.java @@ -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()); diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/DefaultLightProjectDescriptor.java b/java/testFramework/src/com/intellij/testFramework/fixtures/DefaultLightProjectDescriptor.java index 1dc3be12660e..2a2d15cea754 100644 --- a/java/testFramework/src/com/intellij/testFramework/fixtures/DefaultLightProjectDescriptor.java +++ b/java/testFramework/src/com/intellij/testFramework/fixtures/DefaultLightProjectDescriptor.java @@ -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 diff --git a/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaModuleFixtureBuilderImpl.java b/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaModuleFixtureBuilderImpl.java index 55835ec3d610..21f3e4336574 100644 --- a/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaModuleFixtureBuilderImpl.java +++ b/java/testFramework/src/com/intellij/testFramework/fixtures/impl/JavaModuleFixtureBuilderImpl.java @@ -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 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)); diff --git a/plugins/InspectionGadgets/testsrc/com/resources/IOResourceInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/resources/IOResourceInspectionTest.java index 2cd9daf813f4..6161130004a6 100644 --- a/plugins/InspectionGadgets/testsrc/com/resources/IOResourceInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/resources/IOResourceInspectionTest.java @@ -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 { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/FinalPrivateMethodInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/FinalPrivateMethodInspectionTest.java index 1ad073ed314c..cc10fbc46415 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/FinalPrivateMethodInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/classlayout/FinalPrivateMethodInspectionTest.java @@ -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 { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionTest.java index 30d7209f2337..b7f1fb4ff67f 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/dataflow/UnnecessaryLocalVariableInspectionTest.java @@ -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; } diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/TryFinallyCanBeTryWithResourcesInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/TryFinallyCanBeTryWithResourcesInspectionTest.java index b0f661376983..240d49346f9e 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/TryFinallyCanBeTryWithResourcesInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/TryFinallyCanBeTryWithResourcesInspectionTest.java @@ -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 { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java index e2ab41544a1d..33c3cc8af3ce 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java @@ -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 { diff --git a/plugins/android/testSrc/org/jetbrains/android/AndroidProjectWizardTest.java b/plugins/android/testSrc/org/jetbrains/android/AndroidProjectWizardTest.java index 02b4295fcc6a..8e69897130f5 100644 --- a/plugins/android/testSrc/org/jetbrains/android/AndroidProjectWizardTest.java +++ b/plugins/android/testSrc/org/jetbrains/android/AndroidProjectWizardTest.java @@ -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(); diff --git a/plugins/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java b/plugins/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java index 5c4a91ca9f0a..619f1bb694b9 100644 --- a/plugins/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java +++ b/plugins/android/testSrc/org/jetbrains/android/AndroidSdkTypeTest.java @@ -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); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java index cfba5cdecddd..038474e6510e 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.java @@ -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); } diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy index 86f235e4e0ea..0e12f9a2c8db 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/refactoring/move/GroovyMoveTestBase.groovy @@ -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 filesToDelete = new ArrayList(); VirtualFile rootDir = PsiTestUtil.createTestProjectStructure(myFixture.project, myModule, rootBefore, filesToDelete); def localFileSystem = LocalFileSystem.instance diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java index bd5c2489dc7a..ab77fe477b3c 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java @@ -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 { diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormEnumUsageTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormEnumUsageTest.java index ef91e8cca87f..a57e4d078508 100644 --- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormEnumUsageTest.java +++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormEnumUsageTest.java @@ -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); } diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormPropertyUsageTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormPropertyUsageTest.java index fa8f252d2566..a7d94fd74640 100644 --- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormPropertyUsageTest.java +++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/binding/FormPropertyUsageTest.java @@ -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); } diff --git a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java index f8f70e951126..0d212f65565e 100644 --- a/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java +++ b/plugins/ui-designer/testSrc/com/intellij/uiDesigner/make/FormSourceCodeGeneratorTest.java @@ -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()); }