diff options
author | Thomas Watson | 2013-08-28 20:01:45 +0000 |
---|---|---|
committer | Thomas Watson | 2013-08-28 20:33:28 +0000 |
commit | 89341d28d2eb3326054e2c97f4c880cbc51ef233 (patch) | |
tree | e9622b3e077b261f390fed20da1f7fafcc8aa3d5 /bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration | |
parent | f939cab3bf0e055aa3effb46a797da71d3cab815 (diff) | |
download | rt.equinox.framework-89341d28d2eb3326054e2c97f4c880cbc51ef233.tar.gz rt.equinox.framework-89341d28d2eb3326054e2c97f4c880cbc51ef233.tar.xz rt.equinox.framework-89341d28d2eb3326054e2c97f4c880cbc51ef233.zip |
Bug 416056 - Updating from I20130820-0800 to I20130827-0800 restarted
many times with exceptions
- Add a testcase
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration')
2 files changed, 71 insertions, 1 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/AllTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/AllTests.java index 078d86bdb..cd71d8f81 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/AllTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/AllTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. + * Copyright (c) 2004, 2013 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 @@ -16,6 +16,7 @@ import junit.framework.TestSuite; public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(AllTests.class.getName()); + suite.addTest(EclipseStarterConfigurationAreaTest.suite()); suite.addTest(ReadOnlyConfigurationAreaTest.suite()); suite.addTest(MovableConfigurationAreaTest.suite()); return suite; diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java new file mode 100644 index 000000000..a975c6965 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/configuration/EclipseStarterConfigurationAreaTest.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2013 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.osgi.tests.configuration; + +import java.util.List; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.tests.session.ConfigurationSessionTestSuite; +import org.eclipse.osgi.tests.OSGiTest; +import org.osgi.framework.Constants; +import org.osgi.framework.namespace.HostNamespace; +import org.osgi.framework.wiring.BundleWire; +import org.osgi.framework.wiring.BundleWiring; + +public class EclipseStarterConfigurationAreaTest extends OSGiTest { + + public static Test suite() { + TestSuite suite = new TestSuite(EclipseStarterConfigurationAreaTest.class.getName()); + + ConfigurationSessionTestSuite initialization = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigurationAreaTest.class.getName()); + String[] ids = ConfigurationSessionTestSuite.MINIMAL_BUNDLE_SET; + initialization.addBundle("org.eclipse.osgi.compatibility.state"); + for (int i = 0; i < ids.length; i++) + initialization.addBundle(ids[i]); + initialization.addBundle(PI_OSGI_TESTS); + // disable clean-up, we want to reuse the configuration + initialization.setCleanup(false); + initialization.addTest(new EclipseStarterConfigurationAreaTest("testInitializeExtension")); + suite.addTest(initialization); + + // restart with cache but remove the compatibility fragment + IPath configPath = initialization.getConfigurationPath(); + + ConfigurationSessionTestSuite removeExtension = new ConfigurationSessionTestSuite(PI_OSGI_TESTS, EclipseStarterConfigurationAreaTest.class.getName()); + removeExtension.setConfigurationPath(configPath); + for (int i = 0; i < ids.length; i++) + removeExtension.addBundle(ids[i]); + removeExtension.addBundle(PI_OSGI_TESTS); + removeExtension.addTest(new EclipseStarterConfigurationAreaTest("testRemoveExtension")); + suite.addTest(removeExtension); + return suite; + } + + public EclipseStarterConfigurationAreaTest(String name) { + super(name); + } + + public void testInitializeExtension() { + // initialization session + List<BundleWire> fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class).getProvidedWires(HostNamespace.HOST_NAMESPACE); + assertEquals("Wrong number of system fragments.", 1, fragWires.size()); + } + + public void testRemoveExtension() { + // removed extension session + List<BundleWire> fragWires = getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(BundleWiring.class).getProvidedWires(HostNamespace.HOST_NAMESPACE); + assertEquals("Wrong number of system fragments.", 0, fragWires.size()); + } + +} |