auto-configure platform prefix in CE tests

This commit is contained in:
Dmitry Jemerov
2010-03-23 21:18:07 +03:00
parent 33e87c6a3d
commit 51bd32edab
2 changed files with 21 additions and 22 deletions
@@ -26,6 +26,12 @@ import org.jetbrains.annotations.NonNls;
* @author mike
*/
@NonNls public abstract class IdeaTestCase extends PlatformTestCase {
private static boolean ourPlatformPrefixInitialized;
protected IdeaTestCase() {
initPlatformPrefix();
}
public final JavaPsiFacadeEx getJavaFacade() {
return JavaPsiFacadeEx.getInstanceEx(myProject);
}
@@ -40,27 +46,19 @@ import org.jetbrains.annotations.NonNls;
return StdModuleTypes.JAVA;
}
//private void cleanTheWorld() throws IllegalAccessException, NoSuchFieldException {
// try {
// ((JobSchedulerImpl)JobScheduler.getInstance()).waitForCompletion();
// }
// catch (Throwable throwable) {
// LOG.error(throwable);
// }
// UIUtil.dispatchAllInvocationEvents();
//
// Thread thread = Thread.currentThread();
// Field locals = Thread.class.getDeclaredField("threadLocals");
// locals.setAccessible(true);
// locals.set(thread, null);
//
// String path = HeapWalker.findObjectUnder(ourApplication, Project.class);
// if (path != null) {
// throw new RuntimeException(getName() + " " + path);
// }
//}
static {
System.setProperty("jbdt.test.fixture", "com.intellij.designer.dt.IJTestFixture");
public static void initPlatformPrefix() {
if (!ourPlatformPrefixInitialized) {
ourPlatformPrefixInitialized = true;
boolean isUltimate = true;
try {
IdeaTestCase.class.getClassLoader().loadClass("com.intellij.idea.IdeaUltimateApplication");
}
catch (ClassNotFoundException e) {
isUltimate = false;
}
if (!isUltimate) {
System.setProperty("idea.platform.prefix", "Idea");
}
}
}
}
@@ -17,6 +17,7 @@
<orderEntry type="module" module-name="lang-impl" exported="" />
<orderEntry type="module" module-name="compiler-impl" />
<orderEntry type="module" module-name="java-impl" />
<orderEntry type="module" module-name="execution-impl" exported="" scope="RUNTIME" />
</component>
<component name="copyright">
<Base>