diff --git a/plugin/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java b/plugin/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java index 7cb9f80d8ad..b612920d0c5 100644 --- a/plugin/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java +++ b/plugin/src/test/java/org/elasticsearch/test/SecuritySettingsSource.java @@ -9,6 +9,7 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.analysis.common.CommonAnalysisPlugin; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.PathUtils; +import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.SecureSettings; import org.elasticsearch.common.settings.SecureString; @@ -138,8 +139,13 @@ public class SecuritySettingsSource extends ClusterDiscoveryConfiguration.Unicas @Override public Settings transportClientSettings() { - Settings.Builder builder = Settings.builder().put(super.transportClientSettings()); + Settings superSettings = super.transportClientSettings(); + Settings.Builder builder = Settings.builder().put(superSettings); addClientSSLSettings(builder, ""); + if (NetworkModule.TRANSPORT_TYPE_SETTING.exists(superSettings) == false) { + builder.put(NetworkModule.TRANSPORT_TYPE_SETTING.getKey(), Security.NAME4); + } + if (randomBoolean()) { builder.put(Security.USER_SETTING.getKey(), transportClientUsername() + ":" + new String(transportClientPassword().getChars())); diff --git a/plugin/src/test/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateActionTests.java b/plugin/src/test/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateActionTests.java index c58a2e1d700..e63227e3ee9 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateActionTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateActionTests.java @@ -56,7 +56,7 @@ public class RestAuthenticateActionTests extends SecurityIntegTestCase { ObjectPath objectPath = ObjectPath.createFromResponse(response); assertThat(objectPath.evaluate("username").toString(), equalTo(SecuritySettingsSource.TEST_USER_NAME)); @SuppressWarnings("unchecked") - List roles = (List) objectPath.evaluate("roles"); + List roles = objectPath.evaluate("roles"); assertThat(roles.size(), is(1)); assertThat(roles, contains(SecuritySettingsSource.TEST_ROLE)); }