Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.atlassian.crowd.manager.property.PropertyManager;
import com.atlassian.crowd.manager.property.PropertyManagerException;
import com.deftdevs.bootstrapi.crowd.service.api.TrustedProxiesService;
import com.google.common.collect.ImmutableSet;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -66,7 +66,7 @@ private Set<String> getTrustedProxiesInternal() {
final String trustedProxyServers = this.propertyManager.getTrustedProxyServers();
if (!StringUtils.isBlank(trustedProxyServers)) {
final String[] trustedProxyServerStrings = StringUtils.split(trustedProxyServers, SEPARATOR);
return ImmutableSet.copyOf(trustedProxyServerStrings);
return Set.copyOf(Arrays.asList(trustedProxyServerStrings));
}
} catch (PropertyManagerException ignored) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.atlassian.crowd.manager.property.PropertyManager;
import com.atlassian.crowd.manager.property.PropertyManagerException;
import com.google.common.collect.ImmutableSet;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -14,9 +13,12 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static com.deftdevs.bootstrapi.crowd.service.TrustedProxiesServiceImpl.SEPARATOR;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.lenient;

Expand All @@ -41,7 +43,7 @@ public void setup() throws PropertyManagerException {
lenient().doAnswer(invocation -> {
final String[] trustedProxiesStrings = StringUtils.split((String) invocation.getArguments()[0], SEPARATOR);
trustedProxies.clear();
trustedProxies.addAll(ImmutableSet.copyOf(trustedProxiesStrings));
trustedProxies.addAll(Set.copyOf(Arrays.asList(trustedProxiesStrings)));
return null; // return null since the method is void
}).when(propertyManager).setTrustedProxyServers(anyString());

Expand Down