@Test @Ignore("still working it out") public void testCallGetResourcesOnADifferentBundle() throws Exception { // find bundles Bundle[] bundles = bundleContext.getBundles(); for (int i = 1; i < bundles.length; i++) { Bundle bundle = bundles[i]; logger.debug( "calling #getResources on bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle)); Enumeration enm = bundle.getResources(LOCATION); if (!OsgiBundleUtils.isFragment(bundle)) assertNotNull( "bundle " + OsgiStringUtils.nullSafeNameAndSymName(bundle) + " contains no META-INF/", enm); } }
public DelegatedExecutionOsgiBundleApplicationContext createApplicationContext( BundleContext bundleContext) throws Exception { Bundle bundle = bundleContext.getBundle(); ApplicationContextConfiguration config = new BlueprintContainerConfig(bundle); String bundleName = OsgiStringUtils.nullSafeNameAndSymName(bundle); if (log.isTraceEnabled()) log.trace("Created configuration " + config + " for bundle " + bundleName); // it's not a spring bundle, ignore it if (!config.isSpringPoweredBundle()) { if (log.isDebugEnabled()) log.debug("No blueprint configuration found in bundle " + bundleName + "; ignoring it..."); return null; } log.info( "Discovered configurations " + ObjectUtils.nullSafeToString(config.getConfigurationLocations()) + " in bundle [" + bundleName + "]"); DelegatedExecutionOsgiBundleApplicationContext sdoac = new OsgiBundleXmlApplicationContext(config.getConfigurationLocations()); sdoac.setBundleContext(bundleContext); sdoac.setPublishContextAsService(config.isPublishContextAsService()); return sdoac; }