From 3543d7874becfcd1c2ed63034a145d9cd2b68af8 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 30 Jun 2015 00:56:26 -0400 Subject: [PATCH] don't depend on ant tasks in tests Original commit: elastic/x-pack-elasticsearch@ebbc490a2e0e0ae8c77681b0cac8ae9a8edf7264 --- .../integration/AbstractPrivilegeTests.java | 11 ++++++----- .../integration/IndexPrivilegeTests.java | 4 ++-- .../shield/authc/support/SecuredStringTests.java | 5 +++-- .../ServerTransportFilterIntegrationTests.java | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTests.java b/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTests.java index 2bf624c9259..79b32ba70b1 100644 --- a/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTests.java +++ b/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTests.java @@ -5,7 +5,8 @@ */ package org.elasticsearch.integration; -import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.Maps; +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; @@ -44,19 +45,19 @@ public abstract class AbstractPrivilegeTests extends ShieldIntegrationTest { } protected void assertAccessIsAllowed(String user, String method, String uri, String body) throws IOException { - assertAccessIsAllowed(user, method, uri, body, Maps.newHashMap()); + assertAccessIsAllowed(user, method, uri, body, Maps.newHashMap()); } protected void assertAccessIsAllowed(String user, String method, String uri) throws IOException { - assertAccessIsAllowed(user, method, uri, null, Maps.newHashMap()); + assertAccessIsAllowed(user, method, uri, null, Maps.newHashMap()); } protected void assertAccessIsDenied(String user, String method, String uri, String body) throws IOException { - assertAccessIsDenied(user, method, uri, body, Maps.newHashMap()); + assertAccessIsDenied(user, method, uri, body, Maps.newHashMap()); } protected void assertAccessIsDenied(String user, String method, String uri) throws IOException { - assertAccessIsDenied(user, method, uri, null, Maps.newHashMap()); + assertAccessIsDenied(user, method, uri, null, Maps.newHashMap()); } protected void assertAccessIsDenied(String user, String method, String uri, String body, Map params) throws IOException { diff --git a/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java b/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java index 69538b6b8b4..d16af6a9eb7 100644 --- a/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java +++ b/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java @@ -5,7 +5,7 @@ */ package org.elasticsearch.integration; -import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.Maps; +import com.google.common.collect.Maps; import com.google.common.collect.ImmutableMap; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; @@ -320,7 +320,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTests { @Test public void testThatUnknownUserIsRejectedProperly() throws Exception { - HttpResponse response = executeRequest("idonotexist", "GET", "/", null, Maps.newHashMap()); + HttpResponse response = executeRequest("idonotexist", "GET", "/", null, Maps.newHashMap()); assertThat(response.getStatusCode(), is(401)); } diff --git a/src/test/java/org/elasticsearch/shield/authc/support/SecuredStringTests.java b/src/test/java/org/elasticsearch/shield/authc/support/SecuredStringTests.java index 5417a93f4b9..00939748cc0 100644 --- a/src/test/java/org/elasticsearch/shield/authc/support/SecuredStringTests.java +++ b/src/test/java/org/elasticsearch/shield/authc/support/SecuredStringTests.java @@ -5,10 +5,11 @@ */ package org.elasticsearch.shield.authc.support; -import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.base.Charsets; import org.elasticsearch.test.ElasticsearchTestCase; import org.junit.Test; +import java.nio.charset.StandardCharsets; + import static org.hamcrest.Matchers.*; public class SecuredStringTests extends ElasticsearchTestCase { @@ -91,7 +92,7 @@ public class SecuredStringTests extends ElasticsearchTestCase { String password = "эластичный поиск-弾性検索"; SecuredString securePass = new SecuredString(password.toCharArray()); byte[] utf8 = securePass.utf8Bytes(); - String password2 = new String(utf8, Charsets.UTF_8); + String password2 = new String(utf8, StandardCharsets.UTF_8); assertThat(password2, equalTo(password)); } diff --git a/src/test/java/org/elasticsearch/shield/transport/ServerTransportFilterIntegrationTests.java b/src/test/java/org/elasticsearch/shield/transport/ServerTransportFilterIntegrationTests.java index 34543072666..ed44c9c0b56 100644 --- a/src/test/java/org/elasticsearch/shield/transport/ServerTransportFilterIntegrationTests.java +++ b/src/test/java/org/elasticsearch/shield/transport/ServerTransportFilterIntegrationTests.java @@ -5,7 +5,8 @@ */ package org.elasticsearch.shield.transport; -import com.carrotsearch.ant.tasks.junit4.dependencies.com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap; + import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.TransportAddress;