test_class.declarator: config
test_class.modifier: private static
test_class.original_string: private static EtcdDynamicConfiguration config;
test_class.type: EtcdDynamicConfiguration
test_class.var_name: config
test_class.declarator: etcdCluster = EtcdClusterFactory.buildCluster(getClass().getSimpleName(), 3, false)
test_class.modifier: public
test_class.original_string: public EtcdCluster etcdCluster = EtcdClusterFactory.buildCluster(getClass().getSimpleName(), 3, false);
test_class.type: EtcdCluster
test_class.var_name: etcdCluster
test_class.declarator: client
test_class.modifier: private static
test_class.original_string: private static Client client;
test_class.type: Client
test_class.var_name: client
test_class.file: dubbo-configcenter/dubbo-configcenter-etcd/src/test/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfigurationTest.java
test_class.identifier: EtcdDynamicConfigurationTest
test_case.body: @Test
      public void testAddListener() throws Exception {
          CountDownLatch latch = new CountDownLatch(4);
          TestListener listener1 = new TestListener(latch);
          TestListener listener2 = new TestListener(latch);
          TestListener listener3 = new TestListener(latch);
          TestListener listener4 = new TestListener(latch);
          config.addListener("AService.configurators", listener1);
          config.addListener("AService.configurators", listener2);
          config.addListener("testapp.tagrouters", listener3);
          config.addListener("testapp.tagrouters", listener4);
  
          put("/dubbo/config/AService/configurators", "new value1");
          Thread.sleep(200);
          put("/dubbo/config/testapp/tagrouters", "new value2");
          Thread.sleep(200);
          put("/dubbo/config/testapp", "new value3");
  
          Thread.sleep(1000);
  
          Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
          Assert.assertEquals(1, listener1.getCount("/dubbo/config/AService/configurators"));
          Assert.assertEquals(1, listener2.getCount("/dubbo/config/AService/configurators"));
          Assert.assertEquals(1, listener3.getCount("/dubbo/config/testapp/tagrouters"));
          Assert.assertEquals(1, listener4.getCount("/dubbo/config/testapp/tagrouters"));
  
          Assert.assertEquals("new value1", listener1.getValue());
          Assert.assertEquals("new value1", listener2.getValue());
          Assert.assertEquals("new value2", listener3.getValue());
          Assert.assertEquals("new value2", listener4.getValue());
      }
test_case.class_method_signature: EtcdDynamicConfigurationTest.testAddListener()
test_case.full_signature: @Test public void testAddListener()
test_case.identifier: testAddListener
test_case.invocations: addListener addListener addListener addListener put sleep put sleep put sleep assertTrue await assertEquals getCount assertEquals getCount assertEquals getCount assertEquals getCount assertEquals getValue assertEquals getValue assertEquals getValue assertEquals getValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAddListener()
focal_class.declarator: rootPath
focal_class.modifier: private
focal_class.original_string: private String rootPath;
focal_class.type: String
focal_class.var_name: rootPath
focal_class.declarator: etcdClient
focal_class.modifier: private final
focal_class.original_string: private final JEtcdClient etcdClient;
focal_class.type: JEtcdClient
focal_class.var_name: etcdClient
focal_class.declarator: watchListenerMap
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<ConfigurationListener, EtcdConfigWatcher> watchListenerMap;
focal_class.type: ConcurrentMap<ConfigurationListener, EtcdConfigWatcher>
focal_class.var_name: watchListenerMap
focal_class.file: dubbo-configcenter/dubbo-configcenter-etcd/src/main/java/org/apache/dubbo/configcenter/support/etcd/EtcdDynamicConfiguration.java
focal_class.identifier: EtcdDynamicConfiguration
focal_class.interfaces: implements DynamicConfiguration
focal_class.class_method_signature: EtcdDynamicConfiguration.EtcdDynamicConfiguration(URL url)
focal_class.full_signature:   EtcdDynamicConfiguration(URL url)
focal_class.identifier: EtcdDynamicConfiguration
focal_class.parameters: (URL url)
focal_class.signature:  EtcdDynamicConfiguration(URL url)
focal_class.class_method_signature: EtcdDynamicConfiguration.addListener(String key, String group, ConfigurationListener listener)
focal_class.full_signature: @Override public void addListener(String key, String group, ConfigurationListener listener)
focal_class.identifier: addListener
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, ConfigurationListener listener)
focal_class.return: void
focal_class.signature: void addListener(String key, String group, ConfigurationListener listener)
focal_class.class_method_signature: EtcdDynamicConfiguration.removeListener(String key, String group, ConfigurationListener listener)
focal_class.full_signature: @Override public void removeListener(String key, String group, ConfigurationListener listener)
focal_class.identifier: removeListener
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, ConfigurationListener listener)
focal_class.return: void
focal_class.signature: void removeListener(String key, String group, ConfigurationListener listener)
focal_class.class_method_signature: EtcdDynamicConfiguration.getConfig(String key, String group, long timeout)
focal_class.full_signature: @Override public String getConfig(String key, String group, long timeout)
focal_class.identifier: getConfig
focal_class.modifiers: @Override public
focal_class.parameters: (String key, String group, long timeout)
focal_class.return: String
focal_class.signature: String getConfig(String key, String group, long timeout)
focal_class.class_method_signature: EtcdDynamicConfiguration.getInternalProperty(String key)
focal_class.full_signature: @Override public Object getInternalProperty(String key)
focal_class.identifier: getInternalProperty
focal_class.modifiers: @Override public
focal_class.parameters: (String key)
focal_class.return: Object
focal_class.signature: Object getInternalProperty(String key)
focal_class.class_method_signature: EtcdDynamicConfiguration.buildPath(String group)
focal_class.full_signature: private String buildPath(String group)
focal_class.identifier: buildPath
focal_class.modifiers: private
focal_class.parameters: (String group)
focal_class.return: String
focal_class.signature: String buildPath(String group)
focal_class.class_method_signature: EtcdDynamicConfiguration.convertKey(String group, String key)
focal_class.full_signature: private String convertKey(String group, String key)
focal_class.identifier: convertKey
focal_class.modifiers: private
focal_class.parameters: (String group, String key)
focal_class.return: String
focal_class.signature: String convertKey(String group, String key)
focal_class.class_method_signature: EtcdDynamicConfiguration.recover()
focal_class.full_signature: private void recover()
focal_class.identifier: recover
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void recover()
focal_method.body: @Override
      public void addListener(String key, String group, ConfigurationListener listener) {
          if (watchListenerMap.get(listener) == null) {
              EtcdConfigWatcher watcher = new EtcdConfigWatcher(key, group, listener);
              watchListenerMap.put(listener, watcher);
              watcher.watch();
          }
      }
focal_method.class_method_signature: EtcdDynamicConfiguration.addListener(String key, String group, ConfigurationListener listener)
focal_method.full_signature: @Override public void addListener(String key, String group, ConfigurationListener listener)
focal_method.identifier: addListener
focal_method.invocations: get put watch
focal_method.modifiers: @Override public
focal_method.parameters: (String key, String group, ConfigurationListener listener)
focal_method.return: void
focal_method.signature: void addListener(String key, String group, ConfigurationListener listener)