use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project gemoc-studio by eclipse.
the class PrepareInstallProfileJob method resolve.
private InstallOperation resolve(IProgressMonitor monitor, final Collection<IInstallableUnit> ius, URI[] repositories) throws CoreException {
final InstallOperation installOperation = provisioningUI.getInstallOperation(ius, repositories);
IStatus operationStatus = installOperation.resolveModal(new SubProgressMonitor(monitor, installableConnectors.size()));
if (operationStatus.getSeverity() > IStatus.WARNING) {
Activator.getDefault().getLog().log(operationStatus);
throw new RuntimeException(getFullMessage(operationStatus));
}
return installOperation;
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class MetadataSerializableImplTest method testSerializeAndLoad.
@Test
public void testSerializeAndLoad() throws IOException, ProvisionException, OperationCanceledException {
File tmpDir = createTempDir("repo");
try {
Set<IInstallableUnit> units = new HashSet<>(Arrays.asList(InstallableUnitUtil.createIU("org.example.test", "1.0.0")));
MetadataSerializableImpl subject = new MetadataSerializableImpl();
serialize(subject, units, tmpDir);
Assert.assertEquals(units, deserialize(tmpDir));
} finally {
deleteRecursive(tmpDir);
}
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class P2ResolverAdditionalRequirementsTest method testNullVersionInTargetDefinitionUnit.
@Test
public void testNullVersionInTargetDefinitionUnit() throws Exception {
String nullVersion = null;
String arbitraryVersion = "2.5.8";
impl.addDependency(IU_TYPE, TARGET_UNIT_ID, nullVersion);
impl.addDependency(BUNDLE_TYPE, TARGET_UNIT_ID, nullVersion);
List<IRequirement> additionalRequirements = impl.getAdditionalRequirements();
IInstallableUnit iu = createIU(arbitraryVersion);
Assert.assertTrue("Given version was null; should be satisfied by any version", additionalRequirements.get(0).isMatch(iu));
Assert.assertTrue("Given version was null; should be satisfied by any version", additionalRequirements.get(1).isMatch(iu));
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class P2ResolverTest method testSiteConflictingDependenciesResolver.
@SuppressWarnings({ "unchecked", "deprecation" })
@Test
public void testSiteConflictingDependenciesResolver() throws IOException {
tpConfig.addP2Repository(resourceFile("repositories/e342").toURI());
File[] projects = new File[] { //
resourceFile("siteresolver/bundle342"), //
resourceFile("siteresolver/bundle352"), //
resourceFile("siteresolver/feature342"), resourceFile("siteresolver/feature352") };
addContextProject(projects[0], TYPE_ECLIPSE_PLUGIN);
addContextProject(projects[1], TYPE_ECLIPSE_PLUGIN);
addContextProject(projects[2], TYPE_ECLIPSE_FEATURE);
addContextProject(projects[3], TYPE_ECLIPSE_FEATURE);
projectToResolve = createReactorProject(resourceFile("siteresolver/site"), TYPE_ECLIPSE_UPDATE_SITE, "site");
result = impl.collectProjectDependencies(getTargetPlatform(), projectToResolve);
assertEquals(projects.length, result.getArtifacts().size());
for (File project : projects) {
assertContainLocation(result, project);
}
// TODO the eclipse-update-site module itself is not in the resolution result; is this needed?
// conflicting dependency mode only collects included artifacts - the referenced non-reactor unit
// org.eclipse.osgi is not included
assertThat((Set<IInstallableUnit>) result.getNonReactorUnits(), not(hasItem(unitWithId("org.eclipse.osgi"))));
}
use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.
the class TargetDefinitionResolverExecutionEnvironmentTest method testAutoGeneratedExecutionEnvironment.
@Test
public void testAutoGeneratedExecutionEnvironment() throws Exception {
subject = targetResolverForEE("JavaSE-1.7");
TargetDefinition definition = definitionWith(new AlternatePackageProviderLocationStub());
Collection<IInstallableUnit> units = subject.resolveContent(definition).getUnits();
// expect that resolver did not included a bundle providing org.w3c.dom...
assertThat(units, not(hasItem(unit("javax.xml", "0.0.1.SNAPSHOT"))));
// ... but instead included the configured 'a.jre' IU (which is not contained in the repository)
assertThat(units, hasItem(unit("a.jre.javase", "1.7.0")));
// other "a.jre" IUs from the repository shall be filtered out
assertThat(units, not(hasItem(unitWithId("a.jre"))));
}
Aggregations