Ensure a JreProxySelector is applied as a fallback

The issue was that the JreProxySelector was only applied
if the existing selector was null, but that hasn't been the case
since we added supporty for settings.xml. The strategy now is to
fallback to a JreProxySelector if the existing one is null
or not already a composite. Fixes gh-914.
This commit is contained in:
Dave Syer
2014-05-22 17:35:55 +01:00
parent bb85a52c38
commit 0e2f9e74db
3 changed files with 67 additions and 2 deletions

View File

@@ -23,10 +23,13 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.junit.Test;
import org.springframework.boot.cli.compiler.DependencyResolutionContext;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Tests for {@link AetherGrapeEngine}.
@@ -52,6 +55,14 @@ public class AetherGrapeEngineTests {
assertEquals(6, this.groovyClassLoader.getURLs().length);
}
@Test
public void proxySelector() {
DefaultRepositorySystemSession session = (DefaultRepositorySystemSession) ReflectionTestUtils
.getField(this.grapeEngine, "session");
assertTrue((session.getProxySelector() instanceof CompositeProxySelector)
|| (session.getProxySelector() instanceof JreProxySelector));
}
@SuppressWarnings("unchecked")
@Test
public void dependencyResolutionWithExclusions() {