Skip to content

Commit 97f8ae3

Browse files
author
Daniel Bustamante Ospina
authored
Merge pull request #50 from reactive-commons/chore/upgrade-dependencies
chore: upgrade dependencies
2 parents 8ee9872 + bc8b4be commit 97f8ae3

File tree

46 files changed

+298
-476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+298
-476
lines changed

acceptance/async-tests/src/test/java/org/reactivecommons/test/CommandsProcessPerfTest.java

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
package org.reactivecommons.test;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
4-
import com.fasterxml.jackson.databind.ObjectMapper;
5-
import com.rabbitmq.client.AMQP;
6-
import com.rabbitmq.client.Delivery;
7-
import com.rabbitmq.client.Envelope;
83
import org.assertj.core.api.Assertions;
9-
import org.junit.Test;
10-
import org.junit.runner.RunWith;
4+
import org.junit.jupiter.api.Test;
115
import org.reactivecommons.api.domain.Command;
12-
import org.reactivecommons.async.api.AsyncQuery;
136
import org.reactivecommons.async.api.DirectAsyncGateway;
147
import org.reactivecommons.async.api.HandlerRegistry;
15-
import org.reactivecommons.async.api.handlers.CommandHandler;
168
import org.reactivecommons.async.impl.config.annotations.EnableDirectAsyncGateway;
179
import org.reactivecommons.async.impl.config.annotations.EnableMessageListeners;
1810
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,32 +13,17 @@
2113
import org.springframework.boot.autoconfigure.SpringBootApplication;
2214
import org.springframework.boot.test.context.SpringBootTest;
2315
import org.springframework.context.annotation.Bean;
24-
import org.springframework.test.context.junit4.SpringRunner;
2516
import reactor.core.publisher.Flux;
2617
import reactor.core.publisher.Mono;
27-
import reactor.core.publisher.UnicastProcessor;
28-
import reactor.core.scheduler.Schedulers;
29-
import reactor.rabbitmq.AcknowledgableDelivery;
30-
import reactor.test.StepVerifier;
31-
32-
import java.time.Duration;
33-
import java.util.ArrayList;
34-
import java.util.List;
18+
3519
import java.util.Map;
3620
import java.util.UUID;
3721
import java.util.concurrent.CountDownLatch;
3822
import java.util.concurrent.Semaphore;
39-
import java.util.concurrent.ThreadLocalRandom;
40-
import java.util.stream.Collectors;
41-
import java.util.stream.IntStream;
4223

43-
import static org.assertj.core.api.Assertions.assertThat;
4424
import static reactor.core.publisher.Flux.range;
45-
import static reactor.core.publisher.Mono.empty;
46-
import static reactor.core.publisher.Mono.just;
4725

