diff options
author | Thomas Watson | 2018-10-19 16:29:35 +0000 |
---|---|---|
committer | Thomas Watson | 2018-10-28 12:59:56 +0000 |
commit | 2bed46ed9077d7483ad568f8c4f5dfbec35e6144 (patch) | |
tree | 70c1cce77c3d3ed5c3cc88a1a05854bf42669fa6 /bundles/org.eclipse.osgi.tests/bundles_src | |
parent | 34ff143fce6643a6a318fd6878b0f5677a78e471 (diff) | |
download | rt.equinox.framework-2bed46ed9077d7483ad568f8c4f5dfbec35e6144.tar.gz rt.equinox.framework-2bed46ed9077d7483ad568f8c4f5dfbec35e6144.tar.xz rt.equinox.framework-2bed46ed9077d7483ad568f8c4f5dfbec35e6144.zip |
Bug 540323 - Add helper support for FrameworkUtilY20181030-1100Y20181030-0940I20181029-1800I20181028-1800
Change-Id: I716d14a47540dbb529500b8d2aa8171846a66904
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/bundles_src')
3 files changed, 56 insertions, 2 deletions
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper new file mode 100644 index 000000000..a3365b5b5 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/META-INF/services/org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper @@ -0,0 +1 @@ +org.eclipse.osgi.tests.hooks.framework.storage.a.TestHelper
\ No newline at end of file diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java new file mode 100644 index 000000000..35b949cc3 --- /dev/null +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHelper.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 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.storage.a; + +import org.eclipse.osgi.internal.hookregistry.FrameworkUtilHelper; +import org.osgi.framework.Bundle; + +public class TestHelper extends FrameworkUtilHelper { + volatile static Bundle testBundle = null; + + @Override + public Bundle getBundle(Class<?> classFromBundle) { + return testBundle; + } +} diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java index 5ca89c08f..db23e19b3 100644 --- a/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java +++ b/bundles/org.eclipse.osgi.tests/bundles_src/storage.hooks.a/org/eclipse/osgi/tests/hooks/framework/storage/a/TestHookConfigurator.java @@ -15,13 +15,22 @@ package org.eclipse.osgi.tests.hooks.framework.storage.a; import java.io.DataInputStream; import java.io.DataOutputStream; -import java.util.*; +import java.util.Collections; +import java.util.Dictionary; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.osgi.container.Module; import org.eclipse.osgi.container.ModuleContainerAdaptor.ModuleEvent; import org.eclipse.osgi.container.ModuleRevisionBuilder; -import org.eclipse.osgi.internal.hookregistry.*; +import org.eclipse.osgi.internal.hookregistry.ActivatorHookFactory; +import org.eclipse.osgi.internal.hookregistry.HookConfigurator; +import org.eclipse.osgi.internal.hookregistry.HookRegistry; +import org.eclipse.osgi.internal.hookregistry.StorageHookFactory; import org.eclipse.osgi.storage.BundleInfo.Generation; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; import org.osgi.framework.Version; import org.osgi.framework.namespace.BundleNamespace; import org.osgi.framework.namespace.IdentityNamespace; @@ -121,5 +130,23 @@ public class TestHookConfigurator implements HookConfigurator { public void addHooks(HookRegistry hookRegistry) { hookRegistry.addStorageHookFactory(new TestStorageHookFactory()); + hookRegistry.addActivatorHookFactory(new ActivatorHookFactory() { + + @Override + public BundleActivator createActivator() { + return new BundleActivator() { + + @Override + public void start(BundleContext context) throws Exception { + TestHelper.testBundle = context.getBundle(Constants.SYSTEM_BUNDLE_LOCATION); + } + + @Override + public void stop(BundleContext context) throws Exception { + // nothing + } + }; + } + }); } } |