Drop mocksocket & securemock dependencies from sniffer and rest client (no needed) (#1174)

* Drop mocksocket & securemock dependencies from sniffer and rest client (not needed)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>

* Removing .gitignore

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
This commit is contained in:
Andriy Redko 2021-08-31 14:18:37 -04:00 committed by GitHub
parent a43e6cf424
commit f60d093c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 11 additions and 14 deletions

View File

@ -38,6 +38,8 @@ commonscodec = 1.13
hamcrest = 2.1 hamcrest = 2.1
securemock = 1.2 securemock = 1.2
mocksocket = 1.2 mocksocket = 1.2
mockito = 1.9.5
objenesis = 1.0
# benchmark dependencies # benchmark dependencies
jmh = 1.19 jmh = 1.19

View File

@ -51,8 +51,8 @@ dependencies {
testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testImplementation "junit:junit:${versions.junit}" testImplementation "junit:junit:${versions.junit}"
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
testImplementation "org.elasticsearch:securemock:${versions.securemock}" testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation "org.elasticsearch:mocksocket:${versions.mocksocket}" testImplementation "org.objenesis:objenesis:${versions.objenesis}"
} }
tasks.withType(CheckForbiddenApis).configureEach { tasks.withType(CheckForbiddenApis).configureEach {

View File

@ -37,7 +37,6 @@ import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsConfigurator;
import com.sun.net.httpserver.HttpsServer; import com.sun.net.httpserver.HttpsServer;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -73,7 +72,7 @@ public class RestClientBuilderIntegTests extends RestClientTestCase {
@BeforeClass @BeforeClass
public static void startHttpServer() throws Exception { public static void startHttpServer() throws Exception {
httpsServer = MockHttpServer.createHttps(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); httpsServer = HttpsServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
httpsServer.setHttpsConfigurator(new HttpsConfigurator(getSslContext())); httpsServer.setHttpsConfigurator(new HttpsConfigurator(getSslContext()));
httpsServer.createContext("/", new ResponseHandler()); httpsServer.createContext("/", new ResponseHandler());
httpsServer.start(); httpsServer.start();

View File

@ -39,7 +39,6 @@ import org.apache.http.HttpEntity;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity; import org.apache.http.entity.StringEntity;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -61,7 +60,7 @@ public class RestClientGzipCompressionTests extends RestClientTestCase {
@BeforeClass @BeforeClass
public static void startHttpServer() throws Exception { public static void startHttpServer() throws Exception {
httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
httpServer.createContext("/", new GzipResponseHandler()); httpServer.createContext("/", new GzipResponseHandler());
httpServer.start(); httpServer.start();
} }

View File

@ -36,7 +36,6 @@ import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpServer;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -107,7 +106,7 @@ public class RestClientMultipleHostsIntegTests extends RestClientTestCase {
} }
private static HttpServer createHttpServer() throws Exception { private static HttpServer createHttpServer() throws Exception {
HttpServer httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); HttpServer httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
httpServer.start(); httpServer.start();
//returns a different status code depending on the path //returns a different status code depending on the path
for (int statusCode : getAllStatusCodes()) { for (int statusCode : getAllStatusCodes()) {

View File

@ -52,7 +52,6 @@ import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicHeader;
import org.apache.http.nio.entity.NStringEntity; import org.apache.http.nio.entity.NStringEntity;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -107,7 +106,7 @@ public class RestClientSingleHostIntegTests extends RestClientTestCase {
} }
private HttpServer createHttpServer() throws Exception { private HttpServer createHttpServer() throws Exception {
HttpServer httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); HttpServer httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
httpServer.start(); httpServer.start();
//returns a different status code depending on the path //returns a different status code depending on the path
for (int statusCode : getAllStatusCodes()) { for (int statusCode : getAllStatusCodes()) {

View File

@ -47,8 +47,8 @@ dependencies {
testImplementation project(":client:test") testImplementation project(":client:test")
testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}" testImplementation "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
testImplementation "junit:junit:${versions.junit}" testImplementation "junit:junit:${versions.junit}"
testImplementation "org.elasticsearch:securemock:${versions.securemock}" testImplementation "org.mockito:mockito-core:${versions.mockito}"
testImplementation "org.elasticsearch:mocksocket:${versions.mocksocket}" testImplementation "org.objenesis:objenesis:${versions.objenesis}"
} }
tasks.named('forbiddenApisMain').configure { tasks.named('forbiddenApisMain').configure {

View File

@ -48,7 +48,6 @@ import org.opensearch.client.Response;
import org.opensearch.client.ResponseException; import org.opensearch.client.ResponseException;
import org.opensearch.client.RestClient; import org.opensearch.client.RestClient;
import org.opensearch.client.RestClientTestCase; import org.opensearch.client.RestClientTestCase;
import org.elasticsearch.mocksocket.MockHttpServer;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -153,7 +152,7 @@ public class OpenSearchNodesSnifferTests extends RestClientTestCase {
} }
private static HttpServer createHttpServer(final SniffResponse sniffResponse, final int sniffTimeoutMillis) throws IOException { private static HttpServer createHttpServer(final SniffResponse sniffResponse, final int sniffTimeoutMillis) throws IOException {
HttpServer httpServer = MockHttpServer.createHttp(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0); HttpServer httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 0);
httpServer.createContext("/_nodes/http", new ResponseHandler(sniffTimeoutMillis, sniffResponse)); httpServer.createContext("/_nodes/http", new ResponseHandler(sniffTimeoutMillis, sniffResponse));
return httpServer; return httpServer;
} }