Search in sources :

Example 1 with ModuleFixtureBuilder

use of com.intellij.testFramework.builders.ModuleFixtureBuilder in project intellij-community by JetBrains.

the class HeavyIdeaTestFixtureImpl method tearDown.

@Override
public void tearDown() throws Exception {
    RunAll runAll = new RunAll().append(() -> LightPlatformTestCase.doTearDown(getProject(), myApplication)).append(() -> {
        for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) {
            moduleFixtureBuilder.getFixture().tearDown();
        }
    }).append(() -> EdtTestUtil.runInEdtAndWait(() -> PlatformTestCase.closeAndDisposeProjectAndCheckThatNoOpenProjects(getProject()))).append(() -> InjectedLanguageManagerImpl.checkInjectorsAreDisposed(getProject())).append(() -> myProject = null);
    for (File fileToDelete : myFilesToDelete) {
        runAll = runAll.append(() -> {
            if (!FileUtil.delete(fileToDelete)) {
                throw new IOException("Can't delete " + fileToDelete);
            }
        });
    }
    runAll.append(super::tearDown).append(() -> myEditorListenerTracker.checkListenersLeak()).append(() -> myThreadTracker.checkLeak()).append(LightPlatformTestCase::checkEditorsReleased).append(// project is disposed by now, no point in passing it
    () -> PlatformTestCase.cleanupApplicationCaches(null)).run();
}
Also used : ModuleFixtureBuilder(com.intellij.testFramework.builders.ModuleFixtureBuilder) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with ModuleFixtureBuilder

use of com.intellij.testFramework.builders.ModuleFixtureBuilder in project intellij-community by JetBrains.

the class HeavyIdeaTestFixtureImpl method setUpProject.

private void setUpProject() throws IOException {
    File tempDirectory = FileUtil.createTempDirectory(myName, "");
    PlatformTestCase.synchronizeTempDirVfs(ObjectUtils.assertNotNull(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory)));
    myFilesToDelete.add(tempDirectory);
    String projectPath = FileUtil.toSystemIndependentName(tempDirectory.getPath()) + "/" + myName + ProjectFileType.DOT_DEFAULT_EXTENSION;
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    new Throwable(projectPath).printStackTrace(new PrintStream(buffer));
    myProject = PlatformTestCase.createProject(projectPath, buffer.toString());
    EdtTestUtil.runInEdtAndWait(() -> {
        ProjectManagerEx.getInstanceEx().openTestProject(myProject);
        for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) {
            moduleFixtureBuilder.getFixture().setUp();
        }
        LightPlatformTestCase.clearUncommittedDocuments(myProject);
        ((FileTypeManagerImpl) FileTypeManager.getInstance()).drainReDetectQueue();
    });
}
Also used : PrintStream(java.io.PrintStream) ModuleFixtureBuilder(com.intellij.testFramework.builders.ModuleFixtureBuilder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) FileTypeManagerImpl(com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ModuleFixtureBuilder (com.intellij.testFramework.builders.ModuleFixtureBuilder)2 File (java.io.File)2 FileTypeManagerImpl (com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 PrintStream (java.io.PrintStream)1