use of org.osgi.service.packageadmin.PackageAdmin in project rt.equinox.framework by eclipse.
the class PackageAdminBundleTests method testBug415447.
public void testBug415447() {
PackageAdmin pa = installer.getPackageAdmin();
Bundle[] systemBundles = pa.getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null);
assertNotNull("No system bundles found.", systemBundles);
assertEquals("Srong number of system bundles.", 1, systemBundles.length);
assertEquals("Wrong system bundle found.", OSGiTestsActivator.getContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION), systemBundles[0]);
}
use of org.osgi.service.packageadmin.PackageAdmin in project rt.equinox.framework by eclipse.
the class InstallTests method testInstall2SingletonBundles.
/**
* Ensures two versions of a singleton bundle are accepted
*/
public void testInstall2SingletonBundles() throws BundleException, IOException {
// $NON-NLS-1$
Bundle installed1 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08");
ServiceReference packageAdminSR = OSGiTestsActivator.getContext().getServiceReference(PackageAdmin.class.getName());
PackageAdmin packageAdmin = (PackageAdmin) OSGiTestsActivator.getContext().getService(packageAdminSR);
packageAdmin.resolveBundles(null);
// $NON-NLS-1$
Bundle installed2 = BundleTestingHelper.installBundle(OSGiTestsActivator.getContext(), OSGiTestsActivator.TEST_FILES_ROOT + "internal/plugins/installTests/bundle08b");
packageAdmin.resolveBundles(null);
OSGiTestsActivator.getContext().ungetService(packageAdminSR);
try {
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("1.0", "bundle08", installed1.getSymbolicName());
// $NON-NLS-1$
assertEquals("1.1", Bundle.RESOLVED, installed1.getState());
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("1.2", "1.0.0", installed1.getHeaders().get(Constants.BUNDLE_VERSION));
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("1.3", "bundle08", installed2.getSymbolicName());
// $NON-NLS-1$
assertEquals("1.4", Bundle.INSTALLED, installed2.getState());
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("1.5", "1.0.0.b", installed2.getHeaders().get(Constants.BUNDLE_VERSION));
} finally {
installed1.uninstall();
installed2.uninstall();
}
}
use of org.osgi.service.packageadmin.PackageAdmin in project Payara by payara.
the class BundleProvisioner method refresh.
/**
* Refresh packages
*/
public void refresh() {
final ServiceReference reference = getBundleContext().getServiceReference(PackageAdmin.class.getName());
PackageAdmin pa = PackageAdmin.class.cast(getBundleContext().getService(reference));
// null to refresh any bundle that's obsolete
pa.refreshPackages(null);
getBundleContext().ungetService(reference);
}
Aggregations