mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (common code)
This commit is contained in:
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.intellij.lang.annotations.MagicConstant;
|
||||
@@ -288,7 +289,7 @@ public class GeneralCommandLineTest {
|
||||
assertNotNull(url);
|
||||
|
||||
GeneralCommandLine commandLine = createCommandLine();
|
||||
commandLine.setExePath(System.getProperty("java.home") + (SystemInfo.isWindows ? "\\bin\\java.exe" : "/bin/java"));
|
||||
commandLine.setExePath(PlatformTestUtil.getJavaExe());
|
||||
|
||||
String encoding = System.getProperty("file.encoding");
|
||||
if (encoding != null) {
|
||||
|
||||
+2
-4
@@ -16,8 +16,8 @@
|
||||
package com.intellij.execution.process;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.util.io.BaseOutputReader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
@@ -49,15 +49,13 @@ public class BinaryOSProcessHandlerTest {
|
||||
}
|
||||
|
||||
private static Process launchTest() throws URISyntaxException, IOException {
|
||||
String java = System.getProperty("java.home") + (SystemInfo.isWindows ? "\\bin\\java.exe" : "/bin/java");
|
||||
|
||||
String className = Runner.class.getName();
|
||||
URL url = Runner.class.getClassLoader().getResource(className.replace('.', '/') + ".class");
|
||||
assertNotNull(url);
|
||||
File dir = new File(url.toURI());
|
||||
for (int i = 0; i < StringUtil.countChars(className, '.') + 1; i++) dir = dir.getParentFile();
|
||||
|
||||
String[] cmd = {java, "-cp", dir.getPath(), className};
|
||||
String[] cmd = {PlatformTestUtil.getJavaExe(), "-cp", dir.getPath(), className};
|
||||
return new ProcessBuilder(cmd).redirectErrorStream(false).start();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -140,7 +141,7 @@ public class JarFileSystemTest extends BareTestFixtureTestCase {
|
||||
VirtualFile entryRoot = JarFileSystem.getInstance().getJarRootForLocalFile(entryFile);
|
||||
assertNull(entryRoot);
|
||||
|
||||
VirtualFile nonJarFile = LocalFileSystem.getInstance().findFileByPath(System.getProperty("java.home") + "/lib/calendars.properties");
|
||||
VirtualFile nonJarFile = LocalFileSystem.getInstance().findFileByPath(SystemProperties.getJavaHome() + "/lib/calendars.properties");
|
||||
assertNotNull(nonJarFile);
|
||||
VirtualFile nonJarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(nonJarFile);
|
||||
assertNull(nonJarRoot);
|
||||
|
||||
@@ -319,6 +319,7 @@ public class PlatformTestUtil {
|
||||
public static void dispatchAllEventsInIdeEventQueue() throws InterruptedException {
|
||||
assert SwingUtilities.isEventDispatchThread() : Thread.currentThread();
|
||||
final IdeEventQueue eventQueue = (IdeEventQueue)Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
//noinspection StatementWithEmptyBody
|
||||
while (dispatchNextEventIfAny(eventQueue) != null);
|
||||
}
|
||||
|
||||
@@ -506,9 +507,14 @@ public class PlatformTestUtil {
|
||||
Assert.assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getJavaExe() {
|
||||
return SystemProperties.getJavaHome() + (SystemInfo.isWindows ? "\\bin\\java.exe" : "/bin/java");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getRtJarPath() {
|
||||
String home = System.getProperty("java.home");
|
||||
String home = SystemProperties.getJavaHome();
|
||||
return SystemInfo.isAppleJvm ? FileUtil.toCanonicalPath(home + "/../Classes/classes.jar") : home + "/lib/rt.jar";
|
||||
}
|
||||
|
||||
@@ -970,5 +976,4 @@ public class PlatformTestUtil {
|
||||
}
|
||||
ourProjectCleanups.clear();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user