FrameworkUtils { public static long[] getBundleIds(Bundle[] bundles) { long[] result; if (bundles == null) { result = new long[0]; } else { result = new long[bundles.length]; for (int i = 0; i < bundles.length; i++) { result[i] = bundles[i].getBundleId(); } } return result; } private  FrameworkUtils(); static Bundle resolveBundle(BundleContext bundleContext, long bundleId); static long[] getBundleIds(Bundle[] bundles); static long[] getBundleIds(List<Bundle> bundles); static ServiceReference resolveService(BundleContext bundleContext, long serviceId); static long[] getServiceIds(ServiceReference[] serviceReferences); static String[] getBundleExportedPackages(Bundle bundle, PackageAdmin packageAdmin); static long[] getFragmentIds(Bundle bundle, PackageAdmin packageAdmin); static long[] getHostIds(Bundle fragment, PackageAdmin packageAdmin); static String[] getBundleImportedPackages(BundleContext localBundleContext, Bundle bundle,
            PackageAdmin packageAdmin); static long[] getRegisteredServiceIds(Bundle bundle); static long[] getServicesInUseByBundle(Bundle bundle); static boolean isBundlePendingRemoval(Bundle bundle, PackageAdmin packageAdmin); static boolean isBundleRequiredByOthers(Bundle bundle, PackageAdmin packageAdmin); @SuppressWarnings("unchecked") static long[] getBundleDependencies(BundleContext localBundleContext, 
                                               Bundle bundle,
                                               PackageAdmin packageAdmin); static long[] getDependentBundles(Bundle bundle, PackageAdmin packageAdmin); static String getBundleState(Bundle bundle); static boolean arrayContains(Object[] array, Object value); static List<String> extractHeaderDeclaration(String headerStatement);  }
@Test public void testGetBundleIds() throws Exception { assertEquals(0, getBundleIds((Bundle[])null).length); assertEquals(0, getBundleIds(new Bundle[0]).length); Bundle b1 = mock(Bundle.class); when(b1.getBundleId()).thenReturn(new Long(47)); Bundle b2 = mock(Bundle.class); when(b2.getBundleId()).thenReturn(new Long(23)); assertArrayEquals(new long[] { 47 , 23 }, getBundleIds(new Bundle[] { b1, b2 })); }