summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-04-30 16:44:39 (EDT)
committerPascal Rapicault2012-04-30 16:44:39 (EDT)
commitcbf14048c0741b8fb2fabf0eb8574deabe8d5062 (patch)
tree6e37619542dce6217a0fdef41e6e24f194bbac8e
parentbfb61cce27c4a783924cf196073ebd82129bef8a (diff)
downloadrt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.zip
rt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.tar.gz
rt.equinox.p2-cbf14048c0741b8fb2fabf0eb8574deabe8d5062.tar.bz2
Bug 338495 - [ui] composite children prevent explicit repo additionv20120430-2044I20120430-2000I20120430-1800
("Duplicate location" when adding update site)
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java4
-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
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/one/content.xml103
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/two/content.xml109
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java2
6 files changed, 53 insertions, 208 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
index 494759743..20b61da 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
@@ -112,8 +112,6 @@ public abstract class RepositoryTracker {
if (!localValidationStatus.isOK())
return localValidationStatus;
- if (contains(location, session))
- return new Status(IStatus.ERROR, Activator.ID, IStatusCodes.INVALID_REPOSITORY_LOCATION, Messages.RepositoryTracker_DuplicateLocation, null);
return Status.OK_STATUS;
}
@@ -126,7 +124,7 @@ public abstract class RepositoryTracker {
* @since 2.1
*/
protected boolean contains(URI location, ProvisioningSession session) {
- // This is a fallback implementation in the absence of a repository manager
+ // This is a fallback implementation in the absence of a repository tracker
// that would know what to do.
URI[] knownRepositories = getKnownRepositories(session);
for (int i = 0; i < knownRepositories.length; i++) {
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 76fdf0e..6f9f772 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 0000000..240c3cf
--- /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));
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/one/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/one/content.xml
index 41f172f..d77f292 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/one/content.xml
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/one/content.xml
@@ -1,83 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<?metadataRepository class='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1.0.0'?>
-<repository name='Good Test Repository' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1' description='Good test repository description'>
- <properties size='3'>
- <property name='p2.system' value='true'/>
- <property name='p2.timestamp' value='1221680367875'/>
- <property name='site.checksum' value='2404093275'/>
- </properties>
- <units size='5'>
- <unit id='test.feature.feature.jar' version='1.0.0'>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.jar' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='feature' version='1.0.0'/>
- <provided namespace='org.eclipse.update.feature' name='test.feature' version='1.0.0'/>
- </provides>
- <filter>
- (org.eclipse.update.install.features=true)
- </filter>
- <artifacts size='1'>
- <artifact classifier='org.eclipse.update.feature' id='test.feature' version='1.0.0'/>
- </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 url='http://www.example.com/license'>
- [Enter License Description here.]
- </license>
- </licenses>
- <copyright url='http://www.example.com/copyright'>
- [Enter Copyright Description here.]
- </copyright>
- </unit>
- <unit id='test.bundle' version='1.0.0' singleton='false'>
- <update id='test.bundle' range='[0.0.0,1.0.0)' severity='0'/>
- <properties size='1'>
- <property name='org.eclipse.equinox.p2.partial.iu' value='true'/>
- </properties>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.bundle' version='1.0.0'/>
- <provided namespace='osgi.bundle' name='test.bundle' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
- </provides>
- <artifacts size='1'>
- <artifact classifier='osgi.bundle' id='test.bundle' version='1.0.0'/>
- </artifacts>
- <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
- <touchpointData size='1'>
- <instructions size='1'>
- <instruction key='manifest'>
- </instruction>
- </instructions>
- </touchpointData>
- </unit>
- <unit id='test.fragment' version='1.0.0' singleton='false'>
- <update id='test.fragment' range='[0.0.0,1.0.0)' severity='0'/>
- <properties size='1'>
- <property name='org.eclipse.equinox.p2.partial.iu' value='true'/>
- </properties>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.fragment' version='1.0.0'/>
- <provided namespace='osgi.bundle' name='test.fragment' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
- </provides>
- <artifacts size='1'>
- <artifact classifier='osgi.bundle' id='test.fragment' version='1.0.0'/>
- </artifacts>
- <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
- <touchpointData size='1'>
- <instructions size='1'>
- <instruction key='manifest'>
- </instruction>
- </instructions>
- </touchpointData>
- </unit>
+<repository name='Repo one' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1' description='Good test repository description'>
+ <units size='1'>
<unit id='test.feature.feature.group' version='1.0.0' singleton='false'>
<update id='test.feature.feature.group' range='[0.0.0,1.0.0)' severity='0'/>
<properties size='5'>
@@ -91,15 +15,6 @@
<provided namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.group' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
</provides>
- <requires size='3'>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.bundle' range='[1.0.0,1.0.0]'/>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.fragment' range='[1.0.0,1.0.0]'/>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.jar' range='[1.0.0,1.0.0]'>
- <filter>
- (org.eclipse.update.install.features=true)
- </filter>
- </required>
- </requires>
<touchpoint id='null' version='0.0.0'/>
<licenses size='1'>
<license url='http://www.example.com/license'>
@@ -110,19 +25,5 @@
[Enter Copyright Description here.]
</copyright>
</unit>
- <unit id='Default' version='0.0.0'>
- <properties size='3'>
- <property name='org.eclipse.equinox.p2.name' value='Uncategorized'/>
- <property name='org.eclipse.equinox.p2.description' value='Default category for otherwise uncategorized features'/>
- <property name='org.eclipse.equinox.p2.type.category' value='true'/>
- </properties>
- <provides size='1'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='Default' version='0.0.0'/>
- </provides>
- <requires size='1'>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.group' range='[1.0.0,1.0.0]'/>
- </requires>
- <touchpoint id='null' version='0.0.0'/>
- </unit>
</units>
</repository>
diff --git a/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/two/content.xml b/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/two/content.xml
index fd315db..48a0421 100644
--- a/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/two/content.xml
+++ b/bundles/org.eclipse.equinox.p2.tests/testData/bug338495/good.local/two/content.xml
@@ -1,85 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<?metadataRepository class='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1.0.0'?>
-<repository name='update site: file:/C:/1target/provmiddle/org.eclipse.equinox.p2.tests/testData/updatesite/site' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'>
- <properties size='3'>
- <property name='p2.system' value='true'/>
- <property name='p2.timestamp' value='1221680367875'/>
- <property name='site.checksum' value='2404093275'/>
- </properties>
- <units size='5'>
- <unit id='test.feature.feature.jar' version='1.0.0'>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.jar' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='feature' version='1.0.0'/>
- <provided namespace='org.eclipse.update.feature' name='test.feature' version='1.0.0'/>
- </provides>
- <filter>
- (org.eclipse.update.install.features=true)
- </filter>
- <artifacts size='1'>
- <artifact classifier='org.eclipse.update.feature' id='test.feature' version='1.0.0'/>
- </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 url='http://www.example.com/license'>
- [Enter License Description here.]
- </license>
- </licenses>
- <copyright url='http://www.example.com/copyright'>
- [Enter Copyright Description here.]
- </copyright>
- </unit>
- <unit id='test.bundle' version='1.0.0' singleton='false'>
- <update id='test.bundle' range='[0.0.0,1.0.0)' severity='0'/>
- <properties size='1'>
- <property name='org.eclipse.equinox.p2.partial.iu' value='true'/>
- </properties>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.bundle' version='1.0.0'/>
- <provided namespace='osgi.bundle' name='test.bundle' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
- </provides>
- <artifacts size='1'>
- <artifact classifier='osgi.bundle' id='test.bundle' version='1.0.0'/>
- </artifacts>
- <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
- <touchpointData size='1'>
- <instructions size='1'>
- <instruction key='manifest'>
- </instruction>
- </instructions>
- </touchpointData>
- </unit>
- <unit id='test.fragment' version='1.0.0' singleton='false'>
- <update id='test.fragment' range='[0.0.0,1.0.0)' severity='0'/>
- <properties size='1'>
- <property name='org.eclipse.equinox.p2.partial.iu' value='true'/>
- </properties>
- <provides size='3'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.fragment' version='1.0.0'/>
- <provided namespace='osgi.bundle' name='test.fragment' version='1.0.0'/>
- <provided namespace='org.eclipse.equinox.p2.eclipse.type' name='bundle' version='1.0.0'/>
- </provides>
- <artifacts size='1'>
- <artifact classifier='osgi.bundle' id='test.fragment' version='1.0.0'/>
- </artifacts>
- <touchpoint id='org.eclipse.equinox.p2.osgi' version='1.0.0'/>
- <touchpointData size='1'>
- <instructions size='1'>
- <instruction key='manifest'>
- </instruction>
- </instructions>
- </touchpointData>
- </unit>
- <unit id='test.feature.feature.group' version='1.0.0' singleton='false'>
- <update id='test.feature.feature.group' range='[0.0.0,1.0.0)' severity='0'/>
+<repository name='Repo two' type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'>
+ <units size='1'>
+ <unit id='other.feature.feature.group' version='1.0.0' singleton='false'>
+ <update id='other.feature.feature.group' range='[0.0.0,1.0.0)' severity='0'/>
<properties size='5'>
<property name='org.eclipse.equinox.p2.name' value='%featurename'/>
<property name='org.eclipse.equinox.p2.description' value='[Enter Feature Description here.]'/>
@@ -88,18 +12,9 @@
<property name='df_LT.featurename' value='j the feature'/>
</properties>
<provides size='2'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.group' version='1.0.0'/>
+ <provided namespace='org.eclipse.equinox.p2.iu' name='other.feature.feature.group' version='1.0.0'/>
<provided namespace='org.eclipse.equinox.p2.localization' name='df_LT' version='1.0.0'/>
</provides>
- <requires size='3'>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.bundle' range='[1.0.0,1.0.0]'/>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.fragment' range='[1.0.0,1.0.0]'/>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.jar' range='[1.0.0,1.0.0]'>
- <filter>
- (org.eclipse.update.install.features=true)
- </filter>
- </required>
- </requires>
<touchpoint id='null' version='0.0.0'/>
<licenses size='1'>
<license url='http://www.example.com/license'>
@@ -110,19 +25,5 @@
[Enter Copyright Description here.]
</copyright>
</unit>
- <unit id='Default' version='0.0.0'>
- <properties size='3'>
- <property name='org.eclipse.equinox.p2.name' value='Uncategorized'/>
- <property name='org.eclipse.equinox.p2.description' value='Default category for otherwise uncategorized features'/>
- <property name='org.eclipse.equinox.p2.type.category' value='true'/>
- </properties>
- <provides size='1'>
- <provided namespace='org.eclipse.equinox.p2.iu' name='Default' version='0.0.0'/>
- </provides>
- <requires size='1'>
- <required namespace='org.eclipse.equinox.p2.iu' name='test.feature.feature.group' range='[1.0.0,1.0.0]'/>
- </requires>
- <touchpoint id='null' version='0.0.0'/>
- </unit>
</units>
</repository>
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
index 6ae05ef..2e91045 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
@@ -62,6 +62,8 @@ public class ColocatedRepositoryTracker extends RepositoryTracker {
try {
getMetadataRepositoryManager().addRepository(repoLocation);
getArtifactRepositoryManager().addRepository(repoLocation);
+ getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_SYSTEM, Boolean.FALSE.toString());
+ getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_SYSTEM, Boolean.FALSE.toString());
if (nickname != null) {
getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);