[jboss-cvs] JBossAS SVN: r107381 - projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/proxy.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Aug 4 08:45:33 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-08-04 08:45:33 -0400 (Wed, 04 Aug 2010)
New Revision: 107381
Modified:
projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java
Log:
Fix tests on OS X
Modified: projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java
===================================================================
--- projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java 2010-08-04 11:34:35 UTC (rev 107380)
+++ projects/aop/trunk/aop/src/test/java/org/jboss/test/aop/proxy/OutOfProcessProxyFileCreator.java 2010-08-04 12:45:33 UTC (rev 107381)
@@ -26,6 +26,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
@@ -52,9 +54,15 @@
{
Properties props = System.getProperties();
+ for (Iterator<Map.Entry<Object, Object>> it = props.entrySet().iterator() ; it.hasNext() ; )
+ {
+ Map.Entry<Object, Object> item = it.next();
+ System.out.println(item.getKey() + " : " + item.getValue());
+ }
+
String classPath = props.getProperty("java.class.path");
- String libraryPath = props.getProperty("sun.boot.library.path") + File.separator + "java";
- String java = findJava(libraryPath);
+ String binDir = props.getProperty("java.home") + File.separator + "bin";
+ String java = getJavaPath(binDir);
File proxyFile = File.createTempFile("proxy", "err");
proxyFile.deleteOnExit();
@@ -140,71 +148,22 @@
}
return sb.toString();
}
-
- private String findJava(String classPath)
- {
- String java = null;
- StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
- while (tok.hasMoreTokens())
- {
- String path = tok.nextToken();
- if (path.endsWith(".jar"))
- {
- continue;
- }
- java = getJavaPath(path);
- if (java != null)
- {
- return java;
- }
- }
- return null;
- }
-
private String getJavaPath(String dirName)
{
if (File.separatorChar == '/')
{
//Probably on Linux
- if (dirName.contains("jre"))
- {
- dirName = dirName.substring(0, dirName.indexOf(File.separatorChar + "jre"));
- }
- String file = getFile(dirName + File.separator + "bin" + File.separator + "java");
- if (file != null)
- {
- return file;
- }
- file = getFile(dirName);
- if (file != null)
- {
- return file;
- }
+ return getFile(dirName + File.separator + "java");
}
else if (File.separatorChar == '\\')
{
//We're probably on windows
- String file = getFile(dirName + File.separator + "java.exe");
- if (file != null)
- {
- return file;
- }
- file = getFile(dirName);
- if (file != null)
- {
- return file;
- }
- file = getFile(dirName + ".exe");
- if (file != null)
- {
- return file;
- }
+ return getFile(dirName + File.separator + "java.exe");
}
else
{
throw new RuntimeException("Cannot figure out OS");
}
- return null;
}
private String getFile(String java)
More information about the jboss-cvs-commits
mailing list