Search in sources :

Example 1 with InstallableUnitDescription

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());
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) TychoRepositoryIndex(org.eclipse.tycho.p2.repository.TychoRepositoryIndex) FileBasedTychoRepositoryIndex(org.eclipse.tycho.repository.local.index.FileBasedTychoRepositoryIndex) File(java.io.File) Test(org.junit.Test)

Example 2 with InstallableUnitDescription

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;
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription) VersionedId(org.eclipse.equinox.p2.metadata.VersionedId) ArrayList(java.util.ArrayList)

Example 3 with InstallableUnitDescription

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);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Example 4 with InstallableUnitDescription

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);
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Example 5 with InstallableUnitDescription

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);
}
Also used : InstallableUnitDescription(org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)

Aggregations

InstallableUnitDescription (org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)19 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)9 ArrayList (java.util.ArrayList)6 File (java.io.File)4 IProvidedCapability (org.eclipse.equinox.p2.metadata.IProvidedCapability)4 IRequirement (org.eclipse.equinox.p2.metadata.IRequirement)4 Test (org.junit.Test)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 LinkedHashSet (java.util.LinkedHashSet)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 ArtifactKey (org.eclipse.equinox.internal.p2.metadata.ArtifactKey)2 IArtifactKey (org.eclipse.equinox.p2.metadata.IArtifactKey)2 Version (org.eclipse.equinox.p2.metadata.Version)2 VersionRange (org.eclipse.equinox.p2.metadata.VersionRange)2 BufferedInputStream (java.io.BufferedInputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1