Skip to content

Commit

Permalink
chore(dependency update): update dependencies and migrate wiremock to…
Browse files Browse the repository at this point in the history
… latest version
  • Loading branch information
kenluluuuluuuuu committed Mar 1, 2024
1 parent abf4df6 commit e7f8a29
Show file tree
Hide file tree
Showing 35 changed files with 425 additions and 826 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
5 changes: 0 additions & 5 deletions components/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions components/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
<artifactId>styx-api</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-json</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2021 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@

/**
* A Styx HTTP client interface.
*
* <p>
* This interface offers a fluent interface to build and configure HTTP
* request transactions from a client instance. The requests can be consumed
* either aggregated {@link HttpResponse} or streaming {@link LiveHttpRequest}
Expand All @@ -33,29 +33,16 @@
public interface HttpClient {

/**
* Sends a HTTP request message using this client.
*
* @deprecated use {@link #send} instead.
*
* @param request a full HTTP request object
* @return a future of full HTTP request object
*/
@Deprecated
default CompletableFuture<HttpResponse> sendRequest(HttpRequest request) {
return send(request);
}

/**
* Sends a HTTP request message using this client.
* Sends an HTTP request message using this client.
*
* @param request a full HTTP request object
* @return a future of full HTTP request object
*/
CompletableFuture<HttpResponse> send(HttpRequest request);

