Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-04-30 16:44:39 -0400
committerPascal Rapicault2012-04-30 16:44:39 -0400
commitcbf14048c0741b8fb2fabf0eb8574deabe8d5062 (patch)
tree6e37619542dce6217a0fdef41e6e24f194bbac8e /bundles/org.eclipse.equinox.p2.tests.ui
parentbfb61cce27c4a783924cf196073ebd82129bef8a (diff)
downloadrt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.tar.gz
rt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.tar.xz
rt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.zip
Bug 338495 - [ui] composite children prevent explicit repo additionv20120430-2044I20120430-2000I20120430-1800
("Duplicate location" when adding update site)
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/ColocatedRepositoryTrackerTest.java42
2 files changed, 43 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 76fdf0eea..6f9f7725c 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
@@ -19,6 +19,7 @@ public class AllTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(ColocatedRepositoryTrackerTest.class);
suite.addTestSuite(SizingTest.class);
suite.addTestSuite(InstallOperationTests.class);
suite.addTestSuite(UpdateOperationTests.class);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/ColocatedRepositoryTrackerTest.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/ColocatedRepositoryTrackerTest.java
new file mode 100644
index 000000000..240c3cf8e
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/ui/operations/ColocatedRepositoryTrackerTest.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Sonatype, Inc. 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:
+ * Sonatype, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.ui.operations;
+
+import java.net.URI;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.equinox.internal.p2.ui.ColocatedRepositoryTracker;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+public class ColocatedRepositoryTrackerTest extends AbstractProvisioningTest {
+ public void testAdditionOfChildren() throws ProvisionException, OperationCanceledException {
+ final String compositeRepo = "testData/bug338495/good.local";
+ final URI compositeRepoURI = getTestData("composite repo", compositeRepo).toURI();
+ final String childRepo = "testData/bug338495/good.local/one";
+ final URI childRepoOneURI = getTestData("composite repo", childRepo).toURI();
+
+ ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
+ ProvisioningSession provSession = provUI.getSession();
+
+ ColocatedRepositoryTracker tracker = new ColocatedRepositoryTracker(provUI);
+ tracker.addRepository(compositeRepoURI, "main", provSession);
+ getMetadataRepositoryManager().loadRepository(compositeRepoURI, new NullProgressMonitor()); //Force the loading the composite repo to show the problem
+ assertOK(tracker.validateRepositoryLocation(ProvisioningUI.getDefaultUI().getSession(), childRepoOneURI, false, new NullProgressMonitor()));
+ tracker.addRepository(childRepoOneURI, "child", provSession);
+
+ assertTrue(getMetadataRepositoryManager().isEnabled(childRepoOneURI));
+ assertEquals(Boolean.FALSE.toString(), getMetadataRepositoryManager().getRepositoryProperty(childRepoOneURI, IRepository.PROP_SYSTEM));
+ }
+}

Back to the top