Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dependency update): update dependencies and migrate wiremock to latest version #848

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
java-version: 21
settings-path: ${{ github.workspace }}
- name: Build Project
run: ./mvnw -B --no-transfer-progress package -Dlicense.skip=true
run: ./mvnw -B --no-transfer-progress install -Prelease -Dlicense.skip=true
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.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
6 changes: 0 additions & 6 deletions components/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -58,11 +57,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));
}
}
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,12 +17,15 @@ package com.hotels.styx.server.netty

import com.hotels.styx.metrics.CentralisedMetrics
import com.hotels.styx.server.HttpsConnectorConfig
import io.netty.handler.ssl.*
import io.netty.handler.ssl.OpenSslSessionContext
import io.netty.handler.ssl.OpenSslSessionStats
import io.netty.handler.ssl.SslContext
import io.netty.handler.ssl.SslContextBuilder
import io.netty.handler.ssl.SslProvider
import io.netty.handler.ssl.util.SelfSignedCertificate
import java.io.File
import java.util.concurrent.TimeUnit.MILLISECONDS


/**
* Produce an SslContext based on the provided configuration.
*
Expand All @@ -42,12 +45,17 @@ fun HttpsConnectorConfig.newSSLContext(): SslContext =
* @param metrics metrics
* @return SslContext
*/
fun newSSLContext(httpsConnectorConfig: HttpsConnectorConfig, metrics: CentralisedMetrics) =
httpsConnectorConfig.newSSLContext().apply {
registerOpenSslStats(this, metrics)
}
fun newSSLContext(
httpsConnectorConfig: HttpsConnectorConfig,
metrics: CentralisedMetrics,
) = httpsConnectorConfig.newSSLContext().apply {
registerOpenSslStats(this, metrics)
}

private fun registerOpenSslStats(sslContext: SslContext, metrics: CentralisedMetrics) {
private fun registerOpenSslStats(
sslContext: SslContext,
metrics: CentralisedMetrics,
) {
sslContext.sessionContext().ifInstanceOf<OpenSslSessionContext> {
it.stats().let { stats ->
metrics.proxy.server.openssl.run {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2013-2023 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,16 +24,20 @@ import java.net.URI

object UrlDecoder {
@JvmStatic
fun decodeUrl(unwiseCharEncoder: UnwiseCharsEncoder, request: HttpRequest): Url {
fun decodeUrl(
unwiseCharEncoder: UnwiseCharsEncoder,
request: HttpRequest,
): Url {
val host = request.headers()[HOST]

return if (request.uri().startsWith("/") && host != null) {
val encodedUrl = "http://$host${unwiseCharEncoder.encode(request.uri())}"
val uri = try {
URI.create(encodedUrl)
} catch (e: IllegalArgumentException) {
encodedUrl.toHttpUrlOrNull()!!.toUri()
}
val uri =
try {
URI.create(encodedUrl)
} catch (e: IllegalArgumentException) {
encodedUrl.toHttpUrlOrNull()!!.toUri()
}
Url.Builder()
.path(uri.rawPath)
.rawQuery(uri.rawQuery)
Expand All @@ -44,4 +48,3 @@ object UrlDecoder {
}
}
}

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
Loading
Loading