Remove use of com.google.common.collect.Maps
This commit removes all uses of com.google.common.collect.Maps. This is one of many steps in the eventual removal of Guava as a dependency. Relates elastic/elasticsearchelastic/elasticsearch#13224 Original commit: elastic/x-pack-elasticsearch@3708fc0c60
This commit is contained in:
parent
2ab0db4373
commit
8d5a1bae58
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.shield.transport;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -19,6 +18,7 @@ import org.elasticsearch.transport.*;
|
|||
import org.elasticsearch.transport.netty.NettyTransport;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class ShieldServerTransportService extends TransportService {
|
|||
}
|
||||
|
||||
Map<String, Settings> profileSettingsMap = settings.getGroups("transport.profiles.", true);
|
||||
Map<String, ServerTransportFilter> profileFilters = Maps.newHashMapWithExpectedSize(profileSettingsMap.size() + 1);
|
||||
Map<String, ServerTransportFilter> profileFilters = new HashMap<>(profileSettingsMap.size() + 1);
|
||||
|
||||
for (Map.Entry<String, Settings> entry : profileSettingsMap.entrySet()) {
|
||||
Settings profileSettings = entry.getValue();
|
||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.shield.transport.filter;
|
|||
|
||||
import com.carrotsearch.hppc.ObjectObjectHashMap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.collect.HppcMaps;
|
||||
|
@ -24,7 +23,6 @@ import org.elasticsearch.shield.audit.AuditTrail;
|
|||
import org.elasticsearch.transport.Transport;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
|
||||
public class IPFilter extends AbstractLifecycleComponent<IPFilter> {
|
||||
|
@ -143,7 +141,7 @@ public class IPFilter extends AbstractLifecycleComponent<IPFilter> {
|
|||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
Map<String, ShieldIpFilterRule[]> profileRules = Maps.newHashMap();
|
||||
Map<String, ShieldIpFilterRule[]> profileRules = new HashMap<>();
|
||||
|
||||
if (isHttpFilterEnabled && httpServerTransport != null && httpServerTransport.lifecycleState() == Lifecycle.State.STARTED) {
|
||||
InetAddress localAddress = ((InetSocketTransportAddress) this.httpServerTransport.boundAddress().boundAddress()).address().getAddress();
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.integration;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.elasticsearch.http.HttpServerTransport;
|
||||
|
@ -19,6 +17,7 @@ import org.elasticsearch.test.rest.client.http.HttpResponse;
|
|||
import org.junit.After;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -45,19 +44,19 @@ public abstract class AbstractPrivilegeTestCase extends ShieldIntegTestCase {
|
|||
}
|
||||
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri, String body) throws IOException {
|
||||
assertAccessIsAllowed(user, method, uri, body, Maps.<String,String>newHashMap());
|
||||
assertAccessIsAllowed(user, method, uri, body, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsAllowed(String user, String method, String uri) throws IOException {
|
||||
assertAccessIsAllowed(user, method, uri, null, Maps.<String,String>newHashMap());
|
||||
assertAccessIsAllowed(user, method, uri, null, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri, String body) throws IOException {
|
||||
assertAccessIsDenied(user, method, uri, body, Maps.<String,String>newHashMap());
|
||||
assertAccessIsDenied(user, method, uri, body, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri) throws IOException {
|
||||
assertAccessIsDenied(user, method, uri, null, Maps.<String,String>newHashMap());
|
||||
assertAccessIsDenied(user, method, uri, null, new HashMap<>());
|
||||
}
|
||||
|
||||
protected void assertAccessIsDenied(String user, String method, String uri, String body, Map<String, String> params) throws IOException {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.integration;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
|
@ -13,6 +12,7 @@ import org.elasticsearch.test.rest.client.http.HttpResponse;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -320,7 +320,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase {
|
|||
|
||||
@Test
|
||||
public void testThatUnknownUserIsRejectedProperly() throws Exception {
|
||||
HttpResponse response = executeRequest("idonotexist", "GET", "/", null, Maps.<String,String>newHashMap());
|
||||
HttpResponse response = executeRequest("idonotexist", "GET", "/", null, new HashMap<>());
|
||||
assertThat(response.getStatusCode(), is(401));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue