PentahoOSGIActivator { public void setBundleContext( BundleContext bundleContext ) throws Exception { logger.debug( "Registering OSGIObjectFactory" ); if ( objectFactory != null ) { logger.debug( "De-Registering Previous OSGIObjectFactory" ); PentahoSystem.deregisterObjectFactory( objectFactory ); } objectFactory = new OSGIObjectFactory( bundleContext ); PentahoSystem.registerObjectFactory( objectFactory ); PentahoSystem.setBundleContext( bundleContext ); logger.debug( "OSGIObjectFactory installed" ); }  void setBundleContext( BundleContext bundleContext ); void shutdown();  }
@Test public void testActivation() throws Exception { AggregateObjectFactory agg = (AggregateObjectFactory) PentahoSystem.getObjectFactory(); int originalSize = agg.getFactories().size(); BundleContext context = Mockito.mock( BundleContext.class ); PentahoOSGIActivator activator = new PentahoOSGIActivator(); activator.setBundleContext( context ); assertEquals( 1, agg.getFactories().size() - originalSize ); }