Skip to content

Commit 4a4e92d

Browse files
authored
Merge pull request #52 from reactiverse/feat/fix-signature-issue-and-upgrade-dpdcies
(feat) Fix signature issue and upgrade dependencies
2 parents e7e0a45 + a8c02dd commit 4a4e92d

File tree

13 files changed

+107
-44
lines changed

13 files changed

+107
-44
lines changed

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ trim_trailing_whitespace = true
88
end_of_line = lf
99
insert_final_newline = true
1010

11-
[Makefile]
12-
indent_style = tab
13-
1411
[**/examples/**.java]
1512
# 84 looks like a odd number, however
1613
# it accounts for 4 spaces (class and example method indentation)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ target
55
build
66
.vertx
77
.DS_Store
8+
.run

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Artifacts are published [here](https://search.maven.org/artifact/io.reactiverse/
1212

1313
| Project | Vert.x | AWS sdk |
1414
| ------- | ------ | ------- |
15+
| 0.7.0 | 3.9.4 | 2.15.23 |
1516
| 0.6.0 | 3.9.2 | 2.14.7 |
1617
| 0.5.1 | 3.9.2 | 2.13.6 |
1718
| 0.5.0 | 3.9.0 | 2.12.0 |

build.gradle.kts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
val vertxVersion = "3.9.2"
2-
val awsSdkVersion = "2.14.7"
1+
val vertxVersion = "3.9.4"
2+
val awsSdkVersion = "2.15.23"
33
val junit5Version = "5.4.0"
44
val logbackVersion = "1.2.3"
55
val integrationOption = "tests.integration"
66

77
group = "io.reactiverse"
8-
version = "0.6.0"
8+
version = "0.7.0"
99

1010
plugins {
1111
`java-library`
1212
`maven-publish`
1313
jacoco
1414
id("com.jfrog.bintray") version "1.8.5"
1515
id("com.jaredsburrows.license") version "0.8.42"
16-
id("org.sonarqube") version "2.6"
16+
id("org.sonarqube") version "3.0"
17+
id("com.github.ben-manes.versions") version "0.34.0"
1718
}
1819

1920
// In order to publish SNAPSHOTs to Sonatype Snapshots repository => the CI should define such `ossrhUsername` and `ossrhPassword` properties
@@ -54,13 +55,20 @@ repositories {
5455
}
5556
}
5657

58+
fun isNonStable(version: String): Boolean {
59+
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
60+
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
61+
val isStable = stableKeyword || regex.matches(version)
62+
return isStable.not()
63+
}
64+
5765
dependencies {
5866
api("io.vertx:vertx-core:$vertxVersion")
5967
api("software.amazon.awssdk:aws-core:$awsSdkVersion")
6068

6169
testImplementation("io.vertx:vertx-junit5:$vertxVersion")
6270
testImplementation("io.vertx:vertx-rx-java2:$vertxVersion")
63-
testImplementation("cloud.localstack:localstack-utils:0.1.22")
71+
testImplementation("cloud.localstack:localstack-utils:0.2.5")
6472
testImplementation("ch.qos.logback:logback-classic:$logbackVersion")
6573
testImplementation("ch.qos.logback:logback-core:$logbackVersion")
6674
testImplementation("software.amazon.awssdk:aws-sdk-java:$awsSdkVersion")
@@ -78,6 +86,11 @@ jacoco {
7886
}
7987

8088
tasks {
89+
named("dependencyUpdates", com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask::class.java).configure {
90+
rejectVersionIf {
91+
isNonStable(candidate.version)
92+
}
93+
}
8194

8295
jacocoTestReport {
8396
dependsOn(":test")

src/main/java/io/reactiverse/awssdk/VertxNioAsyncHttpClient.java

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
import io.reactiverse.awssdk.reactivestreams.ReadStreamPublisher;
66
import io.vertx.core.Context;
77
import io.vertx.core.Vertx;
8-
import io.vertx.core.http.*;
8+
import io.vertx.core.http.HttpClient;
9+
import io.vertx.core.http.HttpClientOptions;
10+
import io.vertx.core.http.HttpClientRequest;
11+
import io.vertx.core.http.HttpHeaders;
12+
import io.vertx.core.http.HttpMethod;
13+
import io.vertx.core.http.RequestOptions;
914
import software.amazon.awssdk.http.SdkHttpFullResponse;
1015
import software.amazon.awssdk.http.SdkHttpRequest;
1116
import software.amazon.awssdk.http.SdkHttpResponse;
1217
import software.amazon.awssdk.http.async.AsyncExecuteRequest;
1318
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
1419
import software.amazon.awssdk.http.async.SdkAsyncHttpResponseHandler;
1520
import software.amazon.awssdk.http.async.SdkHttpContentPublisher;
21+
import software.amazon.awssdk.utils.StringUtils;
1622

17-
import java.util.Optional;
23+
import java.net.URI;
1824
import java.util.concurrent.CompletableFuture;
1925

2026
import static java.util.Objects.requireNonNull;
@@ -90,13 +96,21 @@ void executeOnContext(AsyncExecuteRequest asyncExecuteRequest, CompletableFuture
9096
}
9197
}
9298

93-
private static RequestOptions getRequestOptions(SdkHttpRequest request) {
94-
return new RequestOptions()
95-
.setHost(request.host())
96-
.setPort(request.port())
97-
.setURI(request.encodedPath())
98-
.setSsl("https".equals(request.protocol()));
99-
}
99+
private static RequestOptions getRequestOptions(SdkHttpRequest request) {
100+
return new RequestOptions()
101+
.setHost(request.host())
102+
.setPort(request.port())
103+
.setURI(createRelativeUri(request.getUri()))
104+
.setSsl("https".equals(request.protocol()));
105+
}
106+
107+
private static String createRelativeUri(URI uri) {
108+
return (StringUtils.isEmpty(uri.getPath()) ? "/" : uri.getPath()) +
109+
// AWS requires query parameters to be encoded as defined by RFC 3986.
110+
// see https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
111+
// uri.toASCIIString() returns the URI encoded in this manner
112+
(StringUtils.isEmpty(uri.getQuery()) ? "" : "?" + uri.toASCIIString().split("\\?")[1]);
113+
}
100114

101115
@Override
102116
public void close() {

src/test/java/io/reactiverse/awssdk/integration/LocalStackBaseSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.reactiverse.awssdk.integration;
22

3-
import cloud.localstack.docker.LocalstackDocker;
3+
import cloud.localstack.Localstack;
44
import io.reactivex.Single;
55
import io.reactivex.SingleOnSubscribe;
66
import io.vertx.core.Context;
@@ -39,7 +39,7 @@ protected void assertContext(Vertx vertx, Context context, VertxTestContext test
3939
}
4040

4141
protected static URI s3URI() throws Exception {
42-
return new URI(LocalstackDocker.INSTANCE.getEndpointS3());
42+
return new URI(Localstack.INSTANCE.getEndpointS3());
4343
}
4444

4545
protected static S3AsyncClient s3(Context context) throws Exception {

src/test/java/io/reactiverse/awssdk/integration/apigateway/VertxApiGatewaySpec.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.reactiverse.awssdk.integration.apigateway;
22

3-
import cloud.localstack.docker.LocalstackDocker;
3+
import cloud.localstack.Localstack;
44
import cloud.localstack.docker.LocalstackDockerExtension;
55
import cloud.localstack.docker.annotation.LocalstackDockerProperties;
66
import io.reactiverse.awssdk.VertxSdkClient;
@@ -40,13 +40,13 @@
4040
import static org.junit.jupiter.api.Assertions.assertEquals;
4141

4242
@EnabledIfSystemProperty(named = "tests.integration", matches = "localstack")
43-
@LocalstackDockerProperties(services = { "apigateway" }, imageTag = "0.10.2")
43+
@LocalstackDockerProperties(services = { "apigateway" }, imageTag = "0.12.2")
4444
@ExtendWith(VertxExtension.class)
4545
@ExtendWith(LocalstackDockerExtension.class)
4646
public class VertxApiGatewaySpec extends LocalStackBaseSpec {
4747

48-
private final static String API_NAME = "My-API";
49-
private final static String PATH = "/faking";
48+
private final static String API_NAME = "MyAPI";
49+
private final static String PATH = "faking";
5050
private final static HttpMethod METHOD = HttpMethod.GET;
5151
private final static Map<String, String> TEMPLATES = new HashMap<>();
5252
private final static String MOCK_RESPONSE = "{\"message\": \"Hello from a fake backend\"}";
@@ -60,7 +60,8 @@ public class VertxApiGatewaySpec extends LocalStackBaseSpec {
6060
private String resourceId;
6161

6262
// README: see below for the full test
63-
// But: https://github.com/localstack/localstack/issues/1030
63+
// Since: https://github.com/localstack/localstack/issues/1030 has been fixed, it should work, but there's another issue
64+
// (on the test design this time: No integration defined for method "Service: ApiGateway" => investigate later)
6465
// For now we're just testing creation requests, but not the actual routing one, because localstack doesn't allow it
6566
@Test
6667
@Timeout(value = 10, timeUnit = TimeUnit.SECONDS)
@@ -174,11 +175,11 @@ private Single<TestInvokeMethodResponse> makeIntegrationTest() {
174175
private static CreateRestApiRequest.Builder restApiDefinition(CreateRestApiRequest.Builder rar) {
175176
return rar.name(API_NAME)
176177
.binaryMediaTypes("text/plain")
177-
.description("Fetches weather");
178+
.description("Fetches_weather");
178179
}
179180

180181
private void createGatewayClient(Context context) throws Exception {
181-
final URI gatewayURI = new URI(LocalstackDocker.INSTANCE.getEndpointAPIGateway());
182+
final URI gatewayURI = new URI(Localstack.INSTANCE.getEndpointAPIGateway());
182183
final ApiGatewayAsyncClientBuilder builder = ApiGatewayAsyncClient.builder()
183184
.region(Region.US_EAST_1)
184185
.credentialsProvider(credentialsProvider)

src/test/java/io/reactiverse/awssdk/integration/cloudwatch/VertxCloudWatchClientSpec.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.reactiverse.awssdk.integration.cloudwatch;
22

3-
import cloud.localstack.docker.LocalstackDocker;
3+
import cloud.localstack.Localstack;
44
import cloud.localstack.docker.LocalstackDockerExtension;
55
import cloud.localstack.docker.annotation.LocalstackDockerProperties;
66
import io.reactiverse.awssdk.VertxSdkClient;
@@ -23,11 +23,10 @@
2323
import java.net.URI;
2424
import java.util.concurrent.TimeUnit;
2525

26-
import static org.junit.jupiter.api.Assertions.assertEquals;
2726
import static org.junit.jupiter.api.Assertions.assertTrue;
2827

2928
@EnabledIfSystemProperty(named = "tests.integration", matches = "localstack")
30-
@LocalstackDockerProperties(services = { "cloudwatch" }, imageTag = "0.10.2")
29+
@LocalstackDockerProperties(services = { "cloudwatch" }, imageTag = "0.12.2")
3130
@ExtendWith(VertxExtension.class)
3231
@ExtendWith(LocalstackDockerExtension.class)
3332
public class VertxCloudWatchClientSpec extends LocalStackBaseSpec {
@@ -85,7 +84,7 @@ private static PutDashboardRequest.Builder createDashboard(PutDashboardRequest.B
8584
}
8685

8786
private static CloudWatchAsyncClient cloudwatchClient(Context ctx) throws Exception {
88-
final URI cloudwatchURI = new URI(LocalstackDocker.INSTANCE.getEndpointCloudWatch());
87+
final URI cloudwatchURI = new URI(Localstack.INSTANCE.getEndpointCloudWatch());
8988
final CloudWatchAsyncClientBuilder builder =
9089
CloudWatchAsyncClient.builder()
9190
.credentialsProvider(credentialsProvider)

src/test/java/io/reactiverse/awssdk/integration/dynamodb/VertxDynamoClientSpec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.reactiverse.awssdk.integration.dynamodb;
22

3-
import cloud.localstack.docker.LocalstackDocker;
3+
import cloud.localstack.Localstack;
44
import cloud.localstack.docker.LocalstackDockerExtension;
55
import cloud.localstack.docker.annotation.LocalstackDockerProperties;
66
import io.reactiverse.awssdk.VertxSdkClient;
@@ -37,7 +37,7 @@
3737
@ExtendWith(VertxExtension.class)
3838
@ExtendWith(LocalstackDockerExtension.class)
3939
@EnabledIfSystemProperty(named = "tests.integration", matches = "localstack")
40-
@LocalstackDockerProperties(services = { "dynamodb" }, imageTag = "0.10.2")
40+
@LocalstackDockerProperties(services = { "dynamodb" }, imageTag = "0.12.2")
4141
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
4242
public class VertxDynamoClientSpec extends LocalStackBaseSpec {
4343

@@ -136,7 +136,7 @@ private static GetItemRequest.Builder getItem(GetItemRequest.Builder gib) {
136136
}
137137

138138
private DynamoDbAsyncClient dynamo(Context context) throws Exception {
139-
final URI dynamoEndpoint = new URI(LocalstackDocker.INSTANCE.getEndpointDynamoDB());
139+
final URI dynamoEndpoint = new URI(Localstack.INSTANCE.getEndpointDynamoDB());
140140
return VertxSdkClient.withVertx(
141141
DynamoDbAsyncClient.builder()
142142
.region(Region.EU_WEST_1)

src/test/java/io/reactiverse/awssdk/integration/firehose/VertxFirehoseClientSpec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.reactiverse.awssdk.integration.firehose;
22

3-
import cloud.localstack.docker.LocalstackDocker;
3+
import cloud.localstack.Localstack;
44
import cloud.localstack.docker.LocalstackDockerExtension;
55
import cloud.localstack.docker.annotation.LocalstackDockerProperties;
66
import io.reactiverse.awssdk.VertxSdkClient;
@@ -52,7 +52,7 @@
5252
@ExtendWith(VertxExtension.class)
5353
@ExtendWith(LocalstackDockerExtension.class)
5454
@EnabledIfSystemProperty(named = "tests.integration", matches = "localstack")
55-
@LocalstackDockerProperties(services = { "firehose", "s3" }, imageTag = "0.10.2")
55+
@LocalstackDockerProperties(services = { "firehose", "s3" }, imageTag = "0.12.2")
5656
public class VertxFirehoseClientSpec extends LocalStackBaseSpec {
5757

5858
private final static String STREAM = "My-Vertx-Firehose-Stream";
@@ -173,6 +173,6 @@ private void createFirehoseClient(Context context) throws Exception {
173173
}
174174

175175
private static URI getFirehoseURI() throws Exception {
176-
return new URI(LocalstackDocker.INSTANCE.getEndpointFirehose());
176+
return new URI(Localstack.INSTANCE.getEndpointFirehose());
177177
}
178178
}

0 commit comments

Comments
 (0)