Skip to content

Commit b5e97a2

Browse files
Upgrade dependencies and minor refactoring (#79)
1 parent f4ccdbd commit b5e97a2

20 files changed

+302
-323
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "maven"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Temporary queues are also automatically deleted if the clients that created them
2222
<dependency>
2323
<groupId>com.amazonaws</groupId>
2424
<artifactId>amazon-sqs-java-temporary-queues-client</artifactId>
25-
<version>2.0.0</version>
25+
<version>2.0.1</version>
2626
<type>jar</type>
2727
</dependency>
2828
```

pom.xml

+24-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.amazonaws</groupId>
44
<artifactId>amazon-sqs-java-temporary-queues-client</artifactId>
5-
<version>2.0.0</version>
5+
<version>2.0.1</version>
66
<name>Amazon SQS Java Temporary Queues Client</name>
77
<description>An Amazon SQS client that supports creating lightweight, automatically-deleted temporary queues, for use in common messaging patterns such as Request/Response. See http://aws.amazon.com/sqs.</description>
88
<url>https://github.com/awslabs/amazon-sqs-java-temporary-queues-client</url>
@@ -27,7 +27,7 @@
2727
</developer>
2828
</developers>
2929
<properties>
30-
<aws-java-sdk.version>2.17.140</aws-java-sdk.version>
30+
<aws-java-sdk.version>2.20.30</aws-java-sdk.version>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3232
</properties>
3333

@@ -51,28 +51,22 @@
5151
<version>1.2</version>
5252
</dependency>
5353

54-
<dependency>
55-
<groupId>org.junit.vintage</groupId>
56-
<artifactId>junit-vintage-engine</artifactId>
57-
<version>5.7.0-M1</version>
58-
<scope>test</scope>
59-
</dependency>
6054
<dependency>
6155
<groupId>org.junit.jupiter</groupId>
62-
<artifactId>junit-jupiter-engine</artifactId>
63-
<version>5.7.0-M1</version>
56+
<artifactId>junit-jupiter</artifactId>
57+
<version>5.9.2</version>
6458
<scope>test</scope>
6559
</dependency>
6660
<dependency>
6761
<groupId>org.mockito</groupId>
6862
<artifactId>mockito-core</artifactId>
69-
<version>2.28.2</version>
63+
<version>5.2.0</version>
7064
<scope>test</scope>
7165
</dependency>
7266
<dependency>
7367
<groupId>org.awaitility</groupId>
7468
<artifactId>awaitility</artifactId>
75-
<version>4.0.2</version>
69+
<version>4.2.0</version>
7670
<scope>test</scope>
7771
</dependency>
7872
<dependency>
@@ -89,7 +83,7 @@
8983
<plugin>
9084
<groupId>org.apache.maven.plugins</groupId>
9185
<artifactId>maven-compiler-plugin</artifactId>
92-
<version>3.2</version>
86+
<version>3.11.0</version>
9387
<configuration>
9488
<source>1.8</source>
9589
<target>1.8</target>
@@ -109,6 +103,11 @@
109103
</execution>
110104
</executions>
111105
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-surefire-plugin</artifactId>
109+
<version>3.0.0</version>
110+
</plugin>
112111
</plugins>
113112
</pluginManagement>
114113
<plugins>
@@ -128,34 +127,39 @@
128127
<plugin>
129128
<groupId>org.apache.maven.plugins</groupId>
130129
<artifactId>maven-javadoc-plugin</artifactId>
131-
<version>2.9.1</version>
130+
<version>3.5.0</version>
132131
<executions>
133132
<execution>
134133
<id>attach-javadocs</id>
135134
<goals>
136135
<goal>jar</goal>
137136
</goals>
138137
<configuration>
139-
<!--
140-
TODO-RS: Java 8 is more strict about some javadoc tags.
141-
We'll need to update quite a few to remove this workaround.
142-
-->
143-
<additionalparam>-Xdoclint:none</additionalparam>
138+
<source>8</source>
139+
<doclint>none</doclint>
144140
</configuration>
145141
</execution>
146142
</executions>
147143
</plugin>
148144
<plugin>
149145
<groupId>org.sonatype.plugins</groupId>
150146
<artifactId>nexus-staging-maven-plugin</artifactId>
151-
<version>1.6.7</version>
147+
<version>1.6.13</version>
152148
<extensions>true</extensions>
153149
<configuration>
154150
<serverId>ossrh</serverId>
155151
<nexusUrl>https://aws.oss.sonatype.org</nexusUrl>
156152
<autoReleaseAfterClose>true</autoReleaseAfterClose>
157153
</configuration>
158154
</plugin>
155+
<plugin>
156+
<groupId>org.apache.maven.plugins</groupId>
157+
<artifactId>maven-compiler-plugin</artifactId>
158+
<configuration>
159+
<source>9</source>
160+
<target>9</target>
161+
</configuration>
162+
</plugin>
159163
</plugins>
160164
</build>
161165

src/test/java/com/amazonaws/services/sqs/AmazonSQSIdleQueueDeletingIT.java

+26-25
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
11
package com.amazonaws.services.sqs;
22

3-
import java.util.Collections;
4-
import java.util.HashMap;
5-
import java.util.concurrent.Executors;
6-
import java.util.concurrent.ScheduledExecutorService;
7-
import java.util.concurrent.TimeUnit;
8-
93
import com.amazonaws.services.sqs.util.Constants;
10-
import com.amazonaws.services.sqs.util.SQSMessageConsumerBuilder;
11-
import org.junit.After;
12-
import org.junit.Assert;
13-
import org.junit.Before;
14-
import org.junit.Test;
15-
164
import com.amazonaws.services.sqs.util.IntegrationTest;
175
import com.amazonaws.services.sqs.util.SQSMessageConsumer;
6+
import com.amazonaws.services.sqs.util.SQSMessageConsumerBuilder;
187
import com.amazonaws.services.sqs.util.SQSQueueUtils;
8+
import org.junit.jupiter.api.AfterEach;
9+
import org.junit.jupiter.api.BeforeEach;
10+
import org.junit.jupiter.api.Test;
1911
import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
2012
import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;
2113
import software.amazon.awssdk.services.sqs.model.GetQueueUrlRequest;
@@ -24,6 +16,15 @@
2416
import software.amazon.awssdk.services.sqs.model.QueueDoesNotExistException;
2517
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;
2618

19+
import java.util.Collections;
20+
import java.util.HashMap;
21+
import java.util.concurrent.Executors;
22+
import java.util.concurrent.ScheduledExecutorService;
23+
import java.util.concurrent.TimeUnit;
24+
25+
import static org.junit.jupiter.api.Assertions.assertEquals;
26+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
27+
import static org.junit.jupiter.api.Assertions.assertTrue;
2728

2829
public class AmazonSQSIdleQueueDeletingIT extends IntegrationTest {
2930

@@ -32,15 +33,15 @@ public class AmazonSQSIdleQueueDeletingIT extends IntegrationTest {
3233
private static AmazonSQSRequester requester;
3334
private static AmazonSQSResponder responder;
3435

35-
@Before
36+
@BeforeEach
3637
public void setup() {
3738
client = new AmazonSQSIdleQueueDeletingClient(sqs, queueNamePrefix);
3839
requester = new AmazonSQSRequesterClient(sqs, queueNamePrefix,
3940
Collections.emptyMap(), exceptionHandler);
4041
responder = new AmazonSQSResponderClient(sqs);
4142
}
4243

43-
@After
44+
@AfterEach
4445
public void teardown() {
4546
if (client != null && queueUrl != null) {
4647
try {
@@ -71,8 +72,8 @@ public void idleQueueIsDeleted() throws InterruptedException {
7172
queueUrl = client.createQueue(createQueueRequest).queueUrl();
7273

7374
// May have to wait for up to a minute for the new queue to show up in ListQueues
74-
Assert.assertTrue("Expected queue to be deleted: " + queueUrl,
75-
SQSQueueUtils.awaitQueueDeleted(sqs, queueUrl, 70, TimeUnit.SECONDS));
75+
assertTrue(SQSQueueUtils.awaitQueueDeleted(sqs, queueUrl, 70, TimeUnit.SECONDS),
76+
"Expected queue to be deleted: " + queueUrl);
7677
}
7778

7879
@Test
@@ -99,7 +100,7 @@ public void updatedHeartBeatTag() throws InterruptedException {
99100

100101
String updatedHeartbeat = getLastHeartbeatTimestamp();
101102

102-
Assert.assertNotEquals(initialHeartBeat, updatedHeartbeat);
103+
assertNotEquals(initialHeartBeat, updatedHeartbeat);
103104
}
104105

105106
private String getLastHeartbeatTimestamp() {
@@ -131,7 +132,7 @@ public void notUpdatedHeartBeatTag() throws InterruptedException {
131132

132133
String notUpdatedHeartbeat = getLastHeartbeatTimestamp();
133134

134-
Assert.assertEquals(initialHeartBeat, notUpdatedHeartbeat);
135+
assertEquals(initialHeartBeat, notUpdatedHeartbeat);
135136
}
136137

137138
@Test
@@ -153,14 +154,14 @@ public void recreatingQueues() throws InterruptedException {
153154
sqs.deleteQueue(DeleteQueueRequest.builder().queueUrl(queueUrl).build());
154155

155156
// Sleeping is unfortunate here, but it's necessary to ensure the eventual consistency
156-
// of the delete is resolved first. Otherwise it's easy to get a false positive below.
157+
// of the delete is resolved first. Otherwise, it's easy to get a false positive below.
157158
TimeUnit.MINUTES.sleep(1);
158159

159160
// Ensure the original queue is eventually recreated. This becoming true at least once
160161
// indicates that CreateQueue was successfully called, even if it may flip back to false
161162
// on subsequent calls.
162-
Assert.assertTrue("Expected original queue to be recreated: " + queueUrl,
163-
SQSQueueUtils.awaitQueueCreated(sqs, queueUrl, 70, TimeUnit.SECONDS));
163+
assertTrue(SQSQueueUtils.awaitQueueCreated(sqs, queueUrl, 70, TimeUnit.SECONDS),
164+
"Expected original queue to be recreated: " + queueUrl);
164165

165166
// Ensure the user doesn't experience any send or receive failures
166167
user.finish();
@@ -180,10 +181,10 @@ public void recreatingQueues() throws InterruptedException {
180181
}
181182
});
182183

183-
Assert.assertTrue("Expected original queue to be deleted: " + failoverQueueUrl,
184-
SQSQueueUtils.awaitQueueDeleted(sqs, queueUrl, 70, TimeUnit.SECONDS));
185-
Assert.assertTrue("Expected failover queue to be deleted with the original: " + failoverQueueUrl,
186-
SQSQueueUtils.awaitQueueDeleted(sqs, failoverQueueUrl, 70, TimeUnit.SECONDS));
184+
assertTrue(SQSQueueUtils.awaitQueueDeleted(sqs, queueUrl, 70, TimeUnit.SECONDS),
185+
"Expected original queue to be deleted: " + failoverQueueUrl);
186+
assertTrue(SQSQueueUtils.awaitQueueDeleted(sqs, failoverQueueUrl, 70, TimeUnit.SECONDS),
187+
"Expected failover queue to be deleted with the original: " + failoverQueueUrl);
187188
}
188189

189190
private class QueueUser {

src/test/java/com/amazonaws/services/sqs/AmazonSQSRequesterClientTest.java

+17-24
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
package com.amazonaws.services.sqs;
22

3-
import static org.hamcrest.core.IsInstanceOf.instanceOf;
4-
import static org.junit.Assert.assertEquals;
5-
import static org.junit.Assert.assertNotNull;
6-
import static org.junit.Assert.assertThat;
7-
import static org.junit.Assert.fail;
8-
9-
import java.util.Collections;
10-
import java.util.concurrent.ExecutionException;
11-
import java.util.concurrent.Future;
12-
import java.util.concurrent.TimeUnit;
13-
import java.util.concurrent.TimeoutException;
14-
153
import com.amazonaws.services.sqs.util.Constants;
16-
import org.junit.After;
17-
import org.junit.Test;
18-
194
import com.amazonaws.services.sqs.util.ExceptionAsserter;
205
import com.amazonaws.services.sqs.util.MockSQS;
216
import com.amazonaws.services.sqs.util.SQSQueueUtils;
7+
import org.junit.jupiter.api.AfterEach;
8+
import org.junit.jupiter.api.Test;
229
import software.amazon.awssdk.services.sqs.SqsClient;
2310
import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
2411
import software.amazon.awssdk.services.sqs.model.Message;
2512
import software.amazon.awssdk.services.sqs.model.ReceiveMessageRequest;
2613
import software.amazon.awssdk.services.sqs.model.SendMessageRequest;
2714

15+
import java.util.Collections;
16+
import java.util.concurrent.ExecutionException;
17+
import java.util.concurrent.Future;
18+
import java.util.concurrent.TimeUnit;
19+
import java.util.concurrent.TimeoutException;
20+
21+
import static org.junit.jupiter.api.Assertions.assertEquals;
22+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
23+
import static org.junit.jupiter.api.Assertions.assertNotNull;
24+
import static org.junit.jupiter.api.Assertions.assertThrows;
25+
2826
public class AmazonSQSRequesterClientTest {
2927

3028
private final ExceptionAsserter exceptionHandler = new ExceptionAsserter();
@@ -43,7 +41,7 @@ public AmazonSQSRequesterClientTest() {
4341
this.responderClient = new AmazonSQSResponderClient(sqs);
4442
}
4543

46-
@After
44+
@AfterEach
4745
public void tearDown() {
4846
this.exceptionHandler.assertNothingThrown();
4947
}
@@ -89,14 +87,9 @@ public void timeout() throws TimeoutException, InterruptedException, ExecutionEx
8987
assertEquals(requestMessageBody, requestMessage.body());
9088
String responseQueueUrl = requestMessage.messageAttributes().get(Constants.RESPONSE_QUEUE_URL_ATTRIBUTE_NAME).stringValue();
9189
assertNotNull(responseQueueUrl);
92-
93-
// TODO-RS: Junit 5
94-
try {
95-
future.get();
96-
fail();
97-
} catch (ExecutionException e) {
98-
assertThat(e.getCause(), instanceOf(TimeoutException.class));
99-
}
90+
91+
Exception exception = assertThrows(ExecutionException.class, future::get);
92+
assertInstanceOf(TimeoutException.class, exception.getCause());
10093

10194
// Make sure the response queue was deleted
10295
SQSQueueUtils.awaitQueueDeleted(sqs, responseQueueUrl, 70, TimeUnit.SECONDS);

src/test/java/com/amazonaws/services/sqs/AmazonSQSResponsesClientCrossAccountIT.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import com.amazonaws.services.sqs.util.IntegrationTest;
44
import com.amazonaws.services.sqs.util.SQSMessageConsumer;
55
import com.amazonaws.services.sqs.util.SQSMessageConsumerBuilder;
6-
import org.junit.After;
7-
import org.junit.Before;
8-
import org.junit.Test;
6+
import org.junit.jupiter.api.AfterEach;
7+
import org.junit.jupiter.api.BeforeEach;
8+
import org.junit.jupiter.api.Test;
99
import software.amazon.awssdk.services.sqs.model.CreateQueueRequest;
1010
import software.amazon.awssdk.services.sqs.model.DeleteQueueRequest;
1111
import software.amazon.awssdk.services.sqs.model.Message;
@@ -16,7 +16,7 @@
1616
import java.util.UUID;
1717
import java.util.concurrent.TimeUnit;
1818

19-
import static org.junit.Assert.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
2020

2121
public class AmazonSQSResponsesClientCrossAccountIT extends IntegrationTest {
2222
private static AmazonSQSRequester sqsRequester;
@@ -28,7 +28,7 @@ protected String testSuiteName() {
2828
return "SQSXAccountResponsesClientIT";
2929
}
3030

31-
@Before
31+
@BeforeEach
3232
public void setup() {
3333
// Use the secondary role for the responder
3434
sqsResponder = new AmazonSQSResponderClient(getBuddyPrincipalClient());
@@ -43,7 +43,7 @@ public void setup() {
4343
requestQueueUrl = sqs.createQueue(createQueueRequest).queueUrl();
4444
}
4545

46-
@After
46+
@AfterEach
4747
public void teardown() {
4848
sqs.deleteQueue(DeleteQueueRequest.builder().queueUrl(requestQueueUrl).build());
4949
sqsResponder.shutdown();

0 commit comments

Comments
 (0)