use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class PublisherServiceTest method testProfilePublishing.
@Test
public void testProfilePublishing() throws Exception {
File customProfile = resourceFile("publishers/virgo-1.6.profile");
Collection<DependencySeed> seeds = subject.publishEEProfile(customProfile);
assertThat(seeds.size(), is(2));
IInstallableUnit virgoProfileIU = unitsById(seeds).get("a.jre.virgo");
assertThat(virgoProfileIU, not(nullValue()));
Collection<IProvidedCapability> provided = virgoProfileIU.getProvidedCapabilities();
boolean customJavaxActivationVersionFound = false;
Version version_1_1_1 = Version.create("1.1.1");
for (IProvidedCapability capability : provided) {
if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(capability.getNamespace())) {
if ("javax.activation".equals(capability.getName())) {
if (version_1_1_1.equals(capability.getVersion())) {
customJavaxActivationVersionFound = true;
break;
}
}
}
}
assertTrue("did not find capability for package javax.activation with custom version " + version_1_1_1, customJavaxActivationVersionFound);
assertThat(unitsById(seeds).keySet(), hasItem("config.a.jre.virgo"));
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitMatchers method hasSelfCapability.
public static Matcher<IInstallableUnit> hasSelfCapability() {
return new TypeSafeMatcher<IInstallableUnit>() {
@Override
public void describeTo(Description description) {
description.appendText("an installable unit providing the self-capability");
}
@Override
protected boolean matchesSafely(IInstallableUnit unit) {
String name = unit.getId();
Version version = unit.getVersion();
for (IProvidedCapability capability : unit.getProvidedCapabilities()) {
if (IU_CAPABILITY_NS.equals(capability.getNamespace()) && name.equals(capability.getName()) && version.equals(capability.getVersion())) {
return true;
}
}
return false;
}
@Override
protected void describeMismatchSafely(IInstallableUnit item, Description mismatchDescription) {
mismatchDescription.appendValue(item).appendText(" has the provided capabilities ").appendValue(item.getProvidedCapabilities());
}
};
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createIUArtifact.
public static IInstallableUnit createIUArtifact(String id, String version, String artifactId, String artifactVersion) {
InstallableUnitDescription description = createIuDescription(id, version);
description.setArtifacts(new IArtifactKey[] { new ArtifactKey("type", artifactId, Version.create(artifactVersion)) });
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createIUWithCapabilitiesAndFilter.
public static IInstallableUnit createIUWithCapabilitiesAndFilter(String id, String version, Collection<IProvidedCapability> capabilities, String filter) {
InstallableUnitDescription description = createIuDescription(id, version);
description.addProvidedCapabilities(capabilities);
description.setFilter(filter);
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class InstallableUnitUtil method createIuDescription.
private static InstallableUnitDescription createIuDescription(String id, String version) {
InstallableUnitDescription description = new InstallableUnitDescription();
description.setId(id);
description.setVersion(Version.create(version));
description.addProvidedCapabilities(createProvidedCapability(IU_CAPABILITY_NS, id, version));
return description;
}
Aggregations