summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2012-11-15 12:13:35 (EST)
committerPascal Rapicault2012-11-16 22:47:34 (EST)
commitec9d610cef62ad145beed343790e6f00751e451f (patch)
tree09d92dde6acaf55a9012a1aa7ef129ace87705ae
parent662affdbf4beadeaa2bfe93be4b5c01ccc080400 (diff)
downloadrt.equinox.p2-ec9d610cef62ad145beed343790e6f00751e451f.zip
rt.equinox.p2-ec9d610cef62ad145beed343790e6f00751e451f.tar.gz
rt.equinox.p2-ec9d610cef62ad145beed343790e6f00751e451f.tar.bz2
Add test with data in the user home
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.artifact.repository.prefs13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs13
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.lock0
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/state.properties1
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs2
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.prefs3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile4
9 files changed, 126 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
new file mode 100644
index 0000000..bfb6b63
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/src/org/eclipse/equinox/p2/tests/sharedinstall/SharedProfilePreferencesTestWithDataInUser.java
@@ -0,0 +1,86 @@
+package org.eclipse.equinox.p2.tests.sharedinstall;
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson 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:
+ * Pascal Rapicault (Ericsson) - Initial API and implementation
+ *******************************************************************************/
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.internal.preferences.EclipsePreferences;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.repository.Activator;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.TestActivator;
+import org.eclipse.equinox.security.storage.EncodingUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public class SharedProfilePreferencesTestWithDataInUser extends AbstractProvisioningTest {
+ protected File getTestData(String message, String entry) {
+ if (entry == null)
+ fail(message + " entry is null.");
+ URL base = Platform.getBundle("org.eclipse.equinox.p2.tests.sharedinstall").getEntry(entry);
+ if (base == null)
+ fail(message + " entry not found in bundle: " + entry);
+ try {
+ String osPath = new Path(FileLocator.toFileURL(base).getPath()).toOSString();
+ File result = new File(osPath);
+ if (!result.getCanonicalPath().equals(result.getPath()))
+ fail(message + " result path: " + result.getPath() + " does not match canonical path: " + result.getCanonicalFile().getPath());
+ return result;
+ } catch (IOException e) {
+ fail(message, e);
+ }
+ // avoid compile error... should never reach this code
+ return null;
+ }
+
+ protected void setUp() throws Exception {
+ //We don't call super.setUp() on purpose
+
+ Bundle p2Core = Platform.getBundle("org.eclipse.equinox.p2.core");
+ p2Core.stop();
+
+ File baseInstall = getTestData("test shared install", "testData/sharedPreferencesWithDataInUser/baseInstall");
+ File userHome = getTestData("test shared install", "testData/sharedPreferencesWithDataInUser/userHome");
+ System.setProperty("osgi.sharedConfiguration.area", new File(baseInstall, "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(Activator.getContext(), IPreferencesService.class.getName());
+ prefService.getRootNode().node("/profile/").removeNode();
+ p2Core.start();
+
+ //Make sure that things are properly setup
+ IProvisioningAgent currentAgent = getAgent();
+ assertEquals(currentAgent, ServiceHelper.getService(TestActivator.getContext(), IProvisioningAgent.class));
+ currentAgent.getService(IProvisioningAgent.SHARED_BASE_AGENT);
+ currentAgent.getService(IProvisioningAgent.SHARED_CURRENT_AGENT);
+ }
+
+ public void testCountRepoInSharedInstallThroughRepoManagerAPI() {
+ IMetadataRepositoryManager repoMgr = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ URI[] repos = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
+ assertEquals(4, repos.length);
+ }
+
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.artifact.repository.prefs b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.artifact.repository.prefs
new file mode 100644
index 0000000..8cb4991
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.artifact.repository.prefs
@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/count=1
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/enabled=true
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/nickname=The Eclipse Project Updates
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/uri=http\://download.eclipse.org/eclipse/updates/4.2
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/count=3
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/enabled=true
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/nickname=Mylyn for Eclipse Juno
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/uri=http\://download.eclipse.org/mylyn/releases/juno
+repositories/http\:__download.eclipse.org_releases_juno/count=1
+repositories/http\:__download.eclipse.org_releases_juno/enabled=true
+repositories/http\:__download.eclipse.org_releases_juno/nickname=Juno
+repositories/http\:__download.eclipse.org_releases_juno/uri=http\://download.eclipse.org/releases/juno
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs
new file mode 100644
index 0000000..8cb4991
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs
@@ -0,0 +1,13 @@
+eclipse.preferences.version=1
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/count=1
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/enabled=true
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/nickname=The Eclipse Project Updates
+repositories/http\:__download.eclipse.org_eclipse_updates_4.2/uri=http\://download.eclipse.org/eclipse/updates/4.2
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/count=3
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/enabled=true
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/nickname=Mylyn for Eclipse Juno
+repositories/http\:__download.eclipse.org_mylyn_releases_juno/uri=http\://download.eclipse.org/mylyn/releases/juno
+repositories/http\:__download.eclipse.org_releases_juno/count=1
+repositories/http\:__download.eclipse.org_releases_juno/enabled=true
+repositories/http\:__download.eclipse.org_releases_juno/nickname=Juno
+repositories/http\:__download.eclipse.org_releases_juno/uri=http\://download.eclipse.org/releases/juno
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.lock b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.lock
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.lock
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile
new file mode 100644
index 0000000..6f18bb0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?profile version='1.0.0'?>
+<profile id='epp.package.java' timestamp='1339695683273'>
+</profile>
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/state.properties b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/state.properties
new file mode 100644
index 0000000..bd469b5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/baseInstall/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/state.properties
@@ -0,0 +1 @@
+#Thu Jun 14 13:41:23 EDT 2012
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs
new file mode 100644
index 0000000..1831c80
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.metadata.repository.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+repositories/file\:_C\:_dev_tmp/uri=file\:/C\:/dev/tmp/
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.prefs b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.prefs
new file mode 100644
index 0000000..05c8680
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/.data/.settings/org.eclipse.equinox.p2.ui.sdk.prefs
@@ -0,0 +1,3 @@
+allowNonOKPlan=prompt
+eclipse.preferences.version=1
+showLatestVersion=true
diff --git a/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile
new file mode 100644
index 0000000..6f18bb0
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests.sharedinstall/testData/sharedPreferencesWithDataInUser/userHome/p2/org.eclipse.equinox.p2.engine/profileRegistry/epp.package.java.profile/1339695683273.profile
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<?profile version='1.0.0'?>
+<profile id='epp.package.java' timestamp='1339695683273'>
+</profile>