use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class AddAndRetrieveRemoteRepoTest method addMinimalRemoteRepositoryAndRetrieveIt.
@Test
public void addMinimalRemoteRepositoryAndRetrieveIt() throws Exception {
final RemoteRepository rr = new RemoteRepository(newName(), "http://www.foo.com");
final RemoteRepository result = client.stores().create(rr, name.getMethodName(), RemoteRepository.class);
assertThat(result.getName(), equalTo(rr.getName()));
assertThat(result.getUrl(), equalTo(rr.getUrl()));
assertThat(result.equals(rr), equalTo(true));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class ListStoresByTypeTest method listByType.
@Test
public void listByType() throws Exception {
final Set<ArtifactStore> hosteds = new HashSet<>();
for (int i = 0; i < 3; i++) {
final HostedRepository repo = new HostedRepository(newName());
assertThat(client.stores().create(repo, name.getMethodName(), HostedRepository.class), notNullValue());
hosteds.add(repo);
}
final Set<ArtifactStore> remotes = new HashSet<>();
for (int i = 0; i < 3; i++) {
final RemoteRepository repo = new RemoteRepository(newName(), newUrl());
assertThat(client.stores().create(repo, name.getMethodName(), RemoteRepository.class), notNullValue());
remotes.add(repo);
}
final Set<ArtifactStore> groups = new HashSet<>();
for (int i = 0; i < 3; i++) {
final Group repo = new Group(newName());
assertThat(client.stores().create(repo, name.getMethodName(), Group.class), notNullValue());
groups.add(repo);
}
// Now, start listing by type and verify that ONLY those of the given type are present
checkListing(client.stores().listHostedRepositories(), hosteds, Arrays.asList(remotes, groups));
checkListing(client.stores().listRemoteRepositories(), remotes, Arrays.asList(groups, hosteds));
checkListing(client.stores().listGroups(), groups, Arrays.asList(hosteds, remotes));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class RemoteRepoValidUrlTest method run.
@Test
public void run() throws Exception {
final String VALID_REPO = "valid";
final String VALID_URL = "http://www.foo.com";
client.stores().create(new RemoteRepository(VALID_REPO, VALID_URL), "adding valid test", RemoteRepository.class);
assertTrue(client.stores().exists(remote, VALID_REPO));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class ImpliedRepoMaintainerTest method dontRemoveImpliedRepoWhenRepoRemovedFromGroup.
@Test
public void dontRemoveImpliedRepoWhenRepoRemovedFromGroup() throws Exception {
final Group g = new Group(MAVEN_PKG_KEY, "test");
storeDataManager.storeArtifactStore(g, summary, false, true, new EventMetadata());
final RemoteRepository repo1 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo1, summary, false, true, new EventMetadata());
final RemoteRepository repo2 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo2, summary, false, true, new EventMetadata());
metadataManager.addImpliedMetadata(repo1, Collections.singletonList(repo2));
// Simulates removal of repo1...odd, I know, but since they post-process these updates, it's what the
// event observers would see.
g.addConstituent(repo2);
final ArtifactStorePreUpdateEvent event = new ArtifactStorePreUpdateEvent(ArtifactStoreUpdateType.UPDATE, new EventMetadata(), Collections.singletonMap(g.copyOf(), g));
maintainer.updateImpliedStores(event);
assertThat(g.getConstituents().contains(repo2.getKey()), equalTo(true));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class ImpliedRepoMaintainerTest method addImpliedRepoWhenRepoAddedToGroup.
@Test
public void addImpliedRepoWhenRepoAddedToGroup() throws Exception {
final Group g = new Group(MAVEN_PKG_KEY, "test");
storeDataManager.storeArtifactStore(g, summary, false, true, new EventMetadata());
final RemoteRepository repo1 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo1, summary, false, true, new EventMetadata());
final RemoteRepository repo2 = new RemoteRepository(MAVEN_PKG_KEY, "one", "http://www.foo.com/repo");
storeDataManager.storeArtifactStore(repo2, summary, false, true, new EventMetadata());
metadataManager.addImpliedMetadata(repo1, Collections.singletonList(repo2));
g.addConstituent(repo1);
final ArtifactStorePreUpdateEvent event = new ArtifactStorePreUpdateEvent(ArtifactStoreUpdateType.UPDATE, new EventMetadata(), Collections.singletonMap(g.copyOf(), g));
maintainer.updateImpliedStores(event);
assertThat(g.getConstituents().contains(repo2.getKey()), equalTo(true));
}
Aggregations