Activator implements BundleActivator { public void doStart(final BundleContext bc, ExportPolicy policy) { LOG.debug("TopologyManager: start()"); notifier = new EndpointListenerNotifier(); exportExecutor = new ThreadPoolExecutor(5, 10, 50, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory(TopologyManagerExport.class)); exportManager = new TopologyManagerExport(notifier, exportExecutor, policy); epeListenerTracker = new EndpointEventListenerTracker(bc, exportManager); importManager = new TopologyManagerImport(bc); endpointListenerManager = new EndpointListenerManager(bc, importManager); endpointListenerManager.start(); rsaTracker = new RSATracker(bc, RemoteServiceAdmin.class, null); bc.addServiceListener(exportManager); rsaTracker.open(); epeListenerTracker.open(); exportExistingServices(bc); importManager.start(); }  void start(final BundleContext bc); void doStart(final BundleContext bc, ExportPolicy policy); void stop(BundleContext bc); void doStop(BundleContext bc); void exportExistingServices(BundleContext context); static final String RSA_EXPORT_POLICY_FILTER; }
@Test public void testDoStart() throws Exception { IMocksControl c = createNiceControl(); BundleContext context = c.createMock(BundleContext.class); expect(context.getProperty(Constants.FRAMEWORK_UUID)).andReturn("myid"); context.addServiceListener(isA(TopologyManagerExport.class)); expectLastCall(); ServiceReference<?> sref = c.createMock(ServiceReference.class); Bundle bundle = c.createMock(Bundle.class); expect(sref.getBundle()).andReturn(bundle).anyTimes(); expect(context.getServiceReferences((String)null, Activator.DOSGI_SERVICES)) .andReturn(new ServiceReference[]{sref}); c.replay(); Activator activator = new Activator(); activator.doStart(context, new DefaultExportPolicy()); c.verify(); c.reset(); c.replay(); activator.doStop(context); c.verify(); }