4826
@SpringBootTest
49-
@RunWith(SpringRunner.class)
5027
public class CommandsProcessPerfTest {
5128

5229
private static final String COMMAND_NAME = "app.command.test";
@@ -74,7 +51,7 @@ public void commandShouldArrive() throws InterruptedException {
7451
final long end = System.currentTimeMillis();
7552

7653
final long total = end - init;
77-
final double microsPerMessage = ((total+0.0)/messageCount)*1000;
54+
final double microsPerMessage = ((total + 0.0) / messageCount) * 1000;
7855
System.out.println("Message count: " + messageCount);
7956
System.out.println("Total Execution Time: " + total + "ms");
8057
System.out.println("Microseconds per message: " + microsPerMessage + "us");
@@ -96,7 +73,7 @@ private void createMessages(int count) throws InterruptedException {
9673
@SpringBootApplication
9774
@EnableDirectAsyncGateway
9875
@EnableMessageListeners
99-
static class App{
76+
static class App {
10077
public static void main(String[] args) {
10178
SpringApplication.run(App.class, args);
10279
}
@@ -105,7 +82,7 @@ public static void main(String[] args) {
10582
public HandlerRegistry registry() {
10683
final HandlerRegistry registry = range(0, 20).reduce(HandlerRegistry.register(), (r, i) -> r.handleCommand("app.command.name" + i, message -> Mono.empty(), Map.class)).block();
10784
return registry
108-
.handleCommand(COMMAND_NAME, this::handleSimple, DummyMessage.class);
85+
.handleCommand(COMMAND_NAME, this::handleSimple, DummyMessage.class);
10986
}
11087

11188
private Mono<Void> handleSimple(Command<DummyMessage> message) {

acceptance/async-tests/src/test/java/org/reactivecommons/test/DirectGatewayPerfTest.java

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
11
package org.reactivecommons.test;
22

33
import org.assertj.core.api.Assertions;
4-
import org.junit.Test;
5-
import org.junit.runner.RunWith;
4+
import org.junit.jupiter.api.Test;
65
import org.reactivecommons.api.domain.Command;
7-
import org.reactivecommons.async.api.DirectAsyncGateway;
8-
import org.reactivecommons.async.api.HandlerRegistry;
96
import org.reactivecommons.async.impl.RabbitDirectAsyncGateway;
107
import org.reactivecommons.async.impl.config.annotations.EnableDirectAsyncGateway;
11-
import org.reactivecommons.async.impl.config.annotations.EnableMessageListeners;
128
import org.springframework.beans.factory.annotation.Autowired;
139
import org.springframework.beans.factory.annotation.Value;
1410
import org.springframework.boot.SpringApplication;
1511
import org.springframework.boot.autoconfigure.SpringBootApplication;
1612
import org.springframework.boot.test.context.SpringBootTest;
17-
import org.springframework.context.annotation.Bean;
18-
import org.springframework.test.context.junit4.SpringRunner;
1913
import reactor.core.publisher.Flux;
2014
import reactor.core.publisher.Mono;
2115

2216
import java.util.ArrayList;
2317
import java.util.List;
24-
import java.util.Map;
2518
import java.util.UUID;
26-
import java.util.concurrent.CountDownLatch;
2719
import java.util.concurrent.Semaphore;
2820
import java.util.stream.Collectors;
2921
import java.util.stream.IntStream;
3022

31-
import static reactor.core.publisher.Flux.range;
32-
3323
@SpringBootTest
34-
@RunWith(SpringRunner.class)
3524
public class DirectGatewayPerfTest {
3625

3726
private static final String COMMAND_NAME = "app.command.test";
@@ -49,8 +38,8 @@ public class DirectGatewayPerfTest {
4938
public void shouldSendInOptimalTime() throws InterruptedException {
5039
final Flux<Command<DummyMessage>> messages = createMessages(messageCount);
5140
final Flux<Void> target = messages.flatMap(dummyMessageCommand ->
52-
gateway.sendCommand(dummyMessageCommand, appName)
53-
.doOnSuccess(aVoid -> semaphore.release()));
41+
gateway.sendCommand(dummyMessageCommand, appName)
42+
.doOnSuccess(aVoid -> semaphore.release()));
5443

5544
final long init = System.currentTimeMillis();
5645
target.subscribe();
@@ -78,7 +67,7 @@ public void shouldSendBatchInOptimalTime1Channel() throws InterruptedException {
7867
private void shouldSendBatchInOptimalTimeNChannels(int channels) throws InterruptedException {
7968
List<Mono<Void>> subs = new ArrayList<>(channels);
8069
for (int i = 0; i < channels; ++i) {
81-
final Flux<Command<DummyMessage>> messages = createMessages(messageCount/channels);
70+
final Flux<Command<DummyMessage>> messages = createMessages(messageCount / channels);
8271
final Mono<Void> target = gateway.sendCommands(messages, appName).then().doOnSuccess(_v -> semaphore.release());
8372
subs.add(target);
8473
}
@@ -94,11 +83,11 @@ private void shouldSendBatchInOptimalTimeNChannels(int channels) throws Interrup
9483
}
9584

9685
private void assertMessageThroughput(long total, long messageCount, int reqMicrosPerMessage) {
97-
final double microsPerMessage = ((total+0.0)/messageCount)*1000;
86+
final double microsPerMessage = ((total + 0.0) / messageCount) * 1000;
9887
System.out.println("Message count: " + messageCount);
9988
System.out.println("Total Execution Time: " + total + "ms");
10089
System.out.println("Microseconds per message: " + microsPerMessage + "us");
101-
System.out.println("Throughput: " + Math.round(messageCount/(total/1000.0)) + " Msg/Seg");
90+
System.out.println("Throughput: " + Math.round(messageCount / (total / 1000.0)) + " Msg/Seg");
10291
Assertions.assertThat(microsPerMessage).isLessThan(reqMicrosPerMessage);
10392
}
10493

@@ -109,7 +98,7 @@ private Flux<Command<DummyMessage>> createMessages(int count) {
10998

11099
@SpringBootApplication
111100
@EnableDirectAsyncGateway
112-
static class App{
101+
static class App {
113102
public static void main(String[] args) {
114103
SpringApplication.run(App.class, args);
115104
}

acceptance/async-tests/src/test/java/org/reactivecommons/test/DynamicRegistryTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.reactivecommons.test;
22

3-
import org.junit.Test;
4-
import org.junit.runner.RunWith;
3+
import org.junit.jupiter.api.Test;
54
import org.reactivecommons.api.domain.DomainEvent;
65
import org.reactivecommons.api.domain.DomainEventBus;
76
import org.reactivecommons.async.api.DynamicRegistry;
@@ -14,16 +13,15 @@
1413
import org.springframework.boot.SpringApplication;
1514
import org.springframework.boot.autoconfigure.SpringBootApplication;
1615
import org.springframework.boot.test.context.SpringBootTest;
17-
import org.springframework.test.context.junit4.SpringRunner;
1816
import reactor.core.publisher.UnicastProcessor;
1917
import reactor.test.StepVerifier;
2018

2119
import java.time.Duration;
2220

23-
import static reactor.core.publisher.Mono.*;
21+
import static reactor.core.publisher.Mono.from;
22+
import static reactor.core.publisher.Mono.fromRunnable;
2423

2524
@SpringBootTest
26-
@RunWith(SpringRunner.class)
2725
public class DynamicRegistryTest {
2826

2927
@Autowired
@@ -45,8 +43,8 @@ public void shouldReceiveResponse() {
4543
from(emit).block();
4644

4745
StepVerifier.create(result.next().timeout(Duration.ofSeconds(10)))
48-
.expectNext("Hello")
49-
.verifyComplete();
46+
.expectNext("Hello")
47+
.verifyComplete();
5048

5149

5250
}
@@ -55,7 +53,7 @@ public void shouldReceiveResponse() {
5553
@SpringBootApplication
5654
@EnableMessageListeners
5755
@EnableDomainEventBus
58-
static class App{
56+
static class App {
5957
public static void main(String[] args) {
6058
SpringApplication.run(App.class, args);
6159
}

acceptance/async-tests/src/test/java/org/reactivecommons/test/QueryProcessPerfTest.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.reactivecommons.test;
22

33
import org.assertj.core.api.Assertions;
4-
import org.junit.Test;
5-
import org.junit.runner.RunWith;
6-
import org.reactivecommons.api.domain.Command;
4+
import org.junit.jupiter.api.Test;
75
import org.reactivecommons.async.api.AsyncQuery;
86
import org.reactivecommons.async.api.DirectAsyncGateway;
97
import org.reactivecommons.async.api.HandlerRegistry;
@@ -15,13 +13,11 @@
1513
import org.springframework.boot.autoconfigure.SpringBootApplication;
1614
import org.springframework.boot.test.context.SpringBootTest;
1715
import org.springframework.context.annotation.Bean;
18-
import org.springframework.test.context.junit4.SpringRunner;
1916
import reactor.core.publisher.Flux;
2017
import reactor.core.publisher.Mono;
2118

2219
import java.util.List;
2320
import java.util.Map;
24-
import java.util.UUID;
2521
import java.util.concurrent.CountDownLatch;
2622
import java.util.concurrent.Semaphore;
2723
import java.util.concurrent.atomic.AtomicLong;
@@ -31,7 +27,6 @@
3127
import static reactor.core.publisher.Flux.range;
3228

3329
@SpringBootTest
34-
@RunWith(SpringRunner.class)
3530
public class QueryProcessPerfTest {
3631

3732
private static final String QUERY_NAME = "app.command.test";
@@ -53,10 +48,10 @@ public void serveQueryPerformanceTest() throws InterruptedException {
5348

5449
final long init = System.currentTimeMillis();
5550
messages
56-
.flatMap(dummyMessageAsyncQuery -> gateway.requestReply(dummyMessageAsyncQuery, appName, DummyMessage.class)
57-
.doOnNext(s -> semaphore.release())
58-
)
59-
.subscribe();
51+
.flatMap(dummyMessageAsyncQuery -> gateway.requestReply(dummyMessageAsyncQuery, appName, DummyMessage.class)
52+
.doOnNext(s -> semaphore.release())
53+
)
54+
.subscribe();
6055
semaphore.acquire(messageCount);
6156
final long end = System.currentTimeMillis();
6257

@@ -65,11 +60,11 @@ public void serveQueryPerformanceTest() throws InterruptedException {
6560
}
6661

6762
private void assertMessageThroughput(long total, long messageCount, int reqMicrosPerMessage) {
68-
final double microsPerMessage = ((total+0.0)/messageCount)*1000;
63+
final double microsPerMessage = ((total + 0.0) / messageCount) * 1000;
6964
System.out.println("Message count: " + messageCount);
7065
System.out.println("Total Execution Time: " + total + "ms");
7166
System.out.println("Microseconds per message: " + microsPerMessage + "us");
72-
System.out.println("Throughput: " + Math.round(messageCount/(total/1000.0)) + " Msg/Seg");
67+
System.out.println("Throughput: " + Math.round(messageCount / (total / 1000.0)) + " Msg/Seg");
7368
Assertions.assertThat(microsPerMessage).isLessThan(reqMicrosPerMessage);
7469
}
7570

@@ -83,7 +78,7 @@ private Flux<AsyncQuery<DummyMessage>> createMessages(int count) {
8378
@SpringBootApplication
8479
@EnableDirectAsyncGateway
8580
@EnableMessageListeners
86-
static class App{
81+
static class App {
8782
public static void main(String[] args) {
8883
SpringApplication.run(App.class, args);
8984
}
@@ -92,7 +87,7 @@ public static void main(String[] args) {
9287
public HandlerRegistry registry() {
9388
final HandlerRegistry registry = range(0, 20).reduce(HandlerRegistry.register(), (r, i) -> r.handleCommand("app.command.name" + i, message -> Mono.empty(), Map.class)).block();
9489
return registry
95-
.serveQuery(QUERY_NAME, this::handleSimple, DummyMessage.class);
90+
.serveQuery(QUERY_NAME, this::handleSimple, DummyMessage.class);
9691
}
9792

9893
private Mono<DummyMessage> handleSimple(DummyMessage message) {

acceptance/async-tests/src/test/java/org/reactivecommons/test/SimpleDirectCommunicationTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.reactivecommons.test;
22

3-
import org.junit.Test;
4-
import org.junit.runner.RunWith;
3+
import org.junit.jupiter.api.Test;
54
import org.reactivecommons.api.domain.Command;
65
import org.reactivecommons.async.api.AsyncQuery;
76
import org.reactivecommons.async.api.DirectAsyncGateway;
@@ -27,7 +26,6 @@
2726
import static reactor.core.publisher.Mono.*;
2827

2928
@SpringBootTest
30-
@RunWith(SpringRunner.class)
3129
public class SimpleDirectCommunicationTest {
3230

3331
private static final String COMMAND_NAME = "simpleTestCommand";

acceptance/async-tests/src/test/java/org/reactivecommons/test/SimpleEventNotificationTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.reactivecommons.test;
22

3-
import org.junit.Test;
4-
import org.junit.runner.RunWith;
3+
import org.junit.jupiter.api.Test;
54
import org.reactivecommons.api.domain.DomainEvent;
65
import org.reactivecommons.api.domain.DomainEventBus;
76
import org.reactivecommons.async.api.HandlerRegistry;
@@ -23,7 +22,6 @@
2322
import static reactor.core.publisher.Mono.*;
2423

2524
@SpringBootTest
26-
@RunWith(SpringRunner.class)
2725
public class SimpleEventNotificationTest {
2826

2927
private static final String EVENT_NAME = "simpleTestEvent";
@@ -42,26 +40,25 @@ public void shouldReceiveEvent() throws InterruptedException {
4240
DomainEvent<?> event = new DomainEvent<>(EVENT_NAME, eventId, data);
4341
from(eventBus.emit(event)).subscribe();
4442
StepVerifier.create(listener.take(1)).assertNext(evt ->
45-
assertThat(evt).extracting(DomainEvent::getName, DomainEvent::getEventId, DomainEvent::getData)
46-
.containsExactly(EVENT_NAME, eventId, data)
43+
assertThat(evt).extracting(DomainEvent::getName, DomainEvent::getEventId, DomainEvent::getData)
44+
.containsExactly(EVENT_NAME, eventId, data)
4745
).verifyComplete();
4846
}
4947

5048

51-
5249
@SpringBootApplication
5350
@EnableDomainEventBus
5451
@EnableMessageListeners
55-
static class App{
52+
static class App {
5653
public static void main(String[] args) {
5754
SpringApplication.run(App.class, args);
5855
}
5956

6057
@Bean
61-
public HandlerRegistry registry(UnicastProcessor<DomainEvent<Long>> listener) {
58+
public HandlerRegistry registry(UnicastProcessor<DomainEvent<Long>> listener) {
6259
return HandlerRegistry.register()
63-
.serveQuery("double", rqt -> just(rqt*2), Long.class)
64-
.listenEvent(EVENT_NAME, handle(listener), Long.class);
60+
.serveQuery("double", rqt -> just(rqt * 2), Long.class)
61+
.listenEvent(EVENT_NAME, handle(listener), Long.class);
6562
}
6663

6764
@Bean

0 commit comments

Comments
 (0)