@Override protected void setUp() throws Exception { EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() { @Override public void run() throws Exception { LightPlatformTestCase.super.setUp(); initApplication(); ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest()); ourApplication.setDataProvider(LightPlatformTestCase.this); LightProjectDescriptor descriptor = new SimpleLightProjectDescriptor(getModuleType(), getProjectJDK()); doSetup(descriptor, configureLocalInspectionTools(), getTestRootDisposable()); InjectedLanguageManagerImpl.pushInjectors(getProject()); storeSettings(); myThreadTracker = new ThreadTracker(); ModuleRootManager.getInstance(ourModule).orderEntries().getAllLibrariesAndSdkClassesRoots(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); } }); }
@Override protected void tearDown() throws Exception { Project project = getProject(); CodeStyleSettingsManager.getInstance(project).dropTemporarySettings(); checkForSettingsDamage(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); doTearDown(project, ourApplication, true); try { super.tearDown(); } finally { myThreadTracker.checkLeak(); InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project); filePointerManager.assertPointersAreDisposed(); } }
@Override @RequiredDispatchThread protected void setUp() throws Exception { super.setUp(); initApplication(); //ourApplication.setDataProvider(this); doSetup(createTestModuleDescriptor(), configureLocalInspectionTools(), myAvailableInspectionTools); InjectedLanguageManagerImpl.pushInjectors(getProject()); storeSettings(); myThreadTracker = new ThreadTracker(); ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest()); ModuleRootManager.getInstance(ourModule).orderEntries().getAllLibrariesAndSdkClassesRoots(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }
@Override protected void setUp() throws Exception { super.setUp(); myJavaFacade = JavaPsiFacadeEx.getInstanceEx(myProject); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }
@Override protected void tearDown() throws Exception { myJavaFacade = null; super.tearDown(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.assertPointersAreDisposed(); }
@Override protected void setUp() throws Exception { super.setUp(); initApplication(); ourApplication.setDataProvider(this); doSetup(new SimpleLightProjectDescriptor(getModuleType(), getProjectJDK()), configureLocalInspectionTools(), myAvailableInspectionTools); InjectedLanguageManagerImpl.pushInjectors(getProject()); storeSettings(); myThreadTracker = new ThreadTracker(); ModuleRootManager.getInstance(ourModule).orderEntries().getAllLibrariesAndSdkClassesRoots(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }
@Override protected void tearDown() throws Exception { //myJavaFacade = null; super.tearDown(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.assertPointersAreDisposed(); }
private static void initProject(@NotNull final LightProjectDescriptor descriptor) throws Exception { ourProjectDescriptor = descriptor; AccessToken token = WriteAction.start(); try { if (ourProject != null) { closeAndDeleteProject(); } else { cleanPersistedVFSContent(); } } finally { token.finish(); } final File projectFile = FileUtil.createTempFile("light_temp_", ProjectFileType.DOT_DEFAULT_EXTENSION); LocalFileSystem.getInstance().refreshAndFindFileByIoFile(projectFile); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); new Throwable(projectFile.getPath()).printStackTrace(new PrintStream(buffer)); ourProject = PlatformTestCase.createProject(projectFile, LIGHT_PROJECT_MARK + buffer); ourPathToKeep = projectFile.getPath(); if (!ourHaveShutdownHook) { ourHaveShutdownHook = true; registerShutdownHook(); } ourPsiManager = null; ourProjectDescriptor.setUpProject(ourProject, new LightProjectDescriptor.SetupHandler() { @Override public void moduleCreated(@NotNull Module module) { //noinspection AssignmentToStaticFieldFromInstanceMethod ourModule = module; } @Override public void sourceRootCreated(@NotNull VirtualFile sourceRoot) { //noinspection AssignmentToStaticFieldFromInstanceMethod ourSourceRoot = sourceRoot; } }); // project creation may make a lot of pointers, do not regard them as leak ((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).storePointers(); }
@Override protected void setUp() throws Exception { super.setUp(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }