Merge branch 'master' into 2.0.x

This commit is contained in:
Marcin Grzejszczak
2017-06-26 14:36:10 +02:00
2 changed files with 18 additions and 4 deletions

View File

@@ -165,13 +165,11 @@ public class AetherStubDownloader implements StubDownloader {
throw ise;
}
catch (Exception e) {
//TODO: Start throwing this exception instead of returning null
log.warn(
throw new IllegalStateException(
"Exception occurred while trying to download a stub for group ["
+ stubsGroup + "] module [" + stubsModule
+ "] and classifier [" + classifier + "] in " + this.remoteRepos,
e);
return null;
}
}

View File

@@ -11,7 +11,7 @@ import spock.util.environment.RestoreSystemProperties
class AetherStubDownloaderSpec extends Specification {
@Rule
HoverflyRule hoverflyRule = HoverflyRule.inCaptureMode("simulation.json")
HoverflyRule hoverflyRule = HoverflyRule.inSimulationMode("simulation.json")
def 'Should be able to download from a repository using username and password authentication'() {
given:
@@ -31,6 +31,22 @@ class AetherStubDownloaderSpec extends Specification {
jar != null
}
def 'Should throw an exception when artifact not found'() {
given:
StubRunnerOptions stubRunnerOptions = new StubRunnerOptionsBuilder()
.withWorkOffline(true)
.build()
AetherStubDownloader aetherStubDownloader = new AetherStubDownloader(stubRunnerOptions)
when:
def jar = aetherStubDownloader.downloadAndUnpackStubJar(new StubConfiguration("non.existing.group", "missing-artifact-id", "1.0-SNAPSHOT"))
then:
IllegalStateException e = thrown(IllegalStateException)
e.message.contains("Exception occurred while trying to download a stub for group")
}
def 'Should throw an exception when a jar is in local m2 and not in remote repo'() {
given:
StubRunnerOptions stubRunnerOptions = new StubRunnerOptionsBuilder()