/**
* A HTTP request transaction.
*
* An HTTP request transaction.
* <p>
* This interface allows client attributes and context to be customised
* for each request without having to rely on configured default values
* in the client.
Expand All @@ -80,7 +67,7 @@ interface Transaction {

/**
* Converts the transaction object to streaming transaction.
*
* <p>
* A call to {@code streaming()} converts this {@link Transaction} object to
* a {@link StreamingTransaction}. This allows responses to be consumed
* in streaming responses.
Expand All @@ -90,7 +77,7 @@ interface Transaction {
StreamingTransaction streaming();

/**
* Sends a HTTP request message using this client.
* Sends an HTTP request message using this client.
*
* @param request a full HTTP request object
* @return a future of full HTTP request object
Expand All @@ -100,7 +87,7 @@ interface Transaction {

/**
* A streaming HTTP request transaction.
*
* <p>
* This interface allows the response object to be consumed in a streaming
* fashion instead of being aggregated into a HttpResponse.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2022 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2021 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -20,6 +20,7 @@
import com.hotels.styx.client.Connection;
import com.hotels.styx.client.ConnectionSettings;
import com.hotels.styx.support.server.FakeHttpServer;
import com.hotels.styx.support.server.UrlMatchingStrategies;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
Expand Down
5 changes: 0 additions & 5 deletions components/proxy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
</dependency>

<!--For logback.xml-->
<dependency>
<groupId>org.codehaus.janino</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2021 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -17,13 +17,13 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hotels.styx.StyxObjectRecord;
import com.hotels.styx.api.HttpRequest;
import com.hotels.styx.api.HttpResponse;
import com.hotels.styx.api.extension.service.spi.StyxService;
import com.hotels.styx.routing.config.StyxObjectDefinition;
import com.hotels.styx.routing.db.StyxObjectStore;
import com.hotels.styx.StyxObjectRecord;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;

Expand All @@ -35,10 +35,10 @@
import java.util.Optional;
import java.util.stream.Collectors;

import static com.hotels.styx.support.Support.requestContext;
import static com.hotels.styx.api.HttpResponseStatus.NOT_FOUND;
import static com.hotels.styx.api.HttpResponseStatus.NO_CONTENT;
import static com.hotels.styx.api.HttpResponseStatus.OK;
import static com.hotels.styx.support.Support.requestContext;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2021 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -139,6 +139,6 @@ private HttpResponse get(String uri) {
}

private HttpResponse execute(HttpRequest request) {
return await(client.sendRequest(request));
return await(client.send(request));
}
}
2 changes: 1 addition & 1 deletion components/test-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</dependency>

<dependency>
<groupId>com.github.tomakehurst</groupId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2021 Expedia Inc.
Copyright (C) 2013-2024 Expedia Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -119,7 +119,7 @@ public void proxiesToOrigin() {
.addRoute("/", originServer1.port())
.start();

HttpResponse response = await(client.sendRequest(get(format("https://localhost:%d/", styxServer.proxyHttpPort())).build()));
HttpResponse response = await(client.send(get(format("https://localhost:%d/", styxServer.proxyHttpPort())).build()));

assertThat(response.status(), is(OK));
configureFor(originServer1.port());
Expand All @@ -133,7 +133,7 @@ public void startsProxyOnSpecifiedHttpPort() {
.addRoute("/", originServer1.port())
.start();

HttpResponse response = await(client.sendRequest(get(format("https://localhost:%d/", styxServer.proxyHttpPort())).build()));
HttpResponse response = await(client.send(get(format("https://localhost:%d/", styxServer.proxyHttpPort())).build()));

assertThat(response.status(), is(OK));
}
Expand All @@ -145,7 +145,7 @@ public void startsAdminOnSpecifiedHttpPort() {
.addRoute("/", originServer1.port())
.start();

HttpResponse response = await(client.sendRequest(get(format("https://localhost:%d/admin", styxServer.adminPort())).build()));
HttpResponse response = await(client.send(get(format("https://localhost:%d/admin", styxServer.adminPort())).build()));

assertThat(response.status(), is(OK));
}
Expand All @@ -161,7 +161,7 @@ public void startsProxyOnSpecifiedHttpsPort() {
.tlsSettings(new TlsSettings.Builder().build())
.build();

HttpResponse response = await(tlsClient.sendRequest(get(format("https://localhost:%d/", styxServer.proxyHttpsPort())).build()));
HttpResponse response = await(tlsClient.send(get(format("https://localhost:%d/", styxServer.proxyHttpsPort())).build()));

assertThat(response.status(), is(OK));
}
Expand Down Expand Up @@ -195,7 +195,7 @@ public void proxiesToOriginViaHttps() {
.tlsSettings(new TlsSettings.Builder().build())
.build();

HttpResponse response = await(tlsClient.sendRequest(get(format("https://localhost:%d/", styxServer.proxyHttpsPort())).build()));
HttpResponse response = await(tlsClient.send(get(format("https://localhost:%d/", styxServer.proxyHttpsPort())).build()));

assertThat(response.status(), is(OK));
configureFor(secureOriginServer.port());
Expand All @@ -212,7 +212,7 @@ public void proxiesToOriginViaHttpsWithRequestOriginallyHttp() {
.addRoute("/", backendService)
.start();

HttpResponse response = await(client.sendRequest(get(format("http://localhost:%d/", styxServer.proxyHttpPort())).build()));
HttpResponse response = await(client.send(get(format("http://localhost:%d/", styxServer.proxyHttpPort())).build()));

assertThat(response.status(), is(OK));
configureFor(secureOriginServer.port());
Expand All @@ -226,12 +226,12 @@ public void routesCorrectly() {
.addRoute("/o2/", originServer2.port())
.start();

HttpResponse response1 = await(client.sendRequest(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response1 = await(client.send(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));

assertThat(response1.status(), is(OK));
assertThat(response1.header("origin"), isValue("first"));

HttpResponse response2 = await(client.sendRequest(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response2 = await(client.send(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
assertThat(response2.status(), is(OK));
assertThat(response2.header("origin"), isValue("second"));

Expand All @@ -255,7 +255,7 @@ public void executesPluginsWhenProxying() {
.addPluginFactory("response-decorator", pluginFactory, null)
.start();

HttpResponse response = await(client.sendRequest(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response = await(client.send(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
assertThat(response.status(), is(OK));
assertThat(response.header("origin"), isValue("first"));
assertThat(response.header("plugin-executed"), isValue("yes"));
Expand Down Expand Up @@ -344,7 +344,7 @@ private Plugin mockPlugin(Map<String, HttpHandler> adminInterfaceHandlers) {

private HttpResponse doAdminRequest(String path) {
String url = format("%s://localhost:%s%s", "http", styxServer.adminPort(), startWithSlash(path));
return await(client.sendRequest(get(url).build()));
return await(client.send(get(url).build()));
}

@Test
Expand All @@ -368,11 +368,11 @@ public void canConfigureWithStyxOrigins() {
.addRoute("/o2/", origin(originServer2.port()))
.start();

HttpResponse response1 = await(client.sendRequest(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response1 = await(client.send(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
assertThat(response1.status(), is(OK));
assertThat(response1.header("origin"), isValue("first"));

HttpResponse response2 = await(client.sendRequest(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response2 = await(client.send(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
assertThat(response2.status(), is(OK));
assertThat(response2.header("origin"), isValue("second"));

Expand All @@ -389,11 +389,11 @@ public void canConfigureWithBackendService() {
.addRoute("/o2/", new BackendService().addOrigin(originServer2.port()))
.start();

HttpResponse response1 = await(client.sendRequest(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response1 = await(client.send(get(format("http://localhost:%d/foo", styxServer.proxyHttpPort())).build()));
assertThat(response1.status(), is(OK));
assertThat(response1.header("origin"), isValue("first"));

HttpResponse response2 = await(client.sendRequest(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
HttpResponse response2 = await(client.send(get(format("http://localhost:%d/o2/foo", styxServer.proxyHttpPort())).build()));
assertThat(response2.status(), is(OK));
assertThat(response2.header("origin"), isValue("second"));

Expand Down
2 changes: 1 addition & 1 deletion demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
</dependency>

Expand Down
Loading

0 comments on commit e7f8a29

Please sign in to comment.