use of org.apache.maven.settings.Mirror in project indy by Commonjava.
the class SettingsGeneratedForRemoteRepoTest method generateSettingsXml.
@Test
public void generateSettingsXml() throws Exception {
final IndyClientHttp http = getHttp();
// all mavdav requests are siblings of the default base-url suffix '/api/'
final String url = getDotMavenUrl("settings/remote/settings-central.xml");
System.out.println("Requesting: " + url);
final HttpResources resources = http.getRaw(new HttpGet(url));
InputStream stream = null;
Settings settings = null;
try {
stream = resources.getResponseStream();
settings = new SettingsXpp3Reader().read(stream);
} finally {
closeQuietly(stream);
closeQuietly(resources);
}
assertThat(settings.getLocalRepository(), equalTo("${user.home}/.m2/repo-remote-central"));
assertThat(settings.getMirrors(), notNullValue());
assertThat(settings.getMirrors().size(), equalTo(1));
final Mirror mirror = settings.getMirrors().get(0);
assertThat(mirror.getUrl(), equalTo(http.toIndyUrl("remote/central")));
}
Aggregations