Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 125938 Details for
Bug 264389
[publisher] Use modified url as site qualifier
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Qualifier patch
clipboard.txt (text/plain), 8.11 KB, created by
Ian Bull
on 2009-02-17 15:36:49 EST
(
hide
)
Description:
Qualifier patch
Filename:
MIME Type:
Creator:
Ian Bull
Created:
2009-02-17 15:36:49 EST
Size:
8.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java,v >retrieving revision 1.2 >diff -u -r1.2 SiteXMLActionTest.java >--- src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java 12 Feb 2009 22:22:39 -0000 1.2 >+++ src/org/eclipse/equinox/p2/tests/updatesite/SiteXMLActionTest.java 17 Feb 2009 20:37:36 -0000 >@@ -10,14 +10,21 @@ > *******************************************************************************/ > package org.eclipse.equinox.p2.tests.updatesite; > >+import java.io.File; > import java.net.URI; > import java.util.Collection; > import java.util.Iterator; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.URIUtil; > import org.eclipse.equinox.internal.p2.updatesite.SiteXMLAction; > import org.eclipse.equinox.internal.provisional.p2.core.repository.IRepository; > import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; >+import org.eclipse.equinox.internal.provisional.p2.metadata.query.IUPropertyQuery; >+import org.eclipse.equinox.internal.provisional.p2.query.Collector; >+import org.eclipse.equinox.internal.provisional.p2.query.Query; > import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.RepositoryReference; > import org.eclipse.equinox.p2.publisher.*; >+import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction; > import org.eclipse.equinox.p2.tests.*; > > /** >@@ -25,17 +32,33 @@ > */ > public class SiteXMLActionTest extends AbstractProvisioningTest { > private TestMetadataRepository metadataRepository; >+ private IPublisherResult actionResult; >+ private URI siteLocation; > > @Override > protected void setUp() throws Exception { > super.setUp(); >- IPublisherResult result = new PublisherResult(); >+ actionResult = new PublisherResult(); > PublisherInfo info = new PublisherInfo(); > metadataRepository = new TestMetadataRepository(new IInstallableUnit[0]); > info.setMetadataRepository(metadataRepository); >- URI siteLocation = TestData.getFile("updatesite", "SiteXMLActionTest/site.xml").toURI(); >+ siteLocation = TestData.getFile("updatesite", "SiteXMLActionTest/site.xml").toURI(); >+ FeaturesAction featuresAction = new FeaturesAction(new File[] {TestData.getFile("updateSite", "SiteXMLActionTest")}); >+ featuresAction.perform(info, actionResult, new NullProgressMonitor()); >+ > SiteXMLAction action = new SiteXMLAction(siteLocation); >- action.perform(info, result, getMonitor()); >+ action.perform(info, actionResult, getMonitor()); >+ } >+ >+ public void testQualifier() { >+ Query categoryQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.toString(true)); >+ Collector results = actionResult.query(categoryQuery, new Collector(), new NullProgressMonitor()); >+ Iterator iter = results.iterator(); >+ while (iter.hasNext()) { >+ IInstallableUnit unit = (IInstallableUnit) iter.next(); >+ assertTrue("1.0", unit.getId().startsWith(URIUtil.toUnencodedString(siteLocation))); >+ assertEquals("2.0", "Test Category Label", unit.getProperty(IInstallableUnit.PROP_NAME)); >+ } > } > > /** >#P org.eclipse.equinox.p2.updatesite >Index: src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java,v >retrieving revision 1.16 >diff -u -r1.16 SiteXMLAction.java >--- src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java 12 Feb 2009 22:22:40 -0000 1.16 >+++ src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java 17 Feb 2009 20:37:40 -0000 >@@ -39,6 +39,7 @@ > private SiteCategory defaultCategory; > private HashSet defaultCategorySet; > private URI location; >+ private String categoryQualifier = null; > > public SiteXMLAction(URI location) { > this.location = location; >@@ -48,6 +49,13 @@ > this.updateSite = updateSite; > } > >+ /** >+ * Sets the qualifier that will be prepended to the front of category names >+ */ >+ public void setCategoryQualifier(String categoryQualifier) { >+ this.categoryQualifier = categoryQualifier; >+ } >+ > private void initialize() { > if (defaultCategory != null) > return; >@@ -236,7 +244,8 @@ > protected void generateCategoryIUs(Map categoriesToFeatures, IPublisherResult result) { > for (Iterator it = categoriesToFeatures.keySet().iterator(); it.hasNext();) { > SiteCategory category = (SiteCategory) it.next(); >- result.addIU(createCategoryIU(category, (Set) categoriesToFeatures.get(category), null), IPublisherResult.NON_ROOT); >+ String qualifier = createQualifier(); >+ result.addIU(createCategoryIU(category, (Set) categoriesToFeatures.get(category), null, qualifier), IPublisherResult.NON_ROOT); > } > } > >@@ -247,10 +256,10 @@ > * @param parentCategory The parent category, or <code>null</code> > * @return an IU representing the category > */ >- public static IInstallableUnit createCategoryIU(SiteCategory category, Set featureIUs, IInstallableUnit parentCategory) { >+ public static IInstallableUnit createCategoryIU(SiteCategory category, Set featureIUs, IInstallableUnit parentCategory, String categoryQualifier) { > InstallableUnitDescription cat = new MetadataFactory.InstallableUnitDescription(); > cat.setSingleton(true); >- String categoryId = category.getName(); >+ String categoryId = categoryQualifier + category.getName(); > cat.setId(categoryId); > cat.setVersion(Version.emptyVersion); > cat.setProperty(IInstallableUnit.PROP_NAME, category.getLabel()); >@@ -293,4 +302,16 @@ > return MetadataFactory.createInstallableUnit(cat); > } > >+ /** >+ * Creates a qualifier that can be prepended to a category to the category is unique >+ * between multiple repositories >+ */ >+ private String createQualifier() { >+ if (categoryQualifier != null) >+ return categoryQualifier; >+ if (updateSite != null) >+ return URIUtil.toUnencodedString(updateSite.getLocation()) + "."; //$NON-NLS-1$ >+ return ""; //$NON-NLS-1$ >+ } >+ > } >Index: src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java,v >retrieving revision 1.4 >diff -u -r1.4 RemoteUpdateSiteAction.java >--- src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java 9 Oct 2008 03:21:48 -0000 1.4 >+++ src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java 17 Feb 2009 20:37:40 -0000 >@@ -10,8 +10,6 @@ > ******************************************************************************/ > package org.eclipse.equinox.internal.p2.updatesite; > >-import java.net.URI; >-import java.net.URISyntaxException; > import java.util.ArrayList; > import org.eclipse.core.runtime.*; > import org.eclipse.equinox.p2.publisher.*; >@@ -30,10 +28,6 @@ > this.updateSite = updateSite; > } > >- public RemoteUpdateSiteAction(String source) { >- this.source = source; >- } >- > public IStatus perform(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) { > IPublisherAction[] actions = createActions(); > MultiStatus finalStatus = new MultiStatus(this.getClass().getName(), 0, NLS.bind(Messages.Error_Generation, source != null ? source : (updateSite != null ? updateSite.getLocation().toString() : "Unknown")), null); //$NON-NLS-1$ >@@ -55,16 +49,6 @@ > } > > private IPublisherAction createSiteXMLAction() { >- if (updateSite != null) >- return new SiteXMLAction(updateSite); >- if (source != null) { >- try { >- return new SiteXMLAction(new URI(source + "/site.xml")); //$NON-NLS-1$ >- } catch (URISyntaxException e) { >- // never happens >- return null; >- } >- } >- return null; >+ return new SiteXMLAction(updateSite); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264389
:
125938
|
125939
|
126082
|
126083
|
126197
|
126200
|
126667
|
126670
|
126671