Search in sources :

Example 16 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method rcpBundle.

@Test
public void rcpBundle() throws Exception {
    generateDependencies("rcp-bundle", PackagingType.TYPE_ECLIPSE_APPLICATION);
    assertEquals(1, units.size());
    IInstallableUnit unit = units.iterator().next();
    assertEquals("org.eclipse.tycho.p2.impl.test.rcp-bundle", unit.getId());
    assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    List<IRequirement> requirements = new ArrayList<>(unit.getRequirements());
    assertEquals(2, requirements.size());
    assertNotNull(getRequiredCapability("included.bundle", requirements));
    // implicit dependencies because includeLaunchers="true"
    assertNotNull(getRequiredCapability("org.eclipse.equinox.executable.feature.group", requirements));
    assertEquals(0, artifacts.size());
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) ArrayList(java.util.ArrayList) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 17 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method rcpFeature.

@Test
public void rcpFeature() throws Exception {
    generateDependencies("rcp-feature", PackagingType.TYPE_ECLIPSE_APPLICATION);
    assertEquals(1, units.size());
    IInstallableUnit unit = units.iterator().next();
    assertEquals("org.eclipse.tycho.p2.impl.test.rcp-feature", unit.getId());
    assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    assertEquals(2, unit.getRequirements().size());
    assertEquals(0, artifacts.size());
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 18 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method bundle.

@Test
public void bundle() throws Exception {
    generateDependencies("bundle", PackagingType.TYPE_ECLIPSE_PLUGIN);
    assertEquals(1, units.size());
    IInstallableUnit unit = units.get(0);
    assertEquals("org.eclipse.tycho.p2.impl.test.bundle", unit.getId());
    assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    assertEquals(2, unit.getRequirements().size());
    assertEquals(DEFAULT_CLASSIFIER, unit.getProperty(RepositoryLayoutHelper.PROP_CLASSIFIER));
    // not really necessary, but we get this because we reuse standard p2 implementation
    assertEquals(1, artifacts.size());
}
Also used : IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 19 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method rcpNoLaunchers.

@Test
public void rcpNoLaunchers() throws Exception {
    generateDependencies("rcp-no-launchers", PackagingType.TYPE_ECLIPSE_APPLICATION);
    assertEquals(1, units.size());
    IInstallableUnit unit = units.iterator().next();
    assertEquals("org.eclipse.tycho.p2.impl.test.rcp-no-launchers", unit.getId());
    assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    List<IRequirement> requirement = new ArrayList<>(unit.getRequirements());
    assertEquals(0, requirement.size());
    assertEquals(0, artifacts.size());
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) ArrayList(java.util.ArrayList) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) Test(org.junit.Test)

Example 20 with IInstallableUnit

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

the class P2DependencyGeneratorImplTest method rcp_with_p2_inf.

@Test
public void rcp_with_p2_inf() throws Exception {
    generateDependencies("rcp-p2-inf", PackagingType.TYPE_ECLIPSE_APPLICATION);
    assertEquals(2, units.size());
    IInstallableUnit unit = getUnitWithId("org.eclipse.tycho.p2.impl.test.rcp-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 p2InfCapability = getRequiredCapability("required.p2.inf", requirements);
    assertNotNull(p2InfCapability);
    assertEquals(0, artifacts.size());
    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)

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