HDDS-2239. Fix TestOzoneFsHAUrls (#1600)

This commit is contained in:
Doroszlai, Attila 2019-10-07 19:17:25 +02:00 committed by Bharat Viswanadham
parent 1a77a15fe4
commit 9685a6c0e5
1 changed files with 36 additions and 33 deletions

View File

@ -91,9 +91,11 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
ClassLoader contextClassLoader = ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader(); Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null); Thread.currentThread().setContextClassLoader(null);
OzoneConfiguration conf = new OzoneConfiguration(); try {
return new OzoneConfiguration();
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader); Thread.currentThread().setContextClassLoader(contextClassLoader);
return conf; }
} }
public BasicOzoneClientAdapterImpl(OzoneConfiguration conf, String volumeStr, public BasicOzoneClientAdapterImpl(OzoneConfiguration conf, String volumeStr,
@ -109,6 +111,8 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
ClassLoader contextClassLoader = ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader(); Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(null); Thread.currentThread().setContextClassLoader(null);
try {
OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf); OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf);
if (omHost == null && OmUtils.isServiceIdsDefined(conf)) { if (omHost == null && OmUtils.isServiceIdsDefined(conf)) {
@ -126,8 +130,8 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
if (OmUtils.isOmHAServiceId(conf, omHost)) { if (OmUtils.isOmHAServiceId(conf, omHost)) {
// If omHost is a service id, it shouldn't use a port // If omHost is a service id, it shouldn't use a port
throw new IllegalArgumentException("Port " + omPort + throw new IllegalArgumentException("Port " + omPort +
" specified in URI but host '" + omHost + "' is " " specified in URI but host '" + omHost + "' is a "
+ "a logical (HA) OzoneManager and does not use port information."); + "logical (HA) OzoneManager and does not use port information.");
} }
} else { } else {
// When port number is not specified, read it from config // When port number is not specified, read it from config
@ -140,7 +144,6 @@ public class BasicOzoneClientAdapterImpl implements OzoneClientAdapter {
this.securityEnabled = true; this.securityEnabled = true;
} }
try {
String replicationTypeConf = String replicationTypeConf =
conf.get(OzoneConfigKeys.OZONE_REPLICATION_TYPE, conf.get(OzoneConfigKeys.OZONE_REPLICATION_TYPE,
OzoneConfigKeys.OZONE_REPLICATION_TYPE_DEFAULT); OzoneConfigKeys.OZONE_REPLICATION_TYPE_DEFAULT);