summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2013-05-24 19:38:11 (EDT)
committerPascal Rapicault2013-05-24 20:40:46 (EDT)
commit073f17a77e68de6bb726a143fe40d1b7000f8df5 (patch)
tree43e2d78489f8ad1aa19ba85037a2bc9ab0994166
parent7998ef5c4036704351f25dbbd19ddc1fc7e1438c (diff)
downloadrt.equinox.p2-073f17a77e68de6bb726a143fe40d1b7000f8df5.zip
rt.equinox.p2-073f17a77e68de6bb726a143fe40d1b7000f8df5.tar.gz
rt.equinox.p2-073f17a77e68de6bb726a143fe40d1b7000f8df5.tar.bz2
Bug 409051 - [planner] Resolver times out on simple instance
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java
new file mode 100644
index 0000000..2c25f1a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/planner/TychoUsage.java
@@ -0,0 +1,88 @@
+package org.eclipse.equinox.p2.tests.planner;
+
+import java.net.URISyntaxException;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.director.Projector;
+import org.eclipse.equinox.internal.p2.director.Slicer;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+public class TychoUsage extends AbstractProvisioningTest {
+
+ private IInstallableUnit topLevelIU;
+ private IProfile profile;
+
+ private void setupTopLevelIU() {
+ IRequirement[] reqPlatform1 = new IRequirement[1];
+ reqPlatform1[0] = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.emf.sdk.feature.group", new VersionRange("[2.7.2.v20120130-0943, 2.7.2.v20120130-0943]"), null, false, false, true);
+ Properties p = new Properties();
+ topLevelIU = createIU("topLevelIU", Version.create("1.0.0"), null, reqPlatform1, new IProvidedCapability[0], p, null, null, true);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setupTopLevelIU();
+ }
+
+ public void testEquivalentP2Call() {
+ try {
+ loadMetadataRepository(URIUtil.fromString("http://download.eclipse.org/releases/indigo"));
+ profile = createProfile("TestProfile." + getName());
+ IProfileChangeRequest pcr = getPlanner(getAgent()).createChangeRequest(profile);
+ pcr.add(topLevelIU);
+ System.out.println(System.currentTimeMillis());
+ assertResolve(pcr, getPlanner(getAgent()));
+ System.out.println(System.currentTimeMillis());
+ } catch (ProvisionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (OperationCanceledException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ public void testTychoUsage() {
+ try {
+ IMetadataRepository repo = loadMetadataRepository(URIUtil.fromString("http://download.eclipse.org/releases/indigo"));
+ IInstallableUnit newRoot1 = repo.query(QueryUtil.createIUQuery("org.eclipse.emf.sdk.feature.group", Version.create("2.7.2.v20120130-0943")), new NullProgressMonitor()).iterator().next();
+ Collection<IInstallableUnit> newRoots = new ArrayList<>();
+ newRoots.add(newRoot1);
+
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("osgi.ws", "win32");
+ context.put("osgi.os", "win32");
+ context.put("osgi.arch", "x86_64");
+ context.put("org.eclipse.update.install.features", "true");
+
+ Slicer slicer = new Slicer(repo, context, false);
+ IQueryable<IInstallableUnit> slice = slicer.slice(new IInstallableUnit[] {topLevelIU}, new NullProgressMonitor());
+
+ Projector p = new Projector(slice, context, new HashSet<IInstallableUnit>(), false);
+ p.encode(topLevelIU, new IInstallableUnit[0], new Collector<IInstallableUnit>(), newRoots, new NullProgressMonitor());
+ IStatus result = p.invokeSolver(new NullProgressMonitor());
+ assertTrue(result.isOK() || result.getSeverity() == IStatus.WARNING);
+ assertFalse(p.extractSolution().isEmpty());
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ProvisionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (OperationCanceledException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}