Replace rest test client with low level RestClient
We still have a wrapper called RestTestClient that is very specific to Rest tests, as well as RestTestResponse etc. but all the low level bits around http connections etc. are now handled by RestClient. Original commit: elastic/x-pack-elasticsearch@304487ecc5
This commit is contained in:
parent
f58f347fe1
commit
e882fb3a18
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
|
|||
import org.elasticsearch.shield.authc.support.SecuredString;
|
||||
import org.elasticsearch.test.rest.ESRestTestCase;
|
||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||
import org.elasticsearch.test.rest.client.RestClient;
|
||||
import org.elasticsearch.test.rest.client.RestTestClient;
|
||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -65,9 +65,9 @@ public class SmokeTestPluginsSslIT extends ESRestTestCase {
|
|||
String token = basicAuthHeaderValue(USER, new SecuredString(PASS.toCharArray()));
|
||||
return Settings.builder()
|
||||
.put(ThreadContext.PREFIX + ".Authorization", token)
|
||||
.put(RestClient.PROTOCOL, "https")
|
||||
.put(RestClient.TRUSTSTORE_PATH, keyStore)
|
||||
.put(RestClient.TRUSTSTORE_PASSWORD, KEYSTORE_PASS)
|
||||
.put(RestTestClient.PROTOCOL, "https")
|
||||
.put(RestTestClient.TRUSTSTORE_PATH, keyStore)
|
||||
.put(RestTestClient.TRUSTSTORE_PASSWORD, KEYSTORE_PASS)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,15 +5,6 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.test.rest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
@ -40,9 +31,19 @@ import org.elasticsearch.test.rest.parser.RestTestParseException;
|
|||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.shield.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
|
||||
public abstract class XPackRestTestCase extends ESRestTestCase {
|
||||
|
||||
private static final String BASIC_AUTH_VALUE = basicAuthHeaderValue("test_user", new SecuredString("changeme".toCharArray()));
|
||||
|
@ -101,6 +102,7 @@ public abstract class XPackRestTestCase extends ESRestTestCase {
|
|||
|
||||
@After
|
||||
public void clearShieldUsersAndRoles() throws Exception {
|
||||
//TODO change this to use RestClient, also look for usages of HttpClient directly
|
||||
// we cannot delete the .security index from a rest test since we aren't the internal user, lets wipe the data
|
||||
// TODO remove this once the built-in SUPERUSER role is added that can delete the index and we use the built in admin user here
|
||||
try (CloseableHttpClient client = HttpClients.createMinimal(new BasicHttpClientConnectionManager())) {
|
||||
|
|
Loading…
Reference in New Issue