Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
index a81b79950..3a2672155 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java
@@ -47,7 +47,7 @@ public class SharedProfilePreferencesTest extends AbstractProvisioningTest {
copy("copy user home data", userHomeToCopy, userHomeToCopyTo);
System.setProperty("osgi.sharedConfiguration.area", new File(baseInstall, "configuration").toURI().toString());
- System.setProperty("osgi.configuration.area", new File(userHome, "configuration").toURI().toString());
+ System.setProperty("osgi.configuration.area", new File(userHome, "configuration").toURI().toString() + '/');
System.setProperty("eclipse.p2.profile", "epp.package.java");
System.setProperty("eclipse.p2.data.area", "@config.dir/../p2");
IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName());
@@ -59,7 +59,7 @@ public class SharedProfilePreferencesTest extends AbstractProvisioningTest {
IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(TestActivator.getContext(), IPreferencesService.class.getName());
assertNotNull(prefService);
try {
- URI defaultLocation = URIUtil.makeAbsolute(URIUtil.fromString(TestActivator.getContext().getProperty("osgi.configuration.area") + "/../p2/"), new URI("."));
+ URI defaultLocation = adjustTrailingSlash(URIUtil.makeAbsolute(URIUtil.fromString(TestActivator.getContext().getProperty("osgi.configuration.area") + "/../p2/"), new URI(".")), true);
String locationString = EncodingUtils.encodeSlashes(defaultLocation.toString());
Preferences node = prefService.getRootNode().node("/profile/shared/" + locationString + "/_SELF_/org.eclipse.equinox.p2.metadata.repository/repositories"); //$NON-NLS-1$
String[] children = node.childrenNames();
@@ -74,6 +74,14 @@ public class SharedProfilePreferencesTest extends AbstractProvisioningTest {
}
+ private static URI adjustTrailingSlash(URI url, boolean trailingSlash) throws URISyntaxException {
+ String file = url.toString();
+ if (trailingSlash == (file.endsWith("/"))) //$NON-NLS-1$
+ return url;
+ file = trailingSlash ? file + "/" : file.substring(0, file.length() - 1); //$NON-NLS-1$
+ return new URI(file);
+ }
+
public void testCountRepoInSharedInstallThroughRepoManagerAPI() {
IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
URI[] repos = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);

Back to the top