diff options
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java index 49c51750b..f591fb846 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java @@ -13,18 +13,22 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; +//This test verify that one patch can replace another one. public class Bug300572 extends AbstractProvisioningTest { - public void testInstallBabel() throws ProvisionException { + public void testInstallSecondPatch() throws ProvisionException { IProvisioningAgentProvider provider = getAgentProvider(); IProvisioningAgent agent = provider.createAgent(getTestData("Bug300572 data", "testData/bug300572/p2").toURI()); IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); + //The following repo contains the second patch to be installed IMetadataRepository repo = repoMgr.loadRepository(getTestData("bug300572 data", "testData/bug300572/repo/").toURI(), new NullProgressMonitor()); IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); + //The profile already contains a a feature (hellofeature) and a patch for it (hellopatch). IProfile sdkProfile = ((IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME)).getProfile("SDKProfile"); assertFalse(sdkProfile.query(QueryUtil.createIUQuery("hellopatch.feature.group"), null).isEmpty()); assertFalse(sdkProfile.query(QueryUtil.createIUQuery("hellofeature.feature.group"), null).isEmpty()); + //Try to optionally install the second patch. We install all the IUs from the repo since it contains only the patch and its necessary IUs. IProfileChangeRequest request = planner.createChangeRequest(sdkProfile); IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.ALL_UNITS, null); request.addAll(allIUs.toUnmodifiableSet()); @@ -37,6 +41,6 @@ public class Bug300572 extends AbstractProvisioningTest { IProvisioningPlan plan = planner.getProvisioningPlan(request, pc, new NullProgressMonitor()); assertOK("plan is not ok", plan.getStatus()); - assertFalse(plan.getAdditions().query(QueryUtil.createIUQuery("hellopatch.feature.group", Version.create("1.0.2.201001211536")), null).isEmpty()); + assertFalse("hellopatch.feature.group not found", plan.getAdditions().query(QueryUtil.createIUQuery("hellopatch.feature.group", Version.create("1.0.2.201001211536")), null).isEmpty()); } } |