com.intellij.testFramework.ThreadTracker Java Examples

The following examples show how to use com.intellij.testFramework.ThreadTracker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PantsIntegrationTestCase.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void tearDown() throws Exception {
  // TODO thread leak either a IJ bug https://youtrack.jetbrains.com/issue/IDEA-155496
  // or a pants plugin bug https://github.com/pantsbuild/intellij-pants-plugin/issues/130
  // Temporarily ignore the following 'leaking' threads to pass CI.
  ThreadTracker.longRunningThreadCreated(
    ApplicationManager.getApplication(),
    "BaseDataReader",
    "ProcessWaitFor",
    "Timer",
    "FileBasedIndex"
  );
  if (myCompilerTester != null) {
    myCompilerTester.tearDown();
  }

  // Kill nailgun after usage as memory on travis is limited, at a cost of slower later builds.
  killNailgun();
  cleanProjectRoot();
  Messages.setTestDialog(TestDialog.DEFAULT);

  // TODO(cosmicexplorer): after updating from 172.4343.14 to 173.3531.6,
  // intellij's provided test class sometimes yells about a leaky jdk
  // table. i don't think this indicates any problems, so for now if tests
  // fail with leaky sdk errors, broaden this to include the leaked sdks.
  removeJdks(jdk -> jdk.getName().contains("pants"));
  super.tearDown();
}
 
Example #2
Source File: HeavyIdeaTestFixtureImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void setUp() throws Exception {
  super.setUp();

  initApplication();
  setUpProject();

  EncodingManager.getInstance(); // adds listeners
  myEditorListenerTracker = new EditorListenerTracker();
  myThreadTracker = new ThreadTracker();
  InjectedLanguageManagerImpl.pushInjectors(getProject());
}
 
Example #3
Source File: DartTestUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@SuppressWarnings("Duplicates")
public static void configureDartSdk(@NotNull final Module module, @NotNull final Disposable disposable, final boolean realSdk) {
  final String sdkHome;
  if (realSdk) {
    sdkHome = System.getProperty("dart.sdk");
    if (sdkHome == null) {
      Assert.fail("To run tests that use Dart Analysis Server you need to add '-Ddart.sdk=[real SDK home]' to the VM Options field of " +
                  "the corresponding JUnit run configuration (Run | Edit Configurations)");
    }
    if (!DartPlugin.isDartSdkHome(sdkHome)) {
      Assert.fail("Incorrect path to the Dart SDK (" + sdkHome + ") is set as '-Ddart.sdk' VM option of " +
                  "the corresponding JUnit run configuration (Run | Edit Configurations)");
    }
    VfsRootAccess.allowRootAccess(disposable, sdkHome);
    // Dart Analysis Server threads
    ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(),
                                           "ByteRequestSink.LinesWriterThread",
                                           "ByteResponseStream.LinesReaderThread",
                                           "RemoteAnalysisServerImpl watcher",
                                           "ServerErrorReaderThread",
                                           "ServerResponseReaderThread");
  }
  else {
    sdkHome = SDK_HOME_PATH;
  }

  ApplicationManager.getApplication().runWriteAction(() -> {
    DartPlugin.ensureDartSdkConfigured(module.getProject(), sdkHome);
    DartPlugin.enableDartSdk(module);
  });

  Disposer.register(disposable, () -> ApplicationManager.getApplication().runWriteAction(() -> {
    if (!module.isDisposed()) {
      DartPlugin.disableDartSdk(Collections.singletonList(module));
    }

    final ApplicationLibraryTable libraryTable = ApplicationLibraryTable.getApplicationTable();
    final Library library = libraryTable.getLibraryByName(DartSdk.DART_SDK_LIB_NAME);
    if (library != null) {
      libraryTable.removeLibrary(library);
    }
  }));
}
 
Example #4
Source File: DartTestUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@SuppressWarnings("Duplicates")
public static void configureDartSdk(@NotNull final Module module, @NotNull final Disposable disposable, final boolean realSdk) {
  final String sdkHome;
  if (realSdk) {
    sdkHome = System.getProperty("dart.sdk");
    if (sdkHome == null) {
      Assert.fail("To run tests that use Dart Analysis Server you need to add '-Ddart.sdk=[real SDK home]' to the VM Options field of " +
                  "the corresponding JUnit run configuration (Run | Edit Configurations)");
    }
    if (!DartPlugin.isDartSdkHome(sdkHome)) {
      Assert.fail("Incorrect path to the Dart SDK (" + sdkHome + ") is set as '-Ddart.sdk' VM option of " +
                  "the corresponding JUnit run configuration (Run | Edit Configurations)");
    }
    VfsRootAccess.allowRootAccess(disposable, sdkHome);
    // Dart Analysis Server threads
    ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(),
                                           "ByteRequestSink.LinesWriterThread",
                                           "ByteResponseStream.LinesReaderThread",
                                           "RemoteAnalysisServerImpl watcher",
                                           "ServerErrorReaderThread",
                                           "ServerResponseReaderThread");
  }
  else {
    sdkHome = SDK_HOME_PATH;
  }

  ApplicationManager.getApplication().runWriteAction(() -> {
    DartPlugin.ensureDartSdkConfigured(module.getProject(), sdkHome);
    DartPlugin.enableDartSdk(module);
  });

  Disposer.register(disposable, () -> ApplicationManager.getApplication().runWriteAction(() -> {
    if (!module.isDisposed()) {
      DartPlugin.disableDartSdk(Collections.singletonList(module));
    }

    final ApplicationLibraryTable libraryTable = ApplicationLibraryTable.getApplicationTable();
    final Library library = libraryTable.getLibraryByName(DartSdk.DART_SDK_LIB_NAME);
    if (library != null) {
      libraryTable.removeLibrary(library);
    }
  }));
}