Skip to content

Commit 3c99403

Browse files
author
Karsten Thoms
committed
Bug 544455 - Test#getBundle:Resolve usage of PackageAdmin
Use Platform#getBundle instead. Removed TestUtils#getBundle and refactored only reference to it by directly using Platform. Change-Id: I51c801c9082c4ce9600074067f45294a406c66df Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
1 parent a1a51b3 commit 3c99403

2 files changed

Lines changed: 1 addition & 22 deletions

File tree

ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/AbstractRegistryModelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public AbstractRegistryModelTest() {
9292
testServiceReference = registration.getReference();
9393

9494
testExtPoint = Platform.getExtensionRegistry().getExtensionPoint(TEST_EXT_POINT);
95-
testExtPointBundle = TestUtils.getBundle(TEST_EXT_POINT_BUNDLE);
95+
testExtPointBundle = Platform.getBundle(TEST_EXT_POINT_BUNDLE);
9696
}
9797

9898
@Override

ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/runtime/TestUtils.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,11 @@
2626
import org.eclipse.pde.ui.tests.PDETestsPlugin;
2727
import org.eclipse.swt.widgets.Display;
2828
import org.junit.Assert;
29-
import org.osgi.framework.Bundle;
30-
import org.osgi.service.packageadmin.PackageAdmin;
3129

3230
/**
3331
* Utility methods for JUnit tests.
3432
*/
35-
@SuppressWarnings("deprecation")
36-
// We use package admin to access bundles during the tests
3733
public class TestUtils {
38-
39-
private static PackageAdmin packageAdmin;
40-
41-
public static Bundle getBundle(String symbolicName) {
42-
if (packageAdmin == null) {
43-
packageAdmin = PDETestsPlugin.getBundleContext()
44-
.getService(PDETestsPlugin.getBundleContext().getServiceReference(PackageAdmin.class));
45-
}
46-
Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
47-
48-
if (bundles != null) {
49-
return bundles[0];
50-
}
51-
52-
return null;
53-
}
54-
5534
public static IExtensionPoint getExtensionPoint(String extensionPointId) {
5635
return Platform.getExtensionRegistry().getExtensionPoint(extensionPointId);
5736
}

0 commit comments

Comments
 (0)