コード例 #1
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    sdk =
        createIU(
            "SDK",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            createRequiredCapabilities(
                IInstallableUnit.NAMESPACE_IU_ID, "SDKPart", new VersionRange("[1.0.0, 1.0.0]")));
    IInstallableUnit sdkPart =
        createIU(
            "SDKPart",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            true);
    IInstallableUnit sdkPart2 =
        createIU(
            "SDKPart",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("2.0.0")),
            true);

    createTestMetdataRepository(new IInstallableUnit[] {sdk, sdkPart, sdkPart2});

    profile = createProfile("TestProfile." + getName());
    planner = createPlanner();
    engine = createEngine();

    ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
    pcr.addInstallableUnits(new IInstallableUnit[] {sdk});
    engine.perform(planner.getProvisioningPlan(pcr, null, null), null);
  }
コード例 #2
0
  public void testNoProblemWithMissingOptionalDependency() {
    // CDT will be missing a requirement but it is optional so everything should be good
    // EMF will be not be good because it is missing a requirement
    IRequirement missingOptionalDependency =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "MissingSomething",
            new VersionRange("[1.0.0, 1.0.0]"),
            null,
            true,
            false);
    IInstallableUnit cdt =
        createIU(
            "CDT",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            new IRequirement[] {missingOptionalDependency});

    IRequirement emfMissing =
        MetadataFactory.createRequirement(
            IInstallableUnit.NAMESPACE_IU_ID,
            "EMFPart",
            new VersionRange("[1.0.0, 1.0.0]"),
            null,
            false,
            false);
    IInstallableUnit emf =
        createIU(
            "EMF",
            PublisherHelper.fromOSGiVersion(new org.osgi.framework.Version("1.0.0")),
            new IRequirement[] {emfMissing},
            NO_PROPERTIES,
            true);

    createTestMetdataRepository(new IInstallableUnit[] {cdt, emf});
    ProfileChangeRequest pcr = new ProfileChangeRequest(profile);
    pcr.addInstallableUnits(new IInstallableUnit[] {cdt, emf});
    ProvisioningPlan plan = (ProvisioningPlan) planner.getProvisioningPlan(pcr, null, null);
    RequestStatus requestStatus = ((PlannerStatus) plan.getStatus()).getRequestStatus();
    assertTrue(requestStatus.getConflictsWithInstalledRoots().contains(emf));
    assertFalse(requestStatus.getConflictsWithInstalledRoots().contains(cdt));
    assertFalse(requestStatus.getConflictsWithInstalledRoots().contains(sdk));

    //		assertTrue(plan.getRequestStatus(cdt).getSeverity() != IStatus.ERROR);
    //
    //		assertTrue(plan.getRequestStatus(emf).getSeverity() == IStatus.ERROR);
    //		assertEquals(0, plan.getRequestStatus(emf).getConflictsWithInstalledRoots());
  }