Skip to content

Commit

Permalink
Review: Fix license header; stabilize unit tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Yufei Cai <yufei.cai@bosch.io>
  • Loading branch information
yufei-cai committed Nov 3, 2021
1 parent d90c7de commit a391b0d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Contributors to the Eclipse Foundation
* Copyright (c) 2021 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void reconnectsInConnectingStateIfFailureResponseReceived() {

@Test
public void reconnectsInConnectingStateAfterBackoffWhenMultipleFailuresAreReceived() {
// expect reconnects after 100ms + 200ms + 400ms + 400ms = 1100ms backoff in total
// expect reconnects after 100ms + 200ms + 400ms + 400ms = 1100ms
final long expectedTotalBackoffMs = 1100L;
reconnectsAfterBackoffWhenMultipleFailuresReceived(false, expectedTotalBackoffMs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Predicate;
Expand Down Expand Up @@ -472,22 +471,23 @@ public void testSetMessageListenerOnConsumerFails() throws JMSException {
amqpClientActor.tell(OpenConnection.of(CONNECTION_ID, DittoHeaders.empty()), getRef());
expectMsgClass(Status.Failure.class);

final AtomicInteger count = new AtomicInteger(20);
Awaitility.await()
.pollInterval(Duration.ofMillis(100))
.atMost(Duration.ofSeconds(5)).until(() -> {
amqpClientActor.tell(RetrieveConnectionStatus.of(CONNECTION_ID, DittoHeaders.empty()), getRef());
.atMost(Duration.ofSeconds(10))
.untilAsserted(() -> {
amqpClientActor.tell(RetrieveConnectionStatus.of(CONNECTION_ID, DittoHeaders.empty()),
getRef());
fishForMessage(Duration.ofSeconds(1), "client status", o -> {
if (o instanceof ResourceStatus) {
final ResourceStatus resourceStatus = (ResourceStatus) o;
if (resourceStatus.getResourceType() == ResourceStatus.ResourceType.CLIENT) {
assertThat((Object) resourceStatus.getStatus()).isEqualTo(ConnectivityStatus.MISCONFIGURED);
assertThat((Object) resourceStatus.getStatus())
.isEqualTo(ConnectivityStatus.MISCONFIGURED);
return true;
}
}
return false;
});
return count.decrementAndGet() == 0;
});
}};
}
Expand Down

0 comments on commit a391b0d

Please sign in to comment.