test_class.declarator: osgiRule = new OsgiRule()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final OsgiRule osgiRule = new OsgiRule();
test_class.type: OsgiRule
test_class.var_name: osgiRule
test_class.file: osgi/container/src/test/java/org/microbule/osgi/container/OsgiContainerTest.java
test_class.identifier: OsgiContainerTest
test_class.superclass: extends MockObjectTestCase
test_case.body: @Test
      public void testPluginsWhenRejected() throws Exception {
          final HelloServiceImpl service1 = new HelloServiceImpl();
          final ServiceRegistration<HelloServiceImpl> registration1 = osgiRule.registerService(HelloService.class, service1, props().with("microbule.server", "true"));
  
          final OsgiContainer container = new OsgiContainer(osgiRule.getBundleContext(), 100);
          final HelloServiceImpl defaultVal = new HelloServiceImpl();
          final AtomicReference<HelloService> ref = container.pluginReference(HelloService.class, defaultVal);
          assertEquals(service1, ref.get());
          final HelloServiceImpl service2 = new HelloServiceImpl();
          final ServiceRegistration<HelloServiceImpl> registration2 = osgiRule.registerService(HelloService.class, service2, props().with("microbule.server", "true"));
          assertEquals(service1, ref.get());
          registration2.unregister();
          assertEquals(service1, ref.get());
          registration1.unregister();
          assertEquals(defaultVal, ref.get());
      }
test_case.class_method_signature: OsgiContainerTest.testPluginsWhenRejected()
test_case.full_signature: @Test public void testPluginsWhenRejected()
test_case.identifier: testPluginsWhenRejected
test_case.invocations: registerService with props getBundleContext pluginReference assertEquals get registerService with props assertEquals get unregister assertEquals get unregister assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPluginsWhenRejected()
focal_class.declarator: MICROBULE_SERVER_FILTER = "(microbule.server=*)"
focal_class.modifier: private static final
focal_class.original_string: private static final String MICROBULE_SERVER_FILTER = "(microbule.server=*)";
focal_class.type: String
focal_class.var_name: MICROBULE_SERVER_FILTER
focal_class.declarator: LOGGER = LoggerFactory.getLogger(OsgiContainer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(OsgiContainer.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: bundleContext
focal_class.modifier: private final
focal_class.original_string: private final BundleContext bundleContext;
focal_class.type: BundleContext
focal_class.var_name: bundleContext
focal_class.declarator: serverListeners = new CopyOnWriteArrayList<>()
focal_class.modifier: private final
focal_class.original_string: private final List<ServerListener> serverListeners = new CopyOnWriteArrayList<>();
focal_class.type: List<ServerListener>
focal_class.var_name: serverListeners
focal_class.declarator: lastUpdated
focal_class.modifier: private final
focal_class.original_string: private final AtomicLong lastUpdated;
focal_class.type: AtomicLong
focal_class.var_name: lastUpdated
focal_class.declarator: scheduler
focal_class.modifier: private final
focal_class.original_string: private final ScheduledExecutorService scheduler;
focal_class.type: ScheduledExecutorService
focal_class.var_name: scheduler
focal_class.declarator: quietPeriod
focal_class.modifier: private final
focal_class.original_string: private final long quietPeriod;
focal_class.type: long
focal_class.var_name: quietPeriod
focal_class.file: osgi/container/src/main/java/org/microbule/osgi/container/OsgiContainer.java
focal_class.identifier: OsgiContainer
focal_class.class_method_signature: OsgiContainer.OsgiContainer(BundleContext bundleContext, long quietPeriodInMs)
focal_class.full_signature: public  OsgiContainer(BundleContext bundleContext, long quietPeriodInMs)
focal_class.identifier: OsgiContainer
focal_class.modifiers: public
focal_class.parameters: (BundleContext bundleContext, long quietPeriodInMs)
focal_class.signature:  OsgiContainer(BundleContext bundleContext, long quietPeriodInMs)
focal_class.class_method_signature: OsgiContainer.addPluginListener(Class<B> beanType, PluginListener<B> listener)
focal_class.full_signature: @Override public void addPluginListener(Class<B> beanType, PluginListener<B> listener)
focal_class.identifier: addPluginListener
focal_class.modifiers: @Override public
focal_class.parameters: (Class<B> beanType, PluginListener<B> listener)
focal_class.return: void
focal_class.signature: void addPluginListener(Class<B> beanType, PluginListener<B> listener)
focal_class.class_method_signature: OsgiContainer.addServerListener(ServerListener listener)
focal_class.full_signature: @Override public void addServerListener(ServerListener listener)
focal_class.identifier: addServerListener
focal_class.modifiers: @Override public
focal_class.parameters: (ServerListener listener)
focal_class.return: void
focal_class.signature: void addServerListener(ServerListener listener)
focal_class.class_method_signature: OsgiContainer.checkLastUpdate()
focal_class.full_signature: private void checkLastUpdate()
focal_class.identifier: checkLastUpdate
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkLastUpdate()
focal_class.class_method_signature: OsgiContainer.registerServiceListener()
focal_class.full_signature: private void registerServiceListener()
focal_class.identifier: registerServiceListener
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void registerServiceListener()
focal_class.class_method_signature: OsgiContainer.registerService(ServiceReference<?> ref)
focal_class.full_signature: private void registerService(ServiceReference<?> ref)
focal_class.identifier: registerService
focal_class.modifiers: private
focal_class.parameters: (ServiceReference<?> ref)
focal_class.return: void
focal_class.signature: void registerService(ServiceReference<?> ref)
focal_class.class_method_signature: OsgiContainer.serviceId(ServiceReference<?> ref)
focal_class.full_signature: private Long serviceId(ServiceReference<?> ref)
focal_class.identifier: serviceId
focal_class.modifiers: private
focal_class.parameters: (ServiceReference<?> ref)
focal_class.return: Long
focal_class.signature: Long serviceId(ServiceReference<?> ref)
focal_class.class_method_signature: OsgiContainer.findExistingServices()
focal_class.full_signature: private void findExistingServices()
focal_class.identifier: findExistingServices
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void findExistingServices()
focal_class.superclass: extends AbstractContainer
focal_method.body: private void registerService(ServiceReference<?> ref) {
          final String[] serviceInterfaceNames = (String[]) ref.getProperty(Constants.OBJECTCLASS);
          Arrays.stream(serviceInterfaceNames).forEach(serviceInterfaceName -> {
              try {
                  final Class<?> serviceInterface = ref.getBundle().loadClass(serviceInterfaceName);
                  if (serviceInterface.isAnnotationPresent(Path.class)) {
                      final Long serviceId = serviceId(ref);
                      final Object serviceImplementation = bundleContext.getService(ref);
                      final DefaultServerDefinition definition = new DefaultServerDefinition(serviceId.toString(), serviceInterface, serviceImplementation);
                      serverListeners.forEach(listener -> listener.registerServer(definition));
                  }
              } catch (ClassNotFoundException e) {
                  LOGGER.error("Unable to load service interface from target bundle!", e);
              }
          });
      }
focal_method.class_method_signature: OsgiContainer.registerService(ServiceReference<?> ref)
focal_method.full_signature: private void registerService(ServiceReference<?> ref)
focal_method.identifier: registerService
focal_method.invocations: getProperty forEach stream loadClass getBundle isAnnotationPresent serviceId getService toString forEach registerServer error
focal_method.modifiers: private
focal_method.parameters: (ServiceReference<?> ref)
focal_method.return: void
focal_method.signature: void registerService(ServiceReference<?> ref)