Search in sources :

Example 26 with IInstallableUnit

use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.

the class PublishProductToolTest method testExpandVersionsOfInclusionsWithQualifierLiterals.

@Test
public void testExpandVersionsOfInclusionsWithQualifierLiterals() throws Exception {
    File productDefinition = resourceFile("publishers/products/inclusionsWithQualifiers.product");
    subject = initPublisher(createBundleIU("test.plugin", "0.1.0.20141230"), createBundleIU("test.plugin", "1.1.0"), createFeatureIU("test.feature", "0.2.0.20141230"), createFeatureIU("test.feature", "1.2.0"));
    IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("test.plugin", "0.1.0.20141230")));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("test.feature.feature.group", "0.2.0.20141230")));
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) TychoMatchers.isFile(org.eclipse.tycho.test.util.TychoMatchers.isFile) Test(org.junit.Test)

Example 27 with IInstallableUnit

use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.

the class PublishProductToolTest method testExpandVersionsOfInclusionsWithZeros.

@Test
public void testExpandVersionsOfInclusionsWithZeros() throws Exception {
    File productDefinition = resourceFile("publishers/products/inclusionsWithZeros.product");
    subject = initPublisher(createBundleIU("test.plugin", "0.1.0.20141230"), createBundleIU("test.plugin", "1.1.0"), createFeatureIU("test.feature", "0.2.0.20141230"), createFeatureIU("test.feature", "1.2.0"));
    IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("test.plugin", "1.1.0")));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("test.feature.feature.group", "1.2.0")));
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) TychoMatchers.isFile(org.eclipse.tycho.test.util.TychoMatchers.isFile) Test(org.junit.Test)

Example 28 with IInstallableUnit

use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.

the class PublishProductToolTest method testPublishingWithRootFeatures.

@Test
public void testPublishingWithRootFeatures() {
    File productDefinition = resourceFile("publishers/products/rootFeatures.product");
    subject = initPublisher(createFeatureIU("org.eclipse.rcp", "4.4.0.v20140128"), createFeatureIU("org.eclipse.e4.rcp", "1.0"), createFeatureIU("org.eclipse.help", "2.0.102.v20140128"), createFeatureIU("org.eclipse.egit", "2.0"));
    List<DependencySeed> seeds = subject.publishProduct(productDefinition, null, FLAVOR);
    IInstallableUnit productUnit = getUnique(productUnit(), unitsIn(seeds));
    assertThat(productUnit.getRequirements(), hasItem(requirement("org.eclipse.rcp.feature.group", "4.4.0.v20140128")));
    assertThat(productUnit.getRequirements(), hasItem(requirement("org.eclipse.e4.rcp.feature.group", "1.0")));
    assertThat(productUnit.getRequirements(), not(hasItem(requirement("org.eclipse.help.feature.group", "2.0.102.v20140128"))));
    assertThat(productUnit.getRequirements(), not(hasItem(requirement("org.eclipse.egit.feature.group", "2.0"))));
    assertThat(seeds.get(1).getId(), is("org.eclipse.help"));
    assertThat((IInstallableUnit) seeds.get(1).getInstallableUnit(), is(unitWithId("org.eclipse.help.feature.group")));
    assertThat(seeds.get(2).getId(), is("org.eclipse.egit"));
    assertThat((IInstallableUnit) seeds.get(2).getInstallableUnit(), is(unitWithId("org.eclipse.egit.feature.group")));
    assertThat(seeds, hasSize(3));
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) TychoMatchers.isFile(org.eclipse.tycho.test.util.TychoMatchers.isFile) Test(org.junit.Test)

Example 29 with IInstallableUnit

use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.

the class PublisherServiceTest method initSubject.

@Before
public void initSubject() throws Exception {
    File projectDirectory = tempManager.newFolder("projectDir");
    LinkedHashSet<IInstallableUnit> installableUnits = new LinkedHashSet<>();
    installableUnits.add(InstallableUnitUtil.createFeatureIU("org.eclipse.example.original_feature", "1.0.0"));
    IMetadataRepository context = new ImmutableInMemoryMetadataRepository(installableUnits);
    // TODO these publishers don't produce artifacts, so we could run without file system
    outputRepository = new PublishingRepositoryImpl(p2Context.getAgent(), new ReactorProjectIdentitiesStub(projectDirectory));
    PublisherActionRunner publisherRunner = new PublisherActionRunner(context, DEFAULT_ENVIRONMENTS, logVerifier.getLogger());
    subject = new PublisherServiceImpl(publisherRunner, DEFAULT_QUALIFIER, outputRepository);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) PublishingRepositoryImpl(org.eclipse.tycho.repository.module.PublishingRepositoryImpl) ReactorProjectIdentitiesStub(org.eclipse.tycho.test.util.ReactorProjectIdentitiesStub) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) IMetadataRepository(org.eclipse.equinox.p2.repository.metadata.IMetadataRepository) ResourceUtil.resourceFile(org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile) File(java.io.File) ImmutableInMemoryMetadataRepository(org.eclipse.tycho.repository.p2base.metadata.ImmutableInMemoryMetadataRepository) Before(org.junit.Before)

Example 30 with IInstallableUnit

use of org.eclipse.equinox.p2.metadata.IInstallableUnit in project tycho by eclipse.

the class PublishProductToolImpl method addRootFeatures.

private static void addRootFeatures(ExpandedProduct product, List<DependencySeed> seeds) {
    final String productId = product.getId();
    // add root features as special dependency seed which are marked as "add-on" for the product
    DependencySeed.Filter filter = new DependencySeed.Filter() {

        @Override
        public boolean isAddOnFor(String type, String id) {
            return ArtifactType.TYPE_ECLIPSE_PRODUCT.equals(type) && productId.equals(id);
        }
    };
    for (IInstallableUnit featureIU : product.getRootFeatures()) {
        ArtifactKey featureArtifact = ArtifactTypeHelper.toTychoArtifact(featureIU);
        seeds.add(new DependencySeed(featureArtifact.getType(), featureArtifact.getId(), featureIU, filter));
    }
}
Also used : DependencySeed(org.eclipse.tycho.core.resolver.shared.DependencySeed) ArtifactKey(org.eclipse.tycho.ArtifactKey) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Aggregations

IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)153 Test (org.junit.Test)58 ArrayList (java.util.ArrayList)44 File (java.io.File)38 IRequirement (org.eclipse.equinox.p2.metadata.IRequirement)25 HashSet (java.util.HashSet)18 IStatus (org.eclipse.core.runtime.IStatus)18 InstallableUnitDescription (org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription)16 IMetadataRepository (org.eclipse.equinox.p2.repository.metadata.IMetadataRepository)15 HashMap (java.util.HashMap)13 LinkedHashSet (java.util.LinkedHashSet)11 CoreException (org.eclipse.core.runtime.CoreException)11 ProvisionException (org.eclipse.equinox.p2.core.ProvisionException)11 ResourceUtil.resourceFile (org.eclipse.tycho.p2.tools.test.util.ResourceUtil.resourceFile)11 URI (java.net.URI)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)9 SubMonitor (org.eclipse.core.runtime.SubMonitor)9 ArtifactMock (org.eclipse.tycho.p2.impl.test.ArtifactMock)9 Status (org.eclipse.core.runtime.Status)8 IRequiredCapability (org.eclipse.equinox.internal.p2.metadata.IRequiredCapability)8