test_class.declarator: REPOSITORY = new NacosRepository()
test_class.modifier: private static final
test_class.original_string: private static final ConfigurationRepository REPOSITORY = new NacosRepository();
test_class.type: ConfigurationRepository
test_class.var_name: REPOSITORY
test_class.declarator: configService = mock(ConfigService.class)
test_class.modifier: private final
test_class.original_string: private final ConfigService configService = mock(ConfigService.class);
test_class.type: ConfigService
test_class.var_name: configService
test_class.declarator: group = "SHARDING_SPHERE_DEFAULT_GROUP"
test_class.modifier: private final
test_class.original_string: private final String group = "SHARDING_SPHERE_DEFAULT_GROUP";
test_class.type: String
test_class.var_name: group
test_class.file: shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/test/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepositoryTest.java
test_class.identifier: NacosRepositoryTest
test_case.body: @Test
      public void assertWatchWhenThrowException() throws NacosException {
          ChangedType[] actualType = {null};
          doThrow(NacosException.class).when(configService).addListener(anyString(), anyString(), any(Listener.class));
          DataChangedEventListener listener = dataChangedEvent -> actualType[0] = dataChangedEvent.getChangedType();
          REPOSITORY.watch("/sharding/test", listener);
          assertNull(actualType[0]);
      }
test_case.class_method_signature: NacosRepositoryTest.assertWatchWhenThrowException()
test_case.full_signature: @Test public void assertWatchWhenThrowException()
test_case.identifier: assertWatchWhenThrowException
test_case.invocations: addListener when doThrow anyString anyString any getChangedType watch assertNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertWatchWhenThrowException()
focal_class.declarator: configService
focal_class.modifier: private
focal_class.original_string: private ConfigService configService;
focal_class.type: ConfigService
focal_class.var_name: configService
focal_class.declarator: nacosProperties
focal_class.modifier: private
focal_class.original_string: private NacosProperties nacosProperties;
focal_class.type: NacosProperties
focal_class.var_name: nacosProperties
focal_class.declarator: props = new Properties()
focal_class.modifier: @Getter
      @Setter
      private
focal_class.original_string: @Getter
      @Setter
      private Properties props = new Properties();
focal_class.type: Properties
focal_class.var_name: props
focal_class.file: shardingsphere-governance/shardingsphere-governance-repository/shardingsphere-governance-repository-provider/shardingsphere-governance-repository-nacos/src/main/java/org/apache/shardingsphere/governance/repository/nacos/NacosRepository.java
focal_class.identifier: NacosRepository
focal_class.interfaces: implements ConfigurationRepository
focal_class.class_method_signature: NacosRepository.init(final String name, final GovernanceCenterConfiguration config)
focal_class.full_signature: @Override public void init(final String name, final GovernanceCenterConfiguration config)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (final String name, final GovernanceCenterConfiguration config)
focal_class.return: void
focal_class.signature: void init(final String name, final GovernanceCenterConfiguration config)
focal_class.class_method_signature: NacosRepository.get(final String key)
focal_class.full_signature: @Override public String get(final String key)
focal_class.identifier: get
focal_class.modifiers: @Override public
focal_class.parameters: (final String key)
focal_class.return: String
focal_class.signature: String get(final String key)
focal_class.class_method_signature: NacosRepository.getChildrenKeys(final String key)
focal_class.full_signature: @Override public List<String> getChildrenKeys(final String key)
focal_class.identifier: getChildrenKeys
focal_class.modifiers: @Override public
focal_class.parameters: (final String key)
focal_class.return: List<String>
focal_class.signature: List<String> getChildrenKeys(final String key)
focal_class.class_method_signature: NacosRepository.persist(final String key, final String value)
focal_class.full_signature: @Override public void persist(final String key, final String value)
focal_class.identifier: persist
focal_class.modifiers: @Override public
focal_class.parameters: (final String key, final String value)
focal_class.return: void
focal_class.signature: void persist(final String key, final String value)
focal_class.class_method_signature: NacosRepository.watch(final String key, final DataChangedEventListener listener)
focal_class.full_signature: @Override public void watch(final String key, final DataChangedEventListener listener)
focal_class.identifier: watch
focal_class.modifiers: @Override public
focal_class.parameters: (final String key, final DataChangedEventListener listener)
focal_class.return: void
focal_class.signature: void watch(final String key, final DataChangedEventListener listener)
focal_class.class_method_signature: NacosRepository.delete(final String key)
focal_class.full_signature: @Override public void delete(final String key)
focal_class.identifier: delete
focal_class.modifiers: @Override public
focal_class.parameters: (final String key)
focal_class.return: void
focal_class.signature: void delete(final String key)
focal_class.class_method_signature: NacosRepository.pathToKey(final String path)
focal_class.full_signature: private String pathToKey(final String path)
focal_class.identifier: pathToKey
focal_class.modifiers: private
focal_class.parameters: (final String path)
focal_class.return: String
focal_class.signature: String pathToKey(final String path)
focal_class.class_method_signature: NacosRepository.close()
focal_class.full_signature: @Override public void close()
focal_class.identifier: close
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void close()
focal_class.class_method_signature: NacosRepository.getType()
focal_class.full_signature: @Override public String getType()
focal_class.identifier: getType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getType()
focal_method.body: @Override
      public void watch(final String key, final DataChangedEventListener listener) {
          try {
              String dataId = pathToKey(key);
              String group = nacosProperties.getValue(NacosPropertyKey.GROUP);
              configService.addListener(dataId, group, new Listener() {
                  
                  @Override
                  public Executor getExecutor() {
                      return null;
                  }
                  
                  @Override
                  public void receiveConfigInfo(final String configInfo) {
                      listener.onChange(new DataChangedEvent(key, configInfo, ChangedType.UPDATED));
                  }
              });
          } catch (final NacosException ex) {
              log.debug("Nacos watch key exception for: {}", ex.toString());
          }
      }
focal_method.class_method_signature: NacosRepository.watch(final String key, final DataChangedEventListener listener)
focal_method.full_signature: @Override public void watch(final String key, final DataChangedEventListener listener)
focal_method.identifier: watch
focal_method.invocations: pathToKey getValue addListener onChange debug toString
focal_method.modifiers: @Override public
focal_method.parameters: (final String key, final DataChangedEventListener listener)
focal_method.return: void
focal_method.signature: void watch(final String key, final DataChangedEventListener listener)