use of com.intellij.ide.startup.impl.StartupManagerImpl in project intellij-community by JetBrains.
the class DaemonAnalyzerTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final LocalInspectionTool[] tools = configureLocalInspectionTools();
InspectionsKt.configureInspections(tools, getProject(), getTestRootDisposable());
DaemonCodeAnalyzerImpl daemonCodeAnalyzer = (DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(getProject());
daemonCodeAnalyzer.prepareForTest();
final StartupManagerImpl startupManager = (StartupManagerImpl) StartupManagerEx.getInstanceEx(getProject());
startupManager.runStartupActivities();
startupManager.startCacheUpdate();
startupManager.runPostStartupActivities();
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(false);
if (isStressTest()) {
// hack to avoid slowdowns in PyExtensionFactory
IntentionManager.getInstance().getAvailableIntentionActions();
// to cache stuff
PathManagerEx.getTestDataPath();
// pre-load tons of classes
ReferenceProvidersRegistry.getInstance();
// zillion of Dom Sem classes
InjectedLanguageManager.getInstance(getProject());
// pile of annotator classes loads
LanguageAnnotators.INSTANCE.allForLanguage(JavaLanguage.INSTANCE);
LanguageAnnotators.INSTANCE.allForLanguage(StdLanguages.XML);
ProblemHighlightFilter.EP_NAME.getExtensions();
Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
Extensions.getExtensions(XmlSchemaProvider.EP_NAME);
Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME);
Extensions.getExtensions(IndexPatternBuilder.EP_NAME);
}
}
use of com.intellij.ide.startup.impl.StartupManagerImpl in project intellij-community by JetBrains.
the class DaemonAnalyzerTestCase method tearDown.
@Override
protected void tearDown() throws Exception {
try {
// return default value to avoid unnecessary save
DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true);
final Project project = getProject();
if (project != null) {
((StartupManagerImpl) StartupManager.getInstance(project)).checkCleared();
((DaemonCodeAnalyzerImpl) DaemonCodeAnalyzer.getInstance(project)).cleanupAfterTest();
}
} finally {
super.tearDown();
}
//((VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance()).assertPointersDisposed();
}
use of com.intellij.ide.startup.impl.StartupManagerImpl in project kotlin by JetBrains.
the class KotlinAndroidTestCase method setUp.
@Override
protected void setUp() throws Exception {
// sdk path workaround, set real android sdk path and platform for android plugin to work
System.setProperty(KotlinAndroidTestCaseBase.SDK_PATH_PROPERTY, PathManager.getHomePath() + "/../dependencies/androidSDK");
System.setProperty(KotlinAndroidTestCaseBase.PLATFORM_DIR_PROPERTY, "android-23");
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory());
super.setUp();
// this will throw an exception if we don't have a full Android SDK, so we need to do this first thing before any other setup
String sdkPath = getTestSdkPath();
final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());
final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);
final String dirPath = myFixture.getTempDirPath() + getContentRootPath();
final File dir = new File(dirPath);
if (!dir.exists()) {
assertTrue(dir.mkdirs());
}
tuneModule(moduleFixtureBuilder, dirPath);
final List<MyAdditionalModuleData> modules = new ArrayList<MyAdditionalModuleData>();
configureAdditionalModules(projectBuilder, modules);
myFixture.setUp();
myFixture.setTestDataPath(getTestDataPath());
myModule = moduleFixtureBuilder.getFixture().getModule();
// Must be done before addAndroidFacet, and must always be done, even if !myCreateManifest.
// We will delete it at the end of setUp; this is needed when unit tests want to rewrite
// the manifest on their own.
createManifest();
androidSdk = createAndroidSdk(getTestSdkPath(), getPlatformDir());
myFacet = addAndroidFacet(myModule, sdkPath, getPlatformDir(), isToAddSdk());
for (File resDir : getResourceDirs(dirPath)) {
if (resDir.exists()) {
myFixture.copyDirectoryToProject(resDir.getName(), resDir.getName());
} else {
Logger.getInstance(this.getClass()).info("No res directory found in test");
}
}
myAdditionalModules = new ArrayList<Module>();
for (MyAdditionalModuleData data : modules) {
final Module additionalModule = data.myModuleFixtureBuilder.getFixture().getModule();
myAdditionalModules.add(additionalModule);
final AndroidFacet facet = addAndroidFacet(additionalModule, sdkPath, getPlatformDir());
facet.setLibraryProject(data.myLibrary);
final String rootPath = getContentRootPath(data.myDirName);
myFixture.copyDirectoryToProject("res", rootPath + "/res");
myFixture.copyFileToProject(SdkConstants.FN_ANDROID_MANIFEST_XML, rootPath + '/' + SdkConstants.FN_ANDROID_MANIFEST_XML);
ModuleRootModificationUtil.addDependency(myModule, additionalModule);
}
if (!myCreateManifest) {
deleteManifest();
}
if (RenderSecurityManager.RESTRICT_READS) {
// Unit test class loader includes disk directories which security manager does not allow access to
RenderSecurityManager.sEnabled = false;
}
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
kotlinInternalModeOriginalValue = KotlinInternalMode.Instance.getEnabled();
KotlinInternalMode.Instance.setEnabled(true);
}
Aggregations