use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class SetBackSettingsManagerTest method settingsForSingleRemoteRepository_NoGroups.
@Test
public void settingsForSingleRemoteRepository_NoGroups() throws Exception {
final RemoteRepository remote = new RemoteRepository(MAVEN_PKG_KEY, "test", "http://foo.bar/");
remote.setDescription("Test Repository");
store(remote);
final StoreKey key = remote.getKey();
final List<String> lines = generateSettings(key);
assertThat("No repository with id: " + remote.getName() + " found in settings.xml", lines.contains("<id>" + remote.getName() + "</id>"), equalTo(true));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class SetBackSettingsManagerTest method settingsForSingleRemoteRepository_GenerateDeleteAndProveNonExistent.
@Test
public void settingsForSingleRemoteRepository_GenerateDeleteAndProveNonExistent() throws Exception {
final RemoteRepository remote = new RemoteRepository(MAVEN_PKG_KEY, "test", "http://foo.bar/");
remote.setDescription("Test Repository");
store(remote);
final StoreKey key = remote.getKey();
final List<String> lines = generateSettings(key);
assertThat("No repository with id: " + remote.getName() + " found in settings.xml", lines.contains("<id>" + remote.getName() + "</id>"), equalTo(true));
final ArtifactStore store = storeManager.getArtifactStore(key);
manager.deleteStoreSettings(store);
assertThat("Settings.xml for: " + key + " should have been deleted!", manager.getSetBackSettings(key), nullValue());
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class SetBackSettingsManagerTest method settingsForSingleRemoteRepository_GenerateSpawnsGroupGeneration.
@Test
public void settingsForSingleRemoteRepository_GenerateSpawnsGroupGeneration() throws Exception {
final RemoteRepository remote = new RemoteRepository(MAVEN_PKG_KEY, "test", "http://foo.bar/");
remote.setDescription("Test Repository");
store(remote);
final StoreKey key = remote.getKey();
final Group group = new Group(MAVEN_PKG_KEY, "test-group", key);
store(group);
assertThat(readSettings(group.getKey(), false), equalTo(null));
List<String> lines = generateSettings(key);
assertThat("No repository with id: " + remote.getName() + " found in settings.xml for remote!", lines.contains("<id>" + remote.getName() + "</id>"), equalTo(true));
lines = readSettings(group.getKey(), true);
assertThat("No repository with id: " + remote.getName() + " found in settings.xml for group!", lines.contains("<id>" + remote.getName() + "</id>"), equalTo(true));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class PomDownloadListenerTest method run.
@Test
public void run() throws Exception {
final String repo1 = "repo1";
server.expect(server.formatUrl(repo1, path), 200, content);
RemoteRepository remote1 = new RemoteRepository(repo1, server.formatUrl(repo1));
client.stores().create(remote1, "adding remote", RemoteRepository.class);
try (InputStream is = client.content().get(remote, repo1, path)) {
assertThat(is, notNullValue());
String s = IOUtils.toString(is);
assertThat(s, equalTo(content));
}
waitForEventPropagation();
boolean exists = client.content().exists(remote, repo1, pathRel, true);
assertThat(exists, equalTo(true));
// check .rel content is not empty
InputStream ris = client.content().get(remote, repo1, pathRel);
String rel = IOUtils.toString(ris);
logger.debug(">>> " + rel);
assertThat(StringUtils.isNotEmpty(rel), equalTo(true));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class PomDownloadSimpleDepTest method run.
@Test
public void run() throws Exception {
String depPom = readTestResource(repo + "/" + pathDep);
server.expect(server.formatUrl(repo1, pathDep), 200, depPom);
String consumerPom = readTestResource(repo + "/" + pathConsumer);
server.expect(server.formatUrl(repo1, pathConsumer), 200, consumerPom);
// Create remote repository
RemoteRepository remote1 = new RemoteRepository(repo1, server.formatUrl(repo1));
client.stores().create(remote1, "adding remote1", RemoteRepository.class);
// Add to a group
client.stores().create(new Group(group1, remote1.getKey()), "adding group", Group.class);
// Get consumer pom via group
InputStream is = client.content().get(group, group1, pathConsumer);
String s = IOUtils.toString(is);
logger.debug(">>> " + s);
assertThat(s, equalTo(consumerPom));
waitForEventPropagation();
boolean exists = false;
// Check consumer pom exists on group
exists = client.content().exists(group, group1, pathConsumer, true);
assertThat(exists, equalTo(true));
// Check consumer rel exists on group
exists = client.content().exists(group, group1, pathConsumerRel);
assertThat(exists, equalTo(true));
// Check consumer rel exists on remote
exists = client.content().exists(remote, repo1, pathConsumerRel, true);
assertThat(exists, equalTo(true));
// Check consumer rel content is not empty via group
InputStream ris = client.content().get(group, group1, pathConsumerRel);
String rel = IOUtils.toString(ris);
logger.debug(">>> " + rel);
assertThat(StringUtils.isNotEmpty(rel), equalTo(true));
// Check consumer rel output
String output = readTestResource(resource + "/output/rel.json");
EProjectDirectRelationships eRel = mapper.readValue(rel, EProjectDirectRelationships.class);
EProjectDirectRelationships eRelOutput = mapper.readValue(output, EProjectDirectRelationships.class);
assertThat(eRel.getDependencies(), equalTo(eRelOutput.getDependencies()));
}
Aggregations