use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.
the class LocalMetadataRepositoryTest method testOutdatedIndex.
@Test
public void testOutdatedIndex() throws CoreException {
// create and fill repo
File location = new File("target/indexmetadataRepo");
LocalMetadataRepository repository = createRepository(location);
InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
iud.setId("test");
iud.setVersion(Version.parseVersion("1.0.0"));
iud.setProperty(RepositoryLayoutHelper.PROP_GROUP_ID, "group");
iud.setProperty(RepositoryLayoutHelper.PROP_ARTIFACT_ID, "artifact");
iud.setProperty(RepositoryLayoutHelper.PROP_VERSION, "version");
IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
repository.addInstallableUnits(Arrays.asList(iu));
repository = (LocalMetadataRepository) loadRepository(location);
// check: the artifact is in the index
TychoRepositoryIndex metaIndex = createMetadataIndex(location);
Assert.assertFalse(metaIndex.getProjectGAVs().isEmpty());
// delete artifact from file system
deleteDir(new File(location, "group"));
// create a new repo and check that the reference was gracefully removed from the index
repository = (LocalMetadataRepository) loadRepository(location);
repository.save();
metaIndex = createMetadataIndex(location);
Assert.assertTrue(metaIndex.getProjectGAVs().isEmpty());
}
use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.
the class MirrorApplicationServiceTest method seedFor.
private static Collection<DependencySeed> seedFor(VersionedId... units) {
Collection<DependencySeed> result = new ArrayList<>();
for (VersionedId unit : units) {
InstallableUnitDescription seedDescriptor = new InstallableUnitDescription();
seedDescriptor.setId("iu-requiring." + unit.getId());
seedDescriptor.addRequirements(strictRequirementTo(unit));
result.add(DependencySeedUtil.createSeed(null, MetadataFactory.createInstallableUnit(seedDescriptor)));
}
return result;
}
use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.
the class InstallableUnitUtil method createProductIU.
public static IInstallableUnit createProductIU(String productId, String version) {
InstallableUnitDescription description = createIuDescription(productId, version);
description.setProperty(PRODUCT_TYPE_PROPERTY, Boolean.toString(true));
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.
the class InstallableUnitUtil method createIURequirement.
public static IInstallableUnit createIURequirement(String id, String version, String requiredId, String requiredVersionRange) {
InstallableUnitDescription description = createIuDescription(id, version);
final IRequirement requiredCapability = createRequirement(requiredId, requiredVersionRange);
description.addRequirements(Arrays.asList(requiredCapability));
return MetadataFactory.createInstallableUnit(description);
}
use of org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription in project tycho by eclipse.
the class InstallableUnitUtil method createBundleIU.
public static IInstallableUnit createBundleIU(String bundleId, String version) {
InstallableUnitDescription description = createIuDescription(bundleId, version);
description.addProvidedCapabilities(createProvidedCapability(BUNDLE_CAPABILITY_NS, bundleId, version));
return MetadataFactory.createInstallableUnit(description);
}
Aggregations