Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2010-03-29 14:50:10 +0000
committerJohn Arthorne2010-03-29 14:50:10 +0000
commit5355dcb2f2fae3ddb4eaae49d7c330e08c3a8853 (patch)
tree803cf71d1122c931e7f0d5d7ee18adbc2e140454 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core
parent513b560bc1b7e8902a0a450f9638c81ee8ca18af (diff)
downloadrt.equinox.p2-5355dcb2f2fae3ddb4eaae49d7c330e08c3a8853.tar.gz
rt.equinox.p2-5355dcb2f2fae3ddb4eaae49d7c330e08c3a8853.tar.xz
rt.equinox.p2-5355dcb2f2fae3ddb4eaae49d7c330e08c3a8853.zip
Tests for Bug 307151 - In Eclipse 3.6M6, ProfilePreferences remembers stopped provisioning agent in the saveJob
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AllTests.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java59
2 files changed, 64 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AllTests.java
index 296b16f4d..0fd968113 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 IBM Corporation 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
@@ -19,14 +19,15 @@ public class AllTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTestSuite(AggregateQueryTest.class);
+ suite.addTestSuite(BackupTest.class);
suite.addTestSuite(CollectorTest.class);
+ suite.addTestSuite(CompoundQueryableTest.class);
suite.addTestSuite(FileUtilsTest.class);
suite.addTestSuite(OrderedPropertiesTest.class);
+ suite.addTestSuite(ProvisioningAgentTest.class);
suite.addTestSuite(QueryTest.class);
- suite.addTestSuite(AggregateQueryTest.class);
- suite.addTestSuite(CompoundQueryableTest.class);
suite.addTestSuite(URLUtilTest.class);
- suite.addTestSuite(BackupTest.class);
return suite;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
new file mode 100644
index 000000000..c6e58dd77
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ProvisioningAgentTest.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.p2.tests.core;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+import org.eclipse.equinox.p2.tests.TestActivator;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Tests for {@link IProvisioningAgent} and related API.
+ */
+public class ProvisioningAgentTest extends AbstractProvisioningTest {
+ /**
+ * See bug 307151 and bug 304899.
+ * @throws ProvisionException
+ * @throws URISyntaxException
+ */
+ public void testMultipleAgents() throws ProvisionException, URISyntaxException {
+ URI repoLocation = new URI("http://download.eclipse.org/eclipse/updates/3.6");
+ URI p2location = getTempFolder().toURI();
+ String PROFILE_ID = "testMultipleAgents";
+
+ ServiceReference providerRef = TestActivator.context.getServiceReference(IProvisioningAgentProvider.class.getName());
+ IProvisioningAgentProvider provider = (IProvisioningAgentProvider) TestActivator.context.getService(providerRef);
+
+ IProvisioningAgent firstAgent = provider.createAgent(p2location);
+ IProfileRegistry firstProfileRegistry = (IProfileRegistry) firstAgent.getService(IProfileRegistry.SERVICE_NAME);
+ firstProfileRegistry.removeProfile(PROFILE_ID);
+ firstProfileRegistry.addProfile(PROFILE_ID);
+ IMetadataRepositoryManager firstMdrMgr = (IMetadataRepositoryManager) firstAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ firstMdrMgr.addRepository(repoLocation);
+ firstMdrMgr.setEnabled(repoLocation, false);
+ firstAgent.stop();
+
+ IProvisioningAgent secondAgent = provider.createAgent(p2location);
+ IProfileRegistry secondProfileRegistry = (IProfileRegistry) secondAgent.getService(IProfileRegistry.SERVICE_NAME);
+ secondProfileRegistry.removeProfile(PROFILE_ID);
+ secondProfileRegistry.addProfile(PROFILE_ID);
+ IMetadataRepositoryManager secondMdrMgr = (IMetadataRepositoryManager) secondAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ secondMdrMgr.removeRepository(repoLocation);
+ secondAgent.stop();
+
+ TestActivator.context.ungetService(providerRef);
+
+ }
+} \ No newline at end of file

Back to the top