use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class TargetPlatformBundlePublisherTest method testPomDependencyOnPlainJar.
@Test
public void testPomDependencyOnPlainJar() throws Exception {
File jarFile = resourceFile("platformbuilder/pom-dependencies/non-bundle.jar");
IArtifactFacade jarArtifact = new ArtifactMock(jarFile, GROUP_ID, ARTIFACT_ID, VERSION, "jar");
IInstallableUnit unit = subject.attemptToPublishBundle(jarArtifact);
assertNull(unit);
}
use of org.eclipse.equinox.p2.metadata.Version 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.equinox.p2.metadata.Version in project tycho by eclipse.
the class ProjectorResolutionStrategyTest method testFixSwt.
@Test
public void testFixSwt() throws Exception {
// a Luna version
selectedIUs.add(InstallableUnitUtil.createIU("org.eclipse.swt", "3.103.1.v20140903-1938"));
IInstallableUnit swtImplFragment = createSwtFragment("linux", "gtk", "x86_64", null);
final List<IInstallableUnit> availableIUs = new ArrayList<>();
availableIUs.addAll(selectedIUs);
availableIUs.add(swtImplFragment);
strategy.fixSWT(availableIUs, selectedIUs, createSelectionContext("linux", "gtk", "x86_64"), monitor);
assertThat(selectedIUs.size(), is(2));
assertThat(selectedIUs, hasItem(swtImplFragment));
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class AbstractDependenciesAction method addRequiredCapability.
protected void addRequiredCapability(Set<IRequirement> required, String id, Version version, String filter, boolean optional) {
VersionRange range = getVersionRange(version);
required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, InstallableUnit.parseFilter(filter), optional, false));
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class P2ResolverAdditionalRequirementsTest method createIU.
private static IInstallableUnit createIU(String version) {
InstallableUnitDescription iud = new InstallableUnitDescription();
iud.setId(TARGET_UNIT_ID);
Version osgiVersion = Version.create(version);
iud.setVersion(osgiVersion);
List<IProvidedCapability> list = new ArrayList<>();
list.add(MetadataFactory.createProvidedCapability(IU_NAMESPACE, TARGET_UNIT_ID, osgiVersion));
list.add(MetadataFactory.createProvidedCapability(BUNDLE_NAMESPACE, TARGET_UNIT_ID, osgiVersion));
iud.addProvidedCapabilities(list);
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
return iu;
}
Aggregations