Search in sources :

Example 1 with IRawArtifactProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider in project tycho by eclipse.

the class TargetPlatformBundlePublisherTest method testPomDependencyOnBundle.

@Test
public void testPomDependencyOnBundle() throws Exception {
    String bundleId = "org.eclipse.osgi";
    String bundleVersion = "3.5.2.R35x_v20100126";
    FileUtils.copyDirectory(resourceFile("platformbuilder/pom-dependencies/bundle-repo"), localRepositoryRoot);
    File bundleFile = new File(localRepositoryRoot, RepositoryLayoutHelper.getRelativePath(GROUP_ID, ARTIFACT_ID, VERSION, null, "jar"));
    IArtifactFacade bundleArtifact = new ArtifactMock(bundleFile, GROUP_ID, ARTIFACT_ID, VERSION, "jar");
    IInstallableUnit publishedUnit = subject.attemptToPublishBundle(bundleArtifact);
    assertThat(publishedUnit, is(unit(bundleId, bundleVersion)));
    assertThat(publishedUnit.getProperties(), containsGAV(GROUP_ID, ARTIFACT_ID, VERSION));
    assertThat(publishedUnit.getArtifacts().size(), is(1));
    IArtifactKey referencedArtifact = publishedUnit.getArtifacts().iterator().next();
    IRawArtifactProvider artifactRepo = subject.getArtifactRepoOfPublishedBundles();
    assertThat(artifactRepo, contains(referencedArtifact));
    IArtifactDescriptor[] artifactDescriptors = artifactRepo.getArtifactDescriptors(referencedArtifact);
    assertThat(artifactDescriptors.length, is(1));
    assertThat(artifactDescriptors[0].getProperties(), containsGAV(GROUP_ID, ARTIFACT_ID, VERSION));
    assertThat(artifactDescriptors[0].getProperties(), hasProperty("download.md5", "6303323acc98658c0fed307c84db4411"));
    // test that reading the artifact succeeds (because the way it is added to the repository is a bit special)
    assertThat(artifactMD5Of(referencedArtifact, artifactRepo), is("6303323acc98658c0fed307c84db4411"));
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) IArtifactFacade(org.eclipse.tycho.p2.metadata.IArtifactFacade) IArtifactKey(org.eclipse.equinox.p2.metadata.IArtifactKey) ArtifactMock(org.eclipse.tycho.p2.impl.test.ArtifactMock) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) IRawArtifactProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider) ResourceUtil.resourceFile(org.eclipse.tycho.p2.impl.test.ResourceUtil.resourceFile) File(java.io.File) Test(org.junit.Test)

Example 2 with IRawArtifactProvider

use of org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider in project tycho by eclipse.

the class MirroringArtifactProviderPack200CornerCasesTest method testPackedArtifactMirroredEvenIfCanonicalArtifactPresent.

@Test
public void testPackedArtifactMirroredEvenIfCanonicalArtifactPresent() throws Exception {
    IRawArtifactProvider remoteProvider = providerFor(TestRepositoryContent.REPO_BUNDLE_AB);
    prefillLocalRepositoryWithCanonicalArtifact(localRepository, remoteProvider, BUNDLE_A_KEY);
    // self-test
    assertThat(localRepository.getArtifactDescriptors(BUNDLE_A_KEY).length, is(1));
    // self-test
    assertThat(isCanonicalFormat(localRepository.getArtifactDescriptors(BUNDLE_A_KEY)[0]), is(true));
    subject = MirroringArtifactProvider.createInstance(localRepository, remoteProvider, true, logVerifier.getLogger());
    assertThat(subject.getArtifactDescriptors(BUNDLE_A_KEY).length, is(2));
    assertThat(localRepository.getArtifactDescriptors(BUNDLE_A_KEY).length, is(2));
}
Also used : IRawArtifactProvider(org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider) Test(org.junit.Test)

Aggregations

IRawArtifactProvider (org.eclipse.tycho.repository.p2base.artifact.provider.IRawArtifactProvider)2 Test (org.junit.Test)2 File (java.io.File)1 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IArtifactDescriptor (org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor)1 ArtifactMock (org.eclipse.tycho.p2.impl.test.ArtifactMock)1 ResourceUtil.resourceFile (org.eclipse.tycho.p2.impl.test.ResourceUtil.resourceFile)1 IArtifactFacade (org.eclipse.tycho.p2.metadata.IArtifactFacade)1