Skip to content

Commit f7d5304

Browse files
committed
fixed unit test
1 parent 345ff3d commit f7d5304

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

connectivity/service/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ jmh-generator-annprocess). jmh-generator-annprocess overwrites the whole META-IN
175175
</dependency>
176176

177177
<!-- ### Testing ### -->
178+
<dependency>
179+
<groupId>ch.qos.logback</groupId>
180+
<artifactId>logback-classic</artifactId>
181+
<scope>test</scope>
182+
</dependency>
178183
<dependency>
179184
<groupId>org.openjdk.jmh</groupId>
180185
<artifactId>jmh-generator-annprocess</artifactId>

connectivity/service/src/test/java/org/eclipse/ditto/connectivity/service/messaging/OutboundMappingProcessorActorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
import static org.assertj.core.api.Assertions.assertThat;
1616

17+
import java.time.Duration;
1718
import java.time.Instant;
1819
import java.util.Collection;
1920
import java.util.List;
2021
import java.util.Map;
2122
import java.util.Set;
2223

24+
import org.apache.pekko.actor.ActorRef;
25+
import org.apache.pekko.actor.Props;
26+
import org.apache.pekko.testkit.TestProbe;
27+
import org.apache.pekko.testkit.javadsl.TestKit;
2328
import org.eclipse.ditto.base.model.acks.AcknowledgementLabel;
2429
import org.eclipse.ditto.base.model.acks.AcknowledgementRequest;
2530
import org.eclipse.ditto.base.model.auth.AuthorizationContext;
@@ -58,11 +63,6 @@
5863
import org.junit.Test;
5964
import org.junit.runners.MethodSorters;
6065

61-
import org.apache.pekko.actor.ActorRef;
62-
import org.apache.pekko.actor.Props;
63-
import org.apache.pekko.testkit.TestProbe;
64-
import org.apache.pekko.testkit.javadsl.TestKit;
65-
6666
/**
6767
* Tests in addition to {@link MessageMappingProcessorActorTest}
6868
* for {@link OutboundMappingProcessorActor} only.
@@ -144,7 +144,7 @@ public void eventsWithFailedEnrichmentIssueFailedAcks() {
144144
underTest.tell(outboundSignal, getRef());
145145
proxyActorProbe.expectMsgClass(RetrieveThing.class);
146146

147-
final Acknowledgements acks = expectMsgClass(Acknowledgements.class);
147+
final Acknowledgements acks = expectMsgClass(Duration.ofSeconds(5), Acknowledgements.class);
148148
final List<String> fackLabels = acks.getFailedAcknowledgements()
149149
.stream()
150150
.map(ack -> ack.getLabel().toString())

internal/utils/cache-loaders/src/main/java/org/eclipse/ditto/internal/utils/cacheloaders/AskWithRetry.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import java.util.Optional;
1919
import java.util.concurrent.Callable;
2020
import java.util.concurrent.CompletableFuture;
21+
import java.util.concurrent.CompletionException;
2122
import java.util.concurrent.CompletionStage;
2223
import java.util.concurrent.Executor;
2324
import java.util.function.BiFunction;
@@ -340,12 +341,15 @@ private static <A> BiFunction<AskResult<A>, Throwable, A> handleRetryResult(
340341

341342
return (askResult, throwable) -> {
342343
if (null != throwable) {
343-
final Throwable cause;
344-
if (throwable instanceof UnknownAskRuntimeException) {
345-
cause = throwable.getCause();
344+
Throwable cause;
345+
if (throwable instanceof CompletionException ce) {
346+
cause = ce.getCause();
346347
} else {
347348
cause = throwable;
348349
}
350+
if (cause instanceof UnknownAskRuntimeException) {
351+
cause = cause.getCause();
352+
}
349353
throw DittoRuntimeException.asDittoRuntimeException(cause,
350354
t -> {
351355
final DittoRuntimeExceptionBuilder<AskException> exceptionBuilder =

0 commit comments

Comments
 (0)