Skip to content

Commit 68f962b

Browse files
committed
add SQS integration test
1 parent ef94640 commit 68f962b

File tree

3 files changed

+88
-16
lines changed

3 files changed

+88
-16
lines changed

awssdkv2-java11-async-client/pom.xml

+13-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<version>2.23.7</version>
1010
</parent>
1111

12-
<artifactId>java-nio-client</artifactId>
12+
<artifactId>java-11-async-client</artifactId>
1313
<name>AWS Java SDK :: HTTP Clients :: Java 11 Async HTTP Clients</name>
1414
<packaging>jar</packaging>
1515

@@ -80,12 +80,6 @@
8080
<artifactId>assertj-core</artifactId>
8181
<scope>test</scope>
8282
</dependency>
83-
<dependency>
84-
<groupId>software.amazon.awssdk</groupId>
85-
<artifactId>s3</artifactId>
86-
<version>${awsjavasdk.version}</version>
87-
<scope>test</scope>
88-
</dependency>
8983
<dependency>
9084
<groupId>software.amazon.awssdk</groupId>
9185
<artifactId>regions</artifactId>
@@ -94,31 +88,36 @@
9488
</dependency>
9589
<dependency>
9690
<groupId>software.amazon.awssdk</groupId>
97-
<artifactId>transcribestreaming</artifactId>
91+
<artifactId>service-test-utils</artifactId>
9892
<version>${awsjavasdk.version}</version>
9993
<scope>test</scope>
10094
</dependency>
10195
<dependency>
102-
<groupId>software.amazon.awssdk</groupId>
103-
<artifactId>service-test-utils</artifactId>
104-
<version>${awsjavasdk.version}</version>
96+
<groupId>org.slf4j</groupId>
97+
<artifactId>slf4j-simple</artifactId>
10598
<scope>test</scope>
10699
</dependency>
107100
<dependency>
108101
<groupId>software.amazon.awssdk</groupId>
109-
<artifactId>kinesis</artifactId>
102+
<artifactId>sqs</artifactId>
110103
<version>${awsjavasdk.version}</version>
111104
<scope>test</scope>
112105
</dependency>
113106
<dependency>
114-
<groupId>org.slf4j</groupId>
115-
<artifactId>slf4j-simple</artifactId>
107+
<groupId>org.testcontainers</groupId>
108+
<artifactId>localstack</artifactId>
109+
<version>1.19.4</version>
116110
<scope>test</scope>
117111
</dependency>
118112
</dependencies>
119113

120114
<build>
121115
<plugins>
116+
<plugin>
117+
<groupId>org.apache.maven.plugins</groupId>
118+
<artifactId>maven-failsafe-plugin</artifactId>
119+
<version>${maven-failsafe-plugin.version}</version>
120+
</plugin>
122121
<plugin>
123122
<groupId>org.apache.maven.plugins</groupId>
124123
<artifactId>maven-jar-plugin</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.sigpwned.software.amazon.awssdk.http.java11;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SQS;
5+
6+
import org.junit.Before;
7+
import org.junit.Rule;
8+
import org.junit.Test;
9+
import org.testcontainers.containers.localstack.LocalStackContainer;
10+
import org.testcontainers.utility.DockerImageName;
11+
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
12+
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
13+
import software.amazon.awssdk.regions.Region;
14+
import software.amazon.awssdk.services.sqs.SqsAsyncClient;
15+
import software.amazon.awssdk.services.sqs.model.ListQueuesResponse;
16+
17+
public class SqsIT {
18+
19+
DockerImageName localstackImage = DockerImageName.parse("localstack/localstack:3.1.0");
20+
21+
@Rule
22+
public LocalStackContainer localstack = new LocalStackContainer(localstackImage).withServices(
23+
SQS);
24+
public SqsAsyncClient client;
25+
26+
@Before
27+
public void setupSqsIT() {
28+
client = SqsAsyncClient.builder().endpointOverride(localstack.getEndpoint())
29+
.httpClientBuilder(Java11AsyncHttpClient.builder()).credentialsProvider(
30+
StaticCredentialsProvider.create(
31+
AwsBasicCredentials.create(localstack.getAccessKey(), localstack.getSecretKey())))
32+
.region(Region.of(localstack.getRegion())).build();
33+
}
34+
35+
@Test
36+
public void smokeTest() throws Exception {
37+
ListQueuesResponse response = client.listQueues().get();
38+
assertThat(response.queueUrls()).isEmpty();
39+
}
40+
}

pom.xml

+35-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
</organization>
2323

2424
<scm>
25-
<connection>scm:git:ssh://[email protected]/sigpwned/aws-java-sdk-v2-java-11-client.git</connection>
26-
<developerConnection>scm:git:ssh://[email protected]/sigpwned/aws-java-sdk-v2-java-11-client.git</developerConnection>
25+
<connection>scm:git:ssh://[email protected]/sigpwned/aws-java-sdk-v2-java-11-client.git
26+
</connection>
27+
<developerConnection>scm:git:ssh://[email protected]/sigpwned/aws-java-sdk-v2-java-11-client.git
28+
</developerConnection>
2729
<url>https://github.com/sigpwned/aws-java-sdk-v2-java-11-client/tree/main</url>
2830
</scm>
2931

@@ -65,8 +67,39 @@
6567
</properties>
6668

6769
<build>
70+
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
6871
<pluginManagement>
6972
<plugins>
73+
<!-- Let's run integration tests, shall we? -->
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-failsafe-plugin</artifactId>
77+
<version>${maven-failsafe-plugin.version}</version>
78+
<executions>
79+
<execution>
80+
<id>integration-test</id>
81+
<phase>integration-test</phase>
82+
<goals>
83+
<goal>integration-test</goal>
84+
</goals>
85+
</execution>
86+
<execution>
87+
<id>verify</id>
88+
<phase>verify</phase>
89+
<goals>
90+
<goal>verify</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
<configuration>
95+
<includes>
96+
<include>**/*IT.java</include>
97+
</includes>
98+
<excludes>
99+
<exclude>**/*Test.java</exclude>
100+
</excludes>
101+
</configuration>
102+
</plugin>
70103
<!-- Disabling because a component is not found, software.amazon.awssdk:build-tools:1.0 -->
71104
<plugin>
72105
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)