ClientManager implements Watcher { @Activate public synchronized void activate(final DiscoveryConfig config, final BundleContext context) { this.config = config; this.context = context; LOG.debug("Received configuration update for Zookeeper Discovery: {}", config); startClient(); }  @Activate synchronized void activate(final DiscoveryConfig config, final BundleContext context); @Deactivate synchronized void stop(); void process(WatchedEvent event); static final String DISCOVERY_ZOOKEEPER_ID; }
@Test public void testDefaults() throws ConfigurationException, InstantiationException, IllegalAccessException, InterruptedException { Map<String, Object> configuration = new HashMap<>(); zkd.activate(convert(configuration), context); sem.tryAcquire(10, TimeUnit.SECONDS); assertEquals("localhost", config.zookeeper_host()); assertEquals("2181", config.zookeeper_port()); assertEquals(3000, config.zookeeper_timeout()); }
@Test public void testConfig() throws ConfigurationException, InterruptedException { Map<String, Object> configuration = new HashMap<>(); configuration.put("zookeeper.host", "myhost"); configuration.put("zookeeper.port", "1"); configuration.put("zookeeper.timeout", "1000"); DiscoveryConfig config2 = convert(configuration); assertEquals("myhost", config2.zookeeper_host()); zkd.activate(config2, context); sem.tryAcquire(10, TimeUnit.SECONDS); assertEquals("myhost", config.zookeeper_host()); assertEquals("1", config.zookeeper_port()); assertEquals(1000, config.zookeeper_timeout()); }