diff options
author | Pascal Rapicault | 2010-05-11 20:38:59 +0000 |
---|---|---|
committer | Pascal Rapicault | 2010-05-11 20:38:59 +0000 |
commit | 0ec6b2e3519f057d6bbe434c5b2fb112cc0544ec (patch) | |
tree | 4bfc5c8204a29b1947b8f25882c0b23f212f204b | |
parent | d3a3baad5402a4c16afa40542956b4bee1e6a3ee (diff) | |
download | rt.equinox.p2-0ec6b2e3519f057d6bbe434c5b2fb112cc0544ec.tar.gz rt.equinox.p2-0ec6b2e3519f057d6bbe434c5b2fb112cc0544ec.tar.xz rt.equinox.p2-0ec6b2e3519f057d6bbe434c5b2fb112cc0544ec.zip |
Test for 300572
3 files changed, 161 insertions, 0 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 new file mode 100644 index 000000000..49c51750b --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/Bug300572.java @@ -0,0 +1,42 @@ +package org.eclipse.equinox.p2.tests.planner; + +import java.util.Iterator; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.equinox.p2.core.*; +import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.planner.*; +import org.eclipse.equinox.p2.query.IQueryResult; +import org.eclipse.equinox.p2.query.QueryUtil; +import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; +import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; + +public class Bug300572 extends AbstractProvisioningTest { + public void testInstallBabel() throws ProvisionException { + IProvisioningAgentProvider provider = getAgentProvider(); + IProvisioningAgent agent = provider.createAgent(getTestData("Bug300572 data", "testData/bug300572/p2").toURI()); + IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); + IMetadataRepository repo = repoMgr.loadRepository(getTestData("bug300572 data", "testData/bug300572/repo/").toURI(), new NullProgressMonitor()); + + IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME); + 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()); + + IProfileChangeRequest request = planner.createChangeRequest(sdkProfile); + IQueryResult<IInstallableUnit> allIUs = repo.query(QueryUtil.ALL_UNITS, null); + request.addAll(allIUs.toUnmodifiableSet()); + for (Iterator<IInstallableUnit> allIUsIterator = allIUs.iterator(); allIUsIterator.hasNext();) { + IInstallableUnit iu = allIUsIterator.next(); + request.setInstallableUnitInclusionRules(iu, ProfileInclusionRules.createOptionalInclusionRule(iu)); + } + + ProvisioningContext pc = new ProvisioningContext(agent); + + 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()); + } +} diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile/1273605777280.profile.gz b/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile/1273605777280.profile.gz Binary files differnew file mode 100644 index 000000000..045dbe762 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/p2/org.eclipse.equinox.p2.engine/profileRegistry/SDKProfile.profile/1273605777280.profile.gz diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/repo/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/repo/content.xml new file mode 100644 index 000000000..0f5a62c48 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug300572/repo/content.xml @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding='UTF-8'?> +<?metadataRepository version='1.1.0'?> +<repository name='file:/Users/Pascal/tmp/generated - metadata' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'> + <properties size='2'> + <property name='p2.timestamp' value='1273607589060'/> + <property name='p2.compressed' value='false'/> + </properties> + <units size='3'> + <unit id='hello' version='1.0.2.201001211536'> + <update id='hello' range='[0.0.0,1.0.2.201001211536)' severity='0'/> + <properties size='1'> + <property name='org.eclipse.equinox.p2.name' value='Hello'/> + </properties> + <provides size='3'> + <provided namespace='org.eclipse.equinox.p2.iu' name='hello' version='1.0.2.201001211536'/> + <provided namespace='osgi.bundle' name='hello' version='1.0.2.201001211536'/> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/> + </provides> + <requires size='2'> + <required namespace='osgi.bundle' name='org.eclipse.ui' range='0.0.0'/> + <required namespace='osgi.bundle' name='org.eclipse.core.runtime' range='0.0.0'/> + </requires> + <artifacts size='1'> + <artifact classifier='osgi.bundle' id='hello' version='1.0.2.201001211536'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='1'> + <instruction key='manifest'> + Bundle-ManifestVersion: 2
Bundle-ActivationPolicy: lazy
Bundle-Name: Hello
Bundle-Version: 1.0.2.201001211536
Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-SymbolicName: hello; singleton:=true
Manifest-Version: 1.0
Bundle-Activator: hello.Activator
 + </instruction> + </instructions> + </touchpointData> + </unit> + <unit id='hellopatch.feature.group' version='1.0.2.201001211536' singleton='false'> + <patchScope> + <scope> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='hellofeature.feature.group' range='[1.0.0.200911201237,1.0.0.200911201237]'/> + </requires> + </scope> + </patchScope> + <changes> + <change> + <from> + <required namespace='org.eclipse.equinox.p2.iu' name='hello' range='0.0.0'/> + </from> + <to> + <required namespace='org.eclipse.equinox.p2.iu' name='hello' range='[1.0.2.201001211536,1.0.2.201001211536]'/> + </to> + </change> + </changes> + <lifeCycle> + <required namespace='org.eclipse.equinox.p2.iu' name='hellofeature.feature.group' range='[1.0.0.200911201237,1.0.0.200911201237]' greedy='false'/> + </lifeCycle> + <update id='hellopatch.feature.group' range='[0.0.0,1.0.2.201001211536)' severity='0'/> + <properties size='5'> + <property name='org.eclipse.equinox.p2.type.patch' value='true'/> + <property name='org.eclipse.equinox.p2.name' value='Hellopatch 2 helloOnly'/> + <property name='org.eclipse.equinox.p2.description' value='[Enter Feature Description here.]'/> + <property name='org.eclipse.equinox.p2.description.url' value='http://www.example.com/description'/> + <property name='org.eclipse.equinox.p2.type.group' value='true'/> + </properties> + <provides size='1'> + <provided namespace='org.eclipse.equinox.p2.iu' name='hellopatch.feature.group' version='1.0.2.201001211536'/> + </provides> + <requires size='1'> + <required namespace='org.eclipse.equinox.p2.iu' name='hellopatch.feature.jar' range='[1.0.2.201001211536,1.0.2.201001211536]'> + <filter> + (org.eclipse.update.install.features=true) + </filter> + </required> + </requires> + <touchpoint id='null' version='0.0.0'/> + <licenses size='1'> + <license uri='http://www.example.com/license' url='http://www.example.com/license'> + [Enter License Description here.] + </license> + </licenses> + <copyright uri='http://www.example.com/copyright' url='http://www.example.com/copyright'> + [Enter Copyright Description here.] + </copyright> + </unit> + <unit id='hellopatch.feature.jar' version='1.0.2.201001211536'> + <properties size='3'> + <property name='org.eclipse.equinox.p2.name' value='Hellopatch 2 helloOnly'/> + <property name='org.eclipse.equinox.p2.description' value='[Enter Feature Description here.]'/> + <property name='org.eclipse.equinox.p2.description.url' value='http://www.example.com/description'/> + </properties> + <provides size='3'> + <provided namespace='org.eclipse.equinox.p2.iu' name='hellopatch.feature.jar' version='1.0.2.201001211536'/> + <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='feature' version='1.0.0'/> + <provided namespace='org.eclipse.update.feature' name='hellopatch' version='1.0.2.201001211536'/> + </provides> + <filter> + (org.eclipse.update.install.features=true) + </filter> + <artifacts size='1'> + <artifact classifier='org.eclipse.update.feature' id='hellopatch' version='1.0.2.201001211536'/> + </artifacts> + <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/> + <touchpointData size='1'> + <instructions size='1'> + <instruction key='zipped'> + true + </instruction> + </instructions> + </touchpointData> + <licenses size='1'> + <license uri='http://www.example.com/license' url='http://www.example.com/license'> + [Enter License Description here.] + </license> + </licenses> + <copyright uri='http://www.example.com/copyright' url='http://www.example.com/copyright'> + [Enter Copyright Description here.] + </copyright> + </unit> + </units> +</repository> |