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 126054 Details for
Bug 262964
Unable to remove/disable repository
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]
Updated ArtifactRepositoryManagerTest
ArtifactRepoManagerTest.patch (text/plain), 4.59 KB, created by
Matthew Piggott
on 2009-02-18 13:09:57 EST
(
hide
)
Description:
Updated ArtifactRepositoryManagerTest
Filename:
MIME Type:
Creator:
Matthew Piggott
Created:
2009-02-18 13:09:57 EST
Size:
4.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java,v >retrieving revision 1.14 >diff -u -r1.14 ArtifactRepositoryManagerTest.java >--- src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java 12 Feb 2009 18:23:29 -0000 1.14 >+++ src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java 18 Feb 2009 18:08:00 -0000 >@@ -12,17 +12,21 @@ > > import java.io.File; > import java.io.IOException; >+import java.lang.reflect.Field; > import java.net.URI; > import java.net.URISyntaxException; > import junit.framework.Test; > import junit.framework.TestSuite; > import org.eclipse.core.runtime.IStatus; >-import org.eclipse.core.runtime.preferences.ConfigurationScope; >+import org.eclipse.core.runtime.preferences.IPreferencesService; > import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; >+import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager; > import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; > import org.eclipse.equinox.internal.provisional.p2.core.repository.*; >+import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; >+import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry; > import org.eclipse.equinox.p2.tests.*; > import org.osgi.framework.BundleException; > import org.osgi.service.prefs.BackingStoreException; >@@ -99,6 +103,23 @@ > * file is being overwritten by an update operation, thus losing all repository state. > */ > public void testLostArtifactRepositories() { >+ IProfile profile = getProfile(IProfileRegistry.SELF); >+ if (profile == null) { >+ if (System.getProperty("eclipse.p2.profile") == null) { >+ SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) ServiceHelper.getService(TestActivator.getContext(), IProfileRegistry.class.getName()); >+ try { >+ Field selfField = SimpleProfileRegistry.class.getDeclaredField("self"); //$NON-NLS-1$ >+ selfField.setAccessible(true); >+ Object self = selfField.get(profileRegistry); >+ if (self == null) >+ selfField.set(profileRegistry, "agent"); >+ } catch (Throwable t) { >+ fail(); >+ } >+ } >+ profile = createProfile(IProfileRegistry.SELF); >+ } >+ > File site = getTestData("Repository", "/testData/artifactRepo/simple/"); > URI location = site.toURI(); > manager.addRepository(location); >@@ -106,7 +127,8 @@ > > //bash the repository preference file (don't try this at home, kids) > final String REPO_BUNDLE = "org.eclipse.equinox.p2.artifact.repository"; >- Preferences prefs = new ConfigurationScope().getNode(REPO_BUNDLE).node("repositories"); >+ IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName()); >+ Preferences prefs = prefService.getRootNode().node("/profile/_SELF_/" + REPO_BUNDLE + "/repositories"); //$NON-NLS-1$ //$NON-NLS-2$ > try { > String[] children = prefs.childrenNames(); > for (int i = 0; i < children.length; i++) >@@ -127,6 +149,26 @@ > //everybody's happy again > manager = (IArtifactRepositoryManager) ServiceHelper.getService(TestActivator.context, IArtifactRepositoryManager.class.getName()); > assertTrue("1.0", manager.contains(location)); >+ >+ // Clean-up >+ try { >+ prefService.getRootNode().node("/profile/_SELF_").removeNode(); >+ } catch (BackingStoreException e) { >+ // Exception can be ignored as we're simply attempting to cleanup for other tests >+ } >+ >+ if (System.getProperty("eclipse.p2.profile") == null) { >+ SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) ServiceHelper.getService(TestActivator.getContext(), IProfileRegistry.class.getName()); >+ try { >+ Field selfField = SimpleProfileRegistry.class.getDeclaredField("self"); //$NON-NLS-1$ >+ selfField.setAccessible(true); >+ Object self = selfField.get(profileRegistry); >+ if (self.equals("agent")) >+ selfField.set(profileRegistry, null); >+ } catch (Throwable t) { >+ // ignore as we still want to continue tidying up >+ } >+ } > } > > public void testNickname() throws ProvisionException {
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 262964
:
126052
|
126054
|
126195
|
126196
|
126198
|
126565