diff options
author | Thomas Watson | 2019-02-15 19:54:55 +0000 |
---|---|---|
committer | Thomas Watson | 2019-02-15 19:54:55 +0000 |
commit | eb84eadefbf9507041ac4597d107f9cf23ab5f70 (patch) | |
tree | 723e50cff0764aac1578efd7acac2b04a826ac93 | |
parent | 9e200a3c15f8161fef93b241012ecb3d0f1f1b7d (diff) | |
download | rt.equinox.framework-eb84eadefbf9507041ac4597d107f9cf23ab5f70.tar.gz rt.equinox.framework-eb84eadefbf9507041ac4597d107f9cf23ab5f70.tar.xz rt.equinox.framework-eb84eadefbf9507041ac4597d107f9cf23ab5f70.zip |
Bug 543844 - FrameworkExtensionInstaller in dev mode is unable to getI20190218-0600I20190217-1800I20190217-0600I20190216-1800I20190216-0600I20190215-1800
extension files
Change-Id: I30d4dc4f7306fb39c2edba202e1a2f61c6873218
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
3 files changed, 77 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a/META-INF/MANIFEST.MF index 346e72566..8b803575b 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.osgi.tests/bundles_src/ext.framework.a/META-INF/MANIFEST.MF @@ -5,3 +5,4 @@ Bundle-SymbolicName: ext.framework.a Bundle-Version: 1.0.0 Fragment-Host: system.bundle; extension:=framework Export-Package: ext.framework.a +Bundle-ClassPath: . diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java index 1433812da..53880a53c 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/AllFrameworkHookTests.java @@ -23,6 +23,7 @@ public class AllFrameworkHookTests { suite.addTest(new TestSuite(ClassLoaderHookTests.class)); suite.addTest(new TestSuite(BundleFileWrapperFactoryHookTests.class)); suite.addTest(new TestSuite(ContextFinderTests.class)); + suite.addTest(new TestSuite(DevClassPathWithExtensionTests.class)); return suite; } } diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java new file mode 100644 index 000000000..dc6d1a566 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/DevClassPathWithExtensionTests.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2013, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.osgi.tests.hooks.framework; + +import java.io.File; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.eclipse.osgi.internal.framework.EquinoxConfiguration; +import org.eclipse.osgi.tests.OSGiTestsActivator; +import org.osgi.framework.Bundle; +import org.osgi.framework.Constants; +import org.osgi.framework.launch.Framework; +import org.osgi.framework.wiring.FrameworkWiring; + +public class DevClassPathWithExtensionTests extends AbstractFrameworkHookTests { + private static final String TEST_BUNDLE = "ext.framework.a"; + + private Map<String, String> configuration; + private Framework framework; + private String location; + + protected void setUp() throws Exception { + super.setUp(); + location = bundleInstaller.getBundleLocation(TEST_BUNDLE); + File file = OSGiTestsActivator.getContext().getDataFile(getName()); + configuration = new HashMap<String, String>(); + configuration.put(Constants.FRAMEWORK_STORAGE, file.getAbsolutePath()); + configuration.put(EquinoxConfiguration.PROP_DEV, "bin/"); + framework = createFramework(configuration); + } + + protected void tearDown() throws Exception { + stopQuietly(framework); + super.tearDown(); + } + + private void initAndStartFramework() throws Exception { + initAndStart(framework); + } + + private Bundle installBundle() throws Exception { + return framework.getBundleContext().installBundle(location); + } + + public void testDevClassPathWithExtension() throws Exception { + initAndStartFramework(); + + Bundle b = installBundle(); + assertTrue("Did not resolve test extension", resolveBundles(Collections.singleton(b))); + + stop(framework); + + // reload the framework which uses read-only data structures + framework = createFramework(configuration); + initAndStart(framework); + } + + private boolean resolveBundles(Collection<Bundle> bundles) { + return framework.adapt(FrameworkWiring.class).resolveBundles(bundles); + } + +} |