add java.time.Duration support for javadsl #24646
* add java.time.Duration support for askWithReplyto methods and add deprecated to method with akka Timeout as parameter type
This commit is contained in:
parent
b9aecb7f5a
commit
eb5885e94e
5 changed files with 95 additions and 9 deletions
|
|
@ -19,11 +19,9 @@ import org.junit.Before;
|
|||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.scalatest.junit.JUnitSuite;
|
||||
import scala.concurrent.duration.Duration;
|
||||
import scala.util.control.NoStackTrace;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
|
@ -145,7 +143,7 @@ public class LoggingAdapterTest extends JUnitSuite {
|
|||
}
|
||||
|
||||
void expectLog(final Object level, final String message, final Throwable cause, final String mdc) {
|
||||
expectMsgPF(Duration.create(3, TimeUnit.SECONDS), "LogEvent", event -> {
|
||||
expectMsgPF(Duration.ofSeconds(3), "LogEvent", event -> {
|
||||
LogEvent log = (LogEvent) event;
|
||||
assertEquals(message, log.message());
|
||||
assertEquals(level, log.level());
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class PatternsTest extends JUnitSuite {
|
|||
.askWithReplyTo(
|
||||
echo,
|
||||
replyTo -> new ExplicitAskTestActor.Message(expected, replyTo),
|
||||
Timeout.apply(3, SECONDS))
|
||||
Duration.ofSeconds(3))
|
||||
.thenApply(o -> (String)o);
|
||||
|
||||
final String actual = response.toCompletableFuture().get(3, SECONDS);
|
||||
|
|
@ -136,7 +136,8 @@ public class PatternsTest extends JUnitSuite {
|
|||
.askWithReplyTo(
|
||||
echo,
|
||||
replyTo -> new ExplicitAskTestActor.Message(expected, replyTo),
|
||||
3000)
|
||||
3000
|
||||
)
|
||||
.thenApply(o -> (String)o);
|
||||
|
||||
final String actual = response.toCompletableFuture().get(3, SECONDS);
|
||||
|
|
@ -153,7 +154,8 @@ public class PatternsTest extends JUnitSuite {
|
|||
.askWithReplyTo(
|
||||
selection,
|
||||
replyTo -> new ExplicitAskTestActor.Message(expected, replyTo),
|
||||
3000)
|
||||
3000
|
||||
)
|
||||
.thenApply(o -> (String)o);
|
||||
|
||||
final String actual = response.toCompletableFuture().get(3, SECONDS);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue