diff --git a/system_test/migration_tool_testsuite/cluster_config.json b/system_test/migration_tool_testsuite/cluster_config.json index 8353e56..cd7f079 100644 --- a/system_test/migration_tool_testsuite/cluster_config.json +++ b/system_test/migration_tool_testsuite/cluster_config.json @@ -69,7 +69,7 @@ "role": "producer_performance", "cluster_name":"source", "kafka_home": "system_test/migration_tool_testsuite/0.7", - "java_home": "/export/apps/jdk/JDK-1_6_0_27", + "java_home": "default", "jmx_port": "9997" }, { diff --git a/system_test/utils/system_test_utils.py b/system_test/utils/system_test_utils.py index 50340f0..e8529cd 100644 --- a/system_test/utils/system_test_utils.py +++ b/system_test/utils/system_test_utils.py @@ -360,19 +360,23 @@ def setup_remote_hosts(systemTestEnv): clusterEntityConfigDictList = systemTestEnv.clusterEntityConfigDictList localKafkaHome = os.path.abspath(systemTestEnv.SYSTEM_TEST_BASE_DIR + "/..") - localJavaBin = "" - localJavaHome = "" - subproc = sys_call_return_subproc("which java") - for line in subproc.stdout.readlines(): - if line.startswith("which: no "): - logger.error("No Java binary found in local host", extra=d) - return False - else: - line = line.rstrip('\n') - localJavaBin = line - matchObj = re.match("(.*)\/bin\/java$", line) - localJavaHome = matchObj.group(1) + # when configuring "default" java_home, use JAVA_HOME environment variable, if exists + # otherwise, use the directory with the java binary + localJavaHome = os.environ.get('JAVA_HOME') + if localJavaHome is not None: + localJavaBin = localJavaHome + '/bin/java' + else: + subproc = sys_call_return_subproc("which java") + for line in subproc.stdout.readlines(): + if line.startswith("which: no "): + logger.error("No Java binary found in local host", extra=d) + return False + else: + line = line.rstrip('\n') + localJavaBin = line + matchObj = re.match("(.*)\/bin\/java$", line) + localJavaHome = matchObj.group(1) listIndex = -1 for clusterEntityConfigDict in clusterEntityConfigDictList: