public void testChangeIUProperty() {
    // Add into the profile the version a1;
    ProfileChangeRequest req = new ProfileChangeRequest(profile);
    req.addInstallableUnits(new IInstallableUnit[] {a1});
    req.setInstallableUnitProfileProperty(
        a1, IProfile.PROP_PROFILE_ROOT_IU, Boolean.TRUE.toString());
    IProvisioningPlan plan = planner.getProvisioningPlan(req, null, null);
    assertEquals(IStatus.OK, plan.getStatus().getSeverity());
    engine.perform(plan, null);
    assertProfileContainsAll("A1 is missing", profile, new IInstallableUnit[] {a1});

    IProfileRegistry profileRegistry = getProfileRegistry();
    profile = profileRegistry.getProfile(profile.getProfileId());
    IQueryResult c = profile.query(new UserVisibleRootQuery(), null);
    assertEquals(queryResultSize(c), 1);

    System.gc();
    ProfileChangeRequest req2 =
        ProfileChangeRequest.createByProfileId(getAgent(), profile.getProfileId());
    req2.removeInstallableUnits(new IInstallableUnit[] {a1});
    req2.addInstallableUnits(new IInstallableUnit[] {a2});
    //		req2.setInstallableUnitProfileProperty(a2, IProfile.PROP_PROFILE_ROOT_IU,
    // Boolean.TRUE.toString());
    IProvisioningPlan plan2 = planner.getProvisioningPlan(req2, null, null);
    assertEquals(IStatus.OK, plan2.getStatus().getSeverity());
    assertInstallOperand(plan2, a2);
    engine.perform(plan2, null);
    profile = getProfile(profile.getProfileId());
    assertProfileContains("A2 is missing", profile, new IInstallableUnit[] {a2});
  }
Exemplo n.º 2
0
  public void testOneIUWithMultiplePatchesApplyingOnIt() {
    //				//Confirm that f1 can't be installed
    //				ProfileChangeRequest req1 = new ProfileChangeRequest(profile1);
    //				req1.addInstallableUnits(new IInstallableUnit[] {f1});
    //				ProvisioningPlan plan1 = planner.getProvisioningPlan(req1, null, null);
    //				assertEquals(IStatus.ERROR, plan1.getStatus().getSeverity());
    //
    //				//Verify that the installation of f1 and p1 succeed
    //				ProfileChangeRequest req2 = new ProfileChangeRequest(profile1);
    //				req2.addInstallableUnits(new IInstallableUnit[] {f1, p1});
    //				ProvisioningPlan plan2 = planner.getProvisioningPlan(req2, null, null);
    //				assertEquals(IStatus.WARNING, plan2.getStatus().getSeverity());
    //				assertInstallOperand(plan2, f1);
    //				assertInstallOperand(plan2, a1);
    //				assertInstallOperand(plan2, b1);
    //				assertInstallOperand(plan2, c1);
    //				assertInstallOperand(plan2, x1);
    //				assertInstallOperand(plan2, y1);
    //				assertInstallOperand(plan2, p1);

    // Verify that the installation of f1 and p1 succeed
    ProfileChangeRequest req3 = new ProfileChangeRequest(profile1);
    req3.addInstallableUnits(new IInstallableUnit[] {f1, p1, r1});
    IProvisioningPlan plan3 = planner.getProvisioningPlan(req3, null, null);
    assertEquals(IStatus.OK, plan3.getStatus().getSeverity());
  }
Exemplo n.º 3
0
  public void testGreedy() throws ProvisionException, OperationCanceledException {
    URI heliosRepo = getTestData("helios", "testData/bug306279/repo/helios").toURI();
    URI rienaRepo2 =
        getTestData("rienatoolbox-a", "testData/bug306279/repo/rienatoolbox-a").toURI();
    IMetadataRepository repo1 = getMetadataRepositoryManager().loadRepository(heliosRepo, null);
    assertFalse(
        repo1
            .query(
                QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"),
                new NullProgressMonitor())
            .isEmpty());
    IMetadataRepository repo2 = getMetadataRepositoryManager().loadRepository(rienaRepo2, null);

    IPlanner planner = getPlanner(getAgent());
    IProfile profile = createProfile(getName());
    IProfileChangeRequest request = new ProfileChangeRequest(profile);
    Set<IInstallableUnit> ius =
        repo2
            .query(
                QueryUtil.createIUQuery("org.eclipse.riena.toolbox.feature.feature.group"),
                new NullProgressMonitor())
            .toUnmodifiableSet();
    request.addAll(ius);
    ProvisioningContext ctx = new ProvisioningContext(getAgent());
    ctx.setMetadataRepositories(new URI[] {heliosRepo, rienaRepo2});
    IProvisioningPlan plan = planner.getProvisioningPlan(request, ctx, new NullProgressMonitor());

    assertOK("resolution failed", plan.getStatus());
    assertEquals(
        0,
        plan.getAdditions()
            .query(
                QueryUtil.createIUQuery("org.eclipse.rap.jface.databinding"),
                new NullProgressMonitor())
            .toUnmodifiableSet()
            .size());
    System.out.println(plan);
  }