Skip to content

Commit 357c88c

Browse files
committed
Bump test and build dependencies
1 parent 7270d5c commit 357c88c

File tree

4 files changed

+34
-39
lines changed

4 files changed

+34
-39
lines changed

pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@
6161
<httpclient.version>4.5.10</httpclient.version>
6262
<logback.version>1.2.3</logback.version>
6363
<junit.version>4.12</junit.version>
64-
<awaitility.version>3.1.6</awaitility.version>
65-
<bouncycastle.version>1.62</bouncycastle.version>
64+
<awaitility.version>4.0.1</awaitility.version>
65+
<bouncycastle.version>1.63</bouncycastle.version>
6666
<mockito.version>3.0.0</mockito.version>
67-
<assertj.version>3.12.2</assertj.version>
67+
<assertj.version>3.13.2</assertj.version>
6868

69-
<maven.javadoc.plugin.version>3.0.1</maven.javadoc.plugin.version>
69+
<maven.javadoc.plugin.version>3.1.1</maven.javadoc.plugin.version>
7070
<maven.release.plugin.version>2.5.3</maven.release.plugin.version>
7171
<versions.maven.plugin.version>2.3</versions.maven.plugin.version>
7272
<maven.resources.plugin.version>3.0.1</maven.resources.plugin.version>
@@ -75,9 +75,9 @@
7575
<groovy.all.version>2.4.8</groovy.all.version>
7676
<keytool.maven.plugin.version>1.5</keytool.maven.plugin.version>
7777
<build.helper.maven-plugin.version>1.12</build.helper.maven-plugin.version>
78-
<maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
79-
<maven.surefire.plugin.version>2.22.1</maven.surefire.plugin.version>
80-
<maven.failsafe.plugin.version>2.22.1</maven.failsafe.plugin.version>
78+
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
79+
<maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
80+
<maven.failsafe.plugin.version>2.22.2</maven.failsafe.plugin.version>
8181
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
8282
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
8383
<maven.bundle.plugin.version>2.3.7</maven.bundle.plugin.version>

src/test/java/com/rabbitmq/client/test/JavaNioTest.java

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
package com.rabbitmq.client.test;
22

33
import com.rabbitmq.client.*;
4-
import com.rabbitmq.client.impl.nio.BlockingQueueNioQueue;
5-
import com.rabbitmq.client.impl.nio.DefaultByteBufferFactory;
6-
import com.rabbitmq.client.impl.nio.NioContext;
7-
import com.rabbitmq.client.impl.nio.NioParams;
8-
import com.rabbitmq.client.impl.nio.NioQueue;
9-
import com.rabbitmq.client.impl.nio.NioQueueFactory;
10-
import com.rabbitmq.client.impl.nio.WriteRequest;
4+
import com.rabbitmq.client.impl.nio.*;
5+
import org.assertj.core.api.Condition;
116
import org.junit.After;
127
import org.junit.Before;
138
import org.junit.Test;
@@ -18,10 +13,8 @@
1813
import java.util.concurrent.*;
1914
import java.util.concurrent.atomic.AtomicInteger;
2015

21-
import static org.hamcrest.Matchers.hasSize;
22-
import static org.hamcrest.Matchers.isOneOf;
16+
import static org.assertj.core.api.Assertions.assertThat;
2317
import static org.junit.Assert.assertEquals;
24-
import static org.junit.Assert.assertThat;
2518
import static org.junit.Assert.assertTrue;
2619

