Search in sources :

Example 16 with IArtifactRepository

use of org.eclipse.equinox.p2.repository.artifact.IArtifactRepository in project tycho by eclipse.

the class RemoteAgentMavenMirrorsTest method loadRepositories.

private Repositories loadRepositories(String id, URI specifiedUrl) throws Exception {
    IRepositoryIdManager idManager = (IRepositoryIdManager) subject.getService(IRepositoryIdManager.SERVICE_NAME);
    idManager.addMapping(id, specifiedUrl);
    IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) subject.getService(IMetadataRepositoryManager.SERVICE_NAME);
    IMetadataRepository metadataRepo = metadataManager.loadRepository(specifiedUrl, null);
    IArtifactRepositoryManager artifactsManager = (IArtifactRepositoryManager) subject.getService(IArtifactRepositoryManager.SERVICE_NAME);
    IArtifactRepository artifactsRepo = artifactsManager.loadRepository(specifiedUrl, null);
    return new Repositories(metadataRepo, artifactsRepo);
}
Also used : IMetadataRepositoryManager(org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager) IArtifactRepositoryManager(org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)

Example 17 with IArtifactRepository

use of org.eclipse.equinox.p2.repository.artifact.IArtifactRepository in project tycho by eclipse.

the class P2MirrorDisablingArtifactRepositoryManager method loadRepository.

@Override
public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
    IArtifactRepository repository = delegate.loadRepository(location, monitor);
    disableMirrors(repository, mavenLogger);
    return repository;
}
Also used : IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)

Example 18 with IArtifactRepository

use of org.eclipse.equinox.p2.repository.artifact.IArtifactRepository in project tycho by eclipse.

the class ModuleArtifactRepositoryTest method artifactSizeOf.

private static int artifactSizeOf(IArtifactKey artifactKey, IArtifactRepository subject) {
    IArtifactDescriptor[] artifactDescriptors = subject.getArtifactDescriptors(artifactKey);
    assertEquals(1, artifactDescriptors.length);
    ByteArrayOutputStream artifactContent = new ByteArrayOutputStream();
    subject.getArtifact(artifactDescriptors[0], artifactContent, null);
    return artifactContent.size();
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 19 with IArtifactRepository

use of org.eclipse.equinox.p2.repository.artifact.IArtifactRepository in project tycho by eclipse.

the class ModuleArtifactRepositoryTest method testPersistRepository.

@Test
public void testPersistRepository() throws Exception {
    File repoDir = tempManager.newFolder("targetDir");
    subject = ModuleArtifactRepository.createInstance(null, repoDir);
    // TODO write via sink
    OutputStream outputStream = subject.getOutputStream(newDescriptor(BINARY_ARTIFACT_KEY));
    writeAndClose(outputStream, BINARY_ARTIFACT_SIZE);
    IArtifactRepository result = loadRepositoryViaAgent(repoDir);
    assertThat(artifactSizeOf(BINARY_ARTIFACT_KEY, result), is(BINARY_ARTIFACT_SIZE));
}
Also used : ByteArrayOutputStream(java.io.ByteArrayOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository) File(java.io.File) Test(org.junit.Test)

Example 20 with IArtifactRepository

use of org.eclipse.equinox.p2.repository.artifact.IArtifactRepository in project tycho by eclipse.

the class PublishingRepositoryTest method insertTestArtifact.

private static void insertTestArtifact(PublishingRepository publishingRepo) throws ProvisionException, IOException {
    IArtifactRepository writableArtifactRepo = publishingRepo.getArtifactRepositoryForWriting(AttachedTestArtifact.getWriteSessionForArtifact());
    OutputStream outputStream = writableArtifactRepo.getOutputStream(writableArtifactRepo.createArtifactDescriptor(AttachedTestArtifact.key));
    writeAndClose(outputStream, AttachedTestArtifact.size);
}
Also used : OutputStream(java.io.OutputStream) IArtifactRepository(org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)

Aggregations

IArtifactRepository (org.eclipse.equinox.p2.repository.artifact.IArtifactRepository)23 Test (org.junit.Test)11 IStatus (org.eclipse.core.runtime.IStatus)7 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)6 File (java.io.File)4 OutputStream (java.io.OutputStream)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 Status (org.eclipse.core.runtime.Status)3 IProvisioningAgent (org.eclipse.equinox.p2.core.IProvisioningAgent)3 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)3 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)3 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)3 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 IPublisherAction (org.eclipse.equinox.p2.publisher.IPublisherAction)2 IPublisherAdvice (org.eclipse.equinox.p2.publisher.IPublisherAdvice)2 IPublisherInfo (org.eclipse.equinox.p2.publisher.IPublisherInfo)2 Publisher (org.eclipse.equinox.p2.publisher.Publisher)2