Search in sources :

Example 21 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method bundle_with_p2_inf.

@Test
public void bundle_with_p2_inf() throws Exception {
    generateDependencies("bundle-p2-inf", PackagingType.TYPE_ECLIPSE_PLUGIN);
    assertEquals(2, units.size());
    IInstallableUnit unit = getUnitWithId("org.eclipse.tycho.p2.impl.test.bundle-p2-inf", units);
    assertNotNull(unit);
    assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    List<IRequirement> requirements = new ArrayList<>(unit.getRequirements());
    assertEquals(1, requirements.size());
    IRequiredCapability requirement = (IRequiredCapability) requirements.get(0);
    assertEquals(IInstallableUnit.NAMESPACE_IU_ID, requirement.getNamespace());
    assertEquals("required.p2.inf", requirement.getName());
    assertNotNull(getUnitWithId("iu.p2.inf", units));
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) ArrayList(java.util.ArrayList) IRequiredCapability(org.eclipse.equinox.internal.p2.metadata.IRequiredCapability) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 22 with IInstallableUnit

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

the class PublishProductToolTest method testExpandVersionsIgnoresBundlesInFeatureBasedProduct.

@Test
public void testExpandVersionsIgnoresBundlesInFeatureBasedProduct() throws Exception {
    // product with useFeatures="true" and a non-resolvable plug-in reference -> the plug-in reference must be ignored (see bug 359090)
    File productDefinition = resourceFile("publishers/products/featureProductWithLeftovers.product");
    subject = initPublisher(createFeatureIU("org.eclipse.rcp", "3.3.101.R34x_v20081125"));
    IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("org.eclipse.rcp.feature.group", "3.3.101.R34x_v20081125")));
}
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 23 with IInstallableUnit

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

the class PublishProductToolTest method testPublishingWithProductSpecificP2Inf.

@Test
public void testPublishingWithProductSpecificP2Inf() {
    File productDefinition = resourceFile("publishers/products/p2InfPerProduct/test.product");
    subject = initPublisher();
    IInstallableUnit unit = getUnit(subject.publishProduct(productDefinition, null, FLAVOR));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("extra.iu", "1.2.3." + QUALIFIER)));
}
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 24 with IInstallableUnit

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

the class PublishProductToolTest method initPublisher.

private PublishProductTool initPublisher(IInstallableUnit... tpUnits) {
    LinkedHashSet<IInstallableUnit> contextUnits = new LinkedHashSet<>();
    contextUnits.addAll(Arrays.asList(tpUnits));
    P2TargetPlatform targetPlatform = new FinalTargetPlatformImpl(contextUnits, null, null, null, null, null);
    PublisherActionRunner publisherRunner = new PublisherActionRunner(targetPlatform.getInstallableUnitsAsMetadataRepository(), ENVIRONMENTS, logVerifier.getLogger());
    return new PublishProductToolImpl(publisherRunner, outputRepository, targetPlatform, QUALIFIER, interpolatorMock, logVerifier.getLogger());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) FinalTargetPlatformImpl(org.eclipse.tycho.p2.target.FinalTargetPlatformImpl) P2TargetPlatform(org.eclipse.tycho.p2.target.P2TargetPlatform) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit)

Example 25 with IInstallableUnit

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

the class PublishProductToolTest method testPublishingWithP2Inf.

@Test
public void testPublishingWithP2Inf() {
    File productDefinition = resourceFile("publishers/products/p2Inf/test.product");
    subject = initPublisher();
    subject.publishProduct(productDefinition, null, FLAVOR);
    assertThat(unitsIn(outputRepository), hasItem(unitWithId("testproduct")));
    IInstallableUnit unit = getUnique(unitWithId("testproduct"), unitsIn(outputRepository));
    assertThat(unit.getRequirements(), hasItem(strictRequirement("extra.iu", "1.2.3." + QUALIFIER)));
    assertThat(unitsIn(outputRepository), hasItem(unitWithId("extra.iu")));
    IInstallableUnit extraUnit = getUnique(unitWithId("extra.iu"), unitsIn(outputRepository));
    assertThat(extraUnit.getVersion().toString(), is("1.2.3." + QUALIFIER));
    assertThat(extraUnit, hasSelfCapability());
}
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)

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