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"));
}
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));
}
Aggregations