Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Nephery committed Aug 9, 2024
1 parent c416f4b commit e962828
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -170,9 +169,7 @@ private static void assertActualSubscriptionsAreCorrect(SpringCloudStreamContext
boolean addDestinationAsSubscriptionToQueue)
throws ApiException {
String msgVpnName = (String) context.getJcsmpSession().getProperty(JCSMPProperties.VPN_NAME);
Set<String> expectedSubscriptions = getExpectedQueueSubscriptions(
sempV2Api.monitor().getMsgVpnQueue(msgVpnName, queueName, null).getData().isDurable(),
addDestinationAsSubscriptionToQueue);
Set<String> expectedSubscriptions = getExpectedQueueSubscriptions(addDestinationAsSubscriptionToQueue);
List<MonitorMsgVpnQueueSubscription> actualSubscriptions =
sempV2Api.monitor().getMsgVpnQueueSubscriptions(msgVpnName, queueName, null, null, null, null).getData();

Expand All @@ -183,17 +180,14 @@ private static void assertActualSubscriptionsAreCorrect(SpringCloudStreamContext
assertEquals(expectedSubscriptions.size(), actualSubscriptions.size(), "Some subscriptions are missing");
}

private static Set<String> getExpectedQueueSubscriptions(boolean isDurableQueue,
boolean addDestinationAsSubscriptionToQueue) {
private static Set<String> getExpectedQueueSubscriptions(boolean addDestinationAsSubscriptionToQueue) {
if (addDestinationAsSubscriptionToQueue) {
Set<String> expectedSubscriptions = new HashSet<>();
expectedSubscriptions.add(DESTINATION);
expectedSubscriptions.addAll(Arrays.asList(ADDITIONAL_SUBSCRIPTIONS));
return expectedSubscriptions;
} else if (!isDurableQueue) {
return new HashSet<>(Arrays.asList(ADDITIONAL_SUBSCRIPTIONS));
} else {
return Collections.emptySet();
return new HashSet<>(Arrays.asList(ADDITIONAL_SUBSCRIPTIONS));
}
}
}

0 comments on commit e962828

Please sign in to comment.