use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class MavenMetadataGeneratorTest method setupVersionsStructureWith2Versions.
private StoreResource setupVersionsStructureWith2Versions() throws Exception {
final RemoteRepository store = new RemoteRepository(MAVEN_PKG_KEY, "testrepo", "http://foo.bar");
stores.storeArtifactStore(store, summary, false, true, new EventMetadata());
final String path = "org/group/artifact";
final KeyedLocation location = LocationUtils.toLocation(store);
final StoreResource resource = new StoreResource(location, path);
fixture.getTransport().registerListing(resource, new TestListing(new ListingResult(resource, new String[] { "1.0/", "1.1/" })));
ConcreteResource versionDir = (resource.getChild("1.0/"));
fixture.getTransport().registerListing(versionDir, new TestListing(new ListingResult(versionDir, new String[] { "artifact-1.0.jar", "artifact-1.0.pom" })));
versionDir = (resource.getChild("1.1/"));
fixture.getTransport().registerListing(versionDir, new TestListing(new ListingResult(versionDir, new String[] { "artifact-1.1.jar", "artifact-1.1.pom" })));
return resource;
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class DownloadManagerTest method downloadOnePOMFromSingleRepository.
@Test
public void downloadOnePOMFromSingleRepository() throws Exception {
final String content = "This is a test";
final String path = "/org/apache/maven/maven-model/3.0.3/maven-model-3.0.3.pom";
final RemoteRepository repo = new RemoteRepository(MAVEN_PKG_KEY, "central", "http://repo.maven.apache.org/maven2");
fixture.getTransport().registerDownload(new ConcreteResource(new RepositoryLocation(repo), path), new TestDownload(content.getBytes()));
data.storeArtifactStore(repo, summary, false, true, new EventMetadata());
final Transfer stream = downloader.retrieve(repo, path, new EventMetadata());
final String downloaded = IOUtils.toString(stream.openInputStream());
assertThat(downloaded, equalTo(content));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class DownloadManagerTest method downloadOnePOMFromSecondRepositoryAfterDummyRepoFails.
@Test
public void downloadOnePOMFromSecondRepositoryAfterDummyRepoFails() throws Exception {
final RemoteRepository repo = new RemoteRepository(MAVEN_PKG_KEY, "dummy", "http://www.nowhere.com/");
final String content = "This is a test";
final String path = "/org/apache/maven/maven-model/3.0.3/maven-model-3.0.3.pom";
final RemoteRepository repo2 = new RemoteRepository(MAVEN_PKG_KEY, "central", "http://repo.maven.apache.org/maven2");
fixture.getTransport().registerDownload(new ConcreteResource(new RepositoryLocation(repo2), path), new TestDownload(content.getBytes()));
data.storeArtifactStore(repo, summary, false, true, new EventMetadata());
data.storeArtifactStore(repo2, summary, false, true, new EventMetadata());
final List<ArtifactStore> repos = new ArrayList<ArtifactStore>();
repos.add(repo);
repos.add(repo2);
final Transfer stream = downloader.retrieveFirst(repos, path, new EventMetadata());
final String downloaded = IOUtils.toString(stream.openInputStream());
assertThat(downloaded, equalTo(content));
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class ConcurrencyTest method deadlockOnGroupContains.
@BMRules(rules = { @BMRule(name = "init rendezvous", targetClass = "MemoryStoreDataManager", targetMethod = "<init>", targetLocation = "ENTRY", action = "createRendezvous($0, 2, true)"), @BMRule(name = "getGroupsContaining call", targetClass = "MemoryStoreDataManager", targetMethod = "getGroupsContaining", targetLocation = "ENTRY", action = "rendezvous($0); debug(Thread.currentThread().getName() + \": thread proceeding.\")") })
@Test
public void deadlockOnGroupContains() throws IndyDataException, InterruptedException, ExecutionException {
ExecutorService executor = Executors.newFixedThreadPool(2);
ExecutorCompletionService<String> completionService = new ExecutorCompletionService<>(executor);
AtomicInteger count = new AtomicInteger(0);
RemoteRepository repo = new RemoteRepository(MAVEN_PKG_KEY, "central", "http://repo.maven.apache.org/maven2");
TestUpdatingEventDispatcher dispatcher = new TestUpdatingEventDispatcher(repo, completionService, count);
MemoryStoreDataManager dataManager = new MemoryStoreDataManager(dispatcher, new DefaultIndyConfiguration());
dispatcher.setDataManager(dataManager);
ChangeSummary summary = new ChangeSummary(ChangeSummary.SYSTEM_USER, "Test init");
dataManager.storeArtifactStore(repo, summary, false, false, new EventMetadata());
for (int i = 0; i < 2; i++) {
Group group = new Group(MAVEN_PKG_KEY, "group" + i);
if (i % 2 == 0) {
group.addConstituent(repo);
}
dataManager.storeArtifactStore(group, summary, false, false, new EventMetadata());
}
for (int i = 0; i < count.get(); i++) {
Future<String> future = completionService.take();
assertThat(future.get(), nullValue());
}
}
use of org.commonjava.indy.model.core.RemoteRepository in project indy by Commonjava.
the class RouteSelectorPerfTest method setUp.
@Before
public void setUp() {
hostedResource = new ConcreteResource(new CacheOnlyLocation(new HostedRepository(MAVEN_PKG_KEY, "hosted")), String.format("/path/to/my/hosted/%s", "index.html"));
remoteResource = new ConcreteResource(new RepositoryLocation(new RemoteRepository(MAVEN_PKG_KEY, "remote", "http://foo.bar/")), String.format("/path/to/my/remote/%s", "index.html"));
}
Aggregations