2720
/**
@@ -129,19 +122,21 @@ public void shutdownCompleted(ShutdownSignalException cause) {
129122
public void nioLoopCleaning() throws Exception {
130123
ConnectionFactory connectionFactory = new ConnectionFactory();
131124
connectionFactory.useNio();
132-
for(int i = 0; i < 10; i++) {
125+
for (int i = 0; i < 10; i++) {
133126
Connection connection = connectionFactory.newConnection();
134127
connection.abort();
135128
}
136129
}
137130

138-
@Test public void messageSize() throws Exception {
131+
@Test
132+
public void messageSize() throws Exception {
139133
for (int i = 0; i < 50; i++) {
140134
sendAndVerifyMessage(testConnection, 76390);
141135
}
142136
}
143137

144-
@Test public void byteBufferFactory() throws Exception {
138+
@Test
139+
public void byteBufferFactory() throws Exception {
145140
ConnectionFactory cf = new ConnectionFactory();
146141
cf.useNio();
147142
int baseCapacity = 32768;
@@ -159,19 +154,19 @@ public ByteBuffer allocate(int capacity) {
159154
}
160155
})));
161156

162-
Connection c = cf.newConnection();
163-
try {
157+
try (Connection c = cf.newConnection()) {
164158
sendAndVerifyMessage(c, 100);
165-
} finally {
166-
TestUtils.close(c);
167159
}
168160

169-
assertThat(byteBuffers, hasSize(2));
170-
assertThat(byteBuffers.get(0).capacity(), isOneOf(nioParams.getReadByteBufferSize(), nioParams.getWriteByteBufferSize()));
171-
assertThat(byteBuffers.get(1).capacity(), isOneOf(nioParams.getReadByteBufferSize(), nioParams.getWriteByteBufferSize()));
161+
assertThat(byteBuffers).hasSize(2);
162+
Condition<Integer> condition = new Condition<>(c -> c == nioParams.getReadByteBufferSize() ||
163+
c == nioParams.getWriteByteBufferSize(), "capacity set by factory");
164+
assertThat(byteBuffers.get(0).capacity()).is(condition);
165+
assertThat(byteBuffers.get(1).capacity()).is(condition);
172166
}
173167

174-
@Test public void directByteBuffers() throws Exception {
168+
@Test
169+
public void directByteBuffers() throws Exception {
175170
ConnectionFactory cf = new ConnectionFactory();
176171
cf.useNio();
177172
cf.setNioParams(new NioParams().setByteBufferFactory(new DefaultByteBufferFactory(new DefaultByteBufferFactory.ByteBufferAllocator() {
@@ -189,7 +184,8 @@ public ByteBuffer allocate(int capacity) {
189184
}
190185
}
191186

192-
@Test public void customWriteQueue() throws Exception {
187+
@Test
188+
public void customWriteQueue() throws Exception {
193189
ConnectionFactory cf = new ConnectionFactory();
194190
cf.useNio();
195191
final AtomicInteger count = new AtomicInteger(0);
@@ -199,8 +195,8 @@ public ByteBuffer allocate(int capacity) {
199195
public NioQueue create(NioContext ctx) {
200196
count.incrementAndGet();
201197
return new BlockingQueueNioQueue(
202-
new LinkedBlockingQueue<WriteRequest>(ctx.getNioParams().getWriteQueueCapacity()),
203-
ctx.getNioParams().getWriteEnqueuingTimeoutInMs()
198+
new LinkedBlockingQueue<WriteRequest>(ctx.getNioParams().getWriteQueueCapacity()),
199+
ctx.getNioParams().getWriteEnqueuingTimeoutInMs()
204200
);
205201
}
206202
}));
@@ -220,7 +216,7 @@ private void sendAndVerifyMessage(Connection connection, int size) throws Except
220216
}
221217

222218
private Connection basicGetBasicConsume(ConnectionFactory connectionFactory, String queue, final CountDownLatch latch)
223-
throws IOException, TimeoutException {
219+
throws IOException, TimeoutException {
224220
Connection connection = connectionFactory.newConnection();
225221
Channel channel = connection.createChannel();
226222
channel.queueDeclare(queue, false, false, false, null);
@@ -240,7 +236,7 @@ public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProp
240236
}
241237

242238
private boolean basicGetBasicConsume(Connection connection, String queue, final CountDownLatch latch, int msgSize)
243-
throws Exception {
239+
throws Exception {
244240
Channel channel = connection.createChannel();
245241
channel.queueDeclare(queue, false, false, false, null);
246242
channel.queuePurge(queue);

src/test/java/com/rabbitmq/client/test/RpcTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@
3434
import com.rabbitmq.client.impl.recovery.RecordedQueue;
3535
import com.rabbitmq.client.impl.recovery.TopologyRecoveryFilter;
3636
import com.rabbitmq.tools.Host;
37-
import org.awaitility.Awaitility;
38-
import org.awaitility.Duration;
3937
import org.junit.After;
4038
import org.junit.Before;
4139
import org.junit.Test;
4240

4341
import java.io.IOException;
42+
import java.time.Duration;
4443
import java.util.HashMap;
4544
import java.util.Map;
4645
import java.util.UUID;
@@ -335,7 +334,7 @@ public void handleRecoveryStarted(Recoverable recoverable) {
335334

336335
serverThread.interrupt();
337336

338-
waitAtMost(Duration.ONE_SECOND).until(() -> !serverThread.isAlive()) ;
337+
waitAtMost(Duration.ofSeconds(1)).until(() -> !serverThread.isAlive()) ;
339338

340339
client.close();
341340
}

src/test/java/com/rabbitmq/client/test/functional/Metrics.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2007-Present Pivotal Software, Inc. All rights reserved.
1+
// Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved.
22
//
33
// This software, the RabbitMQ Java client library, is triple-licensed under the
44
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2
@@ -21,11 +21,11 @@
2121
import com.rabbitmq.client.test.BrokerTestCase;
2222
import com.rabbitmq.client.test.TestUtils;
2323
import com.rabbitmq.tools.Host;
24-
import org.awaitility.Duration;
2524
import org.junit.Test;
2625

2726
import java.io.IOException;
2827
import java.lang.reflect.Field;
28+
import java.time.Duration;
2929
import java.util.ArrayList;
3030
import java.util.Collection;
3131
import java.util.List;
@@ -616,7 +616,7 @@ private void sendMessage(Channel channel) throws IOException {
616616
}
617617

618618
private Duration timeout() {
619-
return new Duration(10, TimeUnit.SECONDS);
619+
return Duration.ofSeconds(10);
620620
}
621621

622622
private static class MultipleAckConsumer extends DefaultConsumer {

0 commit comments

Comments
 (0)