summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-04-30 13:04:49 (EDT)
committerPascal Rapicault2013-04-30 13:04:49 (EDT)
commit49c0ea682d29f48f1fb5cc740e25c1e10bc74584 (patch)
tree00e92e994d73b28e4c88ef6389f9e3fa7afde592
parent3d5562b8aa0c120030eb794c0f849ae295a20bd3 (diff)
downloadrt.equinox.p2-49c0ea682d29f48f1fb5cc740e25c1e10bc74584.zip
rt.equinox.p2-49c0ea682d29f48f1fb5cc740e25c1e10bc74584.tar.gz
rt.equinox.p2-49c0ea682d29f48f1fb5cc740e25c1e10bc74584.tar.bz2
Bug 406935 - [shared] testCountReposInSharedInstallPreferences fails onI20130501-1400I20130501-1100I20130501-0800I20130430-2000
linux
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java4
2 files changed, 12 insertions, 4 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 a81b799..3a26721 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);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
index abe4513..3fdf1e2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
@@ -44,9 +44,9 @@ public class SharedProfilePreferencesTestWithDataInUser extends AbstractProvisio
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");
+ System.setProperty("eclipse.p2.data.area", "@config.dir/../p2");
IPreferencesService prefService = (IPreferencesService) ServiceHelper.getService(Activator.getContext(), IPreferencesService.class.getName());
prefService.getRootNode().node("/profile/").removeNode();
p2Core.start();