tests: simple Project.save calls replaced by 'saveProject' calls which really save...
authornik <Nikolay.Chashnikov@jetbrains.com>
Thu, 8 Oct 2015 08:57:14 +0000 (11:57 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Thu, 8 Oct 2015 08:57:46 +0000 (11:57 +0300)
java/compiler/impl/testSrc/com/intellij/compiler/BaseCompilerTestCase.java
java/java-tests/testSrc/com/intellij/execution/BaseConfigurationTestCase.java
java/java-tests/testSrc/com/intellij/psi/search/UpdateCacheTest.java
java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java
java/testFramework/src/com/intellij/testFramework/CompilerTester.java

index bc63355134a6da25020562dc79e32279b427111a..079275f78b83c80951e543ae3b4b0852bfaf895f 100644 (file)
@@ -38,10 +38,7 @@ import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
 import com.intellij.packaging.artifacts.Artifact;
 import com.intellij.packaging.artifacts.ArtifactManager;
 import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
-import com.intellij.testFramework.ModuleTestCase;
-import com.intellij.testFramework.PlatformTestCase;
-import com.intellij.testFramework.PsiTestUtil;
-import com.intellij.testFramework.VfsTestUtil;
+import com.intellij.testFramework.*;
 import com.intellij.util.ParameterizedRunnable;
 import com.intellij.util.concurrency.Semaphore;
 import com.intellij.util.io.TestFileSystemBuilder;
@@ -283,7 +280,7 @@ public abstract class BaseCompilerTestCase extends ModuleTestCase {
             }
           }
         };
-        myProject.save();
+        PlatformTestUtil.saveProject(myProject);
         CompilerTestUtil.saveApplicationSettings();
         action.run(callback);
       }
index b6f79c1fe753b8b9b9de97a4899ef1f6008ce6ee..d4fd51c2cceaf390b4be5fe597ffbcf97498a003 100644 (file)
@@ -39,10 +39,7 @@ import com.intellij.psi.JavaPsiFacade;
 import com.intellij.psi.PsiClass;
 import com.intellij.psi.PsiElement;
 import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.testFramework.IdeaTestCase;
-import com.intellij.testFramework.MapDataContext;
-import com.intellij.testFramework.PsiTestUtil;
-import com.intellij.testFramework.TempFiles;
+import com.intellij.testFramework.*;
 import org.jetbrains.annotations.NotNull;
 
 import java.io.File;
@@ -108,7 +105,7 @@ public abstract class BaseConfigurationTestCase extends IdeaTestCase {
       @Override
       public Module compute() {
         Module result = ModuleManager.getInstance(project).newModule(tempPath, StdModuleTypes.JAVA.getId());
-        project.save();
+        PlatformTestUtil.saveProject(project);
         return result;
       }
     });
index 14830b0a740213e5dc211cf2af79ead8b3f5367a..4c24cef46b6a8087263114d6ed336094ff4294a6 100644 (file)
@@ -39,6 +39,7 @@ import com.intellij.psi.impl.cache.impl.todo.TodoIndexEntry;
 import com.intellij.psi.impl.source.tree.injected.InjectedLanguageManagerImpl;
 import com.intellij.psi.search.searches.ReferencesSearch;
 import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
 import com.intellij.testFramework.PsiTestCase;
 import com.intellij.testFramework.PsiTestUtil;
 import com.intellij.util.ArrayUtil;
@@ -149,7 +150,7 @@ public class UpdateCacheTest extends PsiTestCase {
 
     final String projectLocation = myProject.getPresentableUrl();
     assert projectLocation != null : myProject;
-    myProject.save();
+    PlatformTestUtil.saveProject(myProject);
     final VirtualFile content = ModuleRootManager.getInstance(getModule()).getContentRoots()[0];
     Project project = myProject;
     ProjectUtil.closeAndDispose(project);
index 5b4f69d6a4abea38e8f13bcdc240cba0040f57c9..f5d6f0268b01b43b854c0cd6de7d2c678d2464cc 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.application.WriteAction;
-import com.intellij.openapi.application.ex.ApplicationManagerEx;
 import com.intellij.openapi.components.ComponentsPackage;
 import com.intellij.openapi.fileTypes.FileTypeManager;
 import com.intellij.openapi.module.Module;
@@ -81,7 +80,6 @@ public class CompilerTestUtil {
   }
 
   public static void enableExternalCompiler() {
-    ApplicationManagerEx.getApplicationEx().doNotSave(false);
     final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
     new WriteAction() {
       @Override
@@ -92,35 +90,30 @@ public class CompilerTestUtil {
   }
 
   public static void disableExternalCompiler(@NotNull  final Project project) {
-    try {
-      EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
-        @Override
-        public void run() throws Throwable {
-          JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
-          AccessToken token = WriteAction.start();
-          try {
-            Sdk internalJdk = table.getInternalJdk();
-            List<Module> modulesToRestore = new SmartList<Module>();
-            for (Module module : ModuleManager.getInstance(project).getModules()) {
-              Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
-              if (sdk != null && sdk.equals(internalJdk)) {
-                modulesToRestore.add(module);
-              }
-            }
-            table.removeJdk(internalJdk);
-            for (Module module : modulesToRestore) {
-              ModuleRootModificationUtil.setModuleSdk(module, internalJdk);
+    EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
+      @Override
+      public void run() throws Throwable {
+        JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
+        AccessToken token = WriteAction.start();
+        try {
+          Sdk internalJdk = table.getInternalJdk();
+          List<Module> modulesToRestore = new SmartList<Module>();
+          for (Module module : ModuleManager.getInstance(project).getModules()) {
+            Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
+            if (sdk != null && sdk.equals(internalJdk)) {
+              modulesToRestore.add(module);
             }
-            BuildManager.getInstance().clearState(project);
           }
-          finally {
-            token.finish();
+          table.removeJdk(internalJdk);
+          for (Module module : modulesToRestore) {
+            ModuleRootModificationUtil.setModuleSdk(module, internalJdk);
           }
+          BuildManager.getInstance().clearState(project);
+        }
+        finally {
+          token.finish();
         }
-      });
-    }
-    finally {
-      ApplicationManagerEx.getApplicationEx().doNotSave(true);
-    }
+      }
+    });
   }
 }
index c6cdc0fe3c49955ab4a391dec7ce1391b7991a0f..739ea68802a05fdaca505e157587cfcf1e3fbf6d 100644 (file)
@@ -207,7 +207,7 @@ public class CompilerTester {
     EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
       @Override
       public void run() throws Throwable {
-        getProject().save();
+        PlatformTestUtil.saveProject(getProject());
         CompilerTestUtil.saveApplicationSettings();
         for (Module module : myModules) {
           File ioFile = new File(module.getModuleFilePath());