-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove UnicastProcessor from reply router when timeout triggers
- Loading branch information
Showing
5 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...c-commons/src/test/java/org/reactivecommons/async/impl/reply/ReactiveReplyRouterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.reactivecommons.async.impl.reply; | ||
|
||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
import org.reactivecommons.async.impl.communications.Message; | ||
import reactor.core.publisher.Mono; | ||
import reactor.test.StepVerifier; | ||
|
||
import java.time.Duration; | ||
import java.util.UUID; | ||
|
||
public class ReactiveReplyRouterTest { | ||
|
||
private ReactiveReplyRouter replyRouter = new ReactiveReplyRouter(); | ||
|
||
@Test | ||
public void shouldRouteReply(){ | ||
final String uuid = UUID.randomUUID().toString(); | ||
final Mono<Message> registered = replyRouter.register(uuid); | ||
|
||
Message message = Mockito.mock(Message.class); | ||
replyRouter.routeReply(uuid, message); | ||
|
||
StepVerifier.create(registered) | ||
.expectNext(message) | ||
.verifyComplete(); | ||
|
||
} | ||
|
||
@Test | ||
public void shouldRouteEmptyResponse(){ | ||
final String uuid = UUID.randomUUID().toString(); | ||
final Mono<Message> registered = replyRouter.register(uuid); | ||
|
||
replyRouter.routeEmpty(uuid); | ||
|
||
StepVerifier.create(registered) | ||
.verifyComplete(); | ||
} | ||
|
||
@Test | ||
public void shouldDeRegisterProcessor(){ | ||
final String uuid = UUID.randomUUID().toString(); | ||
final Mono<Message> registered = replyRouter.register(uuid); | ||
|
||
replyRouter.deregister(uuid); | ||
replyRouter.routeEmpty(uuid); | ||
|
||
StepVerifier.create(registered.timeout(Duration.ofSeconds(1))) | ||
.expectTimeout(Duration.ofSeconds(3)).verify(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version=1.0.0-beta2 | ||
version=1.0.0-beta3 | ||
springBootVersion=2.2.9.RELEASE | ||
gradleVersionsVersion=0.28.0 | ||
reactorRabbitVersion=1.5.0 |