Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-04-21 20:55:13 -0400
committerSusan Franklin2010-04-21 20:55:13 -0400
commit187dd473bda839f352a947ae27b87edcf66e3e6b (patch)
treef0ee11b53d575b2c84f89d3b4150bd1cc44f8495 /bundles/org.eclipse.equinox.p2.tests.ui
parentb195745e69fe4ef35dae5ebf08bdd74d7e382d2d (diff)
downloadrt.equinox.p2-187dd473bda839f352a947ae27b87edcf66e3e6b.tar.gz
rt.equinox.p2-187dd473bda839f352a947ae27b87edcf66e3e6b.tar.xz
rt.equinox.p2-187dd473bda839f352a947ae27b87edcf66e3e6b.zip
Bug 299818 - [ui] Uninstall should not contact the external world
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/AllTests.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallTest.java51
2 files changed, 52 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/AllTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/AllTests.java
index 6c7724ebf..d79be131f 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/AllTests.java
@@ -22,6 +22,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(SizingTest.class);
suite.addTestSuite(InstallerPlanTest.class);
suite.addTestSuite(UpdatePlanning.class);
+ suite.addTestSuite(UninstallTest.class);
return suite;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallTest.java
new file mode 100644
index 000000000..6622e783a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/UninstallTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.ui.operations;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
+import org.eclipse.equinox.p2.operations.UninstallOperation;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.tests.ui.AbstractProvisioningUITest;
+
+/**
+ * Tests for the ability to install an IU that has an installer plan by
+ * using the operation API.
+ */
+public class UninstallTest extends AbstractProvisioningUITest {
+ public void testUninstallContactsNoRepositories() throws ProvisionException, URISyntaxException {
+
+ HashSet<IInstallableUnit> ius = new HashSet<IInstallableUnit>();
+ ius.add(top1);
+ UninstallOperation op = new UninstallOperation(getSession(), ius);
+ // We set the provisioning context to the same one we use for install
+ ProvisioningContext pc = new ProvisioningContext(getAgent());
+ pc.setArtifactRepositories(new URI[] {testRepoLocation});
+ pc.setMetadataRepositories(new URI[] {testRepoLocation});
+ op.setProvisioningContext(pc);
+ op.setProfileId(TESTPROFILE);
+ assertTrue("Should resolve", op.resolveModal(getMonitor()).isOK());
+
+ // The provisioning context actually used should have nothing (because the first pass is to try with no repos)
+ pc = op.getProvisioningPlan().getContext();
+ IQueryable<IInstallableUnit> queryable = pc.getMetadata(getMonitor());
+ assertTrue("metadata queryable should be empty", queryable.query(QueryUtil.ALL_UNITS, getMonitor()).isEmpty());
+ IQueryable<IArtifactRepository> artifactQueryable = pc.getArtifactRepositories(getMonitor());
+ IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
+ assertTrue("artifact queryable should be empty", artifactQueryable.query(all, getMonitor()).isEmpty());
+ }
+}

Back to the top