test_class.file: dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/ClusterUtilsTest.java
test_class.identifier: ClusterUtilsTest
test_case.body: @Test
      public void testMergeUrl() throws Exception {
          URL providerURL = URL.valueOf("dubbo://localhost:55555");
          providerURL = providerURL.setPath("path")
                  .setUsername("username")
                  .setPassword("password");
  
          providerURL = URLBuilder.from(providerURL)
                  .addParameter(GROUP_KEY, "dubbo")
                  .addParameter(VERSION_KEY, "1.2.3")
                  .addParameter(DUBBO_VERSION_KEY, "2.3.7")
                  .addParameter(THREADPOOL_KEY, "fixed")
                  .addParameter(THREADS_KEY, Integer.MAX_VALUE)
                  .addParameter(THREAD_NAME_KEY, "test")
                  .addParameter(CORE_THREADS_KEY, Integer.MAX_VALUE)
                  .addParameter(QUEUES_KEY, Integer.MAX_VALUE)
                  .addParameter(ALIVE_KEY, Integer.MAX_VALUE)
                  .addParameter(DEFAULT_KEY_PREFIX + THREADS_KEY, Integer.MAX_VALUE)
                  .addParameter(DEFAULT_KEY_PREFIX + THREADPOOL_KEY, "fixed")
                  .addParameter(DEFAULT_KEY_PREFIX + CORE_THREADS_KEY, Integer.MAX_VALUE)
                  .addParameter(DEFAULT_KEY_PREFIX + QUEUES_KEY, Integer.MAX_VALUE)
                  .addParameter(DEFAULT_KEY_PREFIX + ALIVE_KEY, Integer.MAX_VALUE)
                  .addParameter(DEFAULT_KEY_PREFIX + THREAD_NAME_KEY, "test")
                  .addParameter(APPLICATION_KEY, "provider")
                  .addParameter(REFERENCE_FILTER_KEY, "filter1,filter2")
                  .build();
  
          URL consumerURL = new URLBuilder(DUBBO_PROTOCOL, "localhost", 55555)
                  .addParameter(PID_KEY, "1234")
                  .addParameter(THREADPOOL_KEY, "foo")
                  .addParameter(APPLICATION_KEY, "consumer")
                  .addParameter(REFERENCE_FILTER_KEY, "filter3")
                  .build();
  
          URL url = ClusterUtils.mergeUrl(providerURL, consumerURL.getParameters());
  
          Assertions.assertFalse(url.hasParameter(THREADS_KEY));
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + THREADS_KEY));
  
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + THREADPOOL_KEY));
  
          Assertions.assertFalse(url.hasParameter(CORE_THREADS_KEY));
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + CORE_THREADS_KEY));
  
          Assertions.assertFalse(url.hasParameter(QUEUES_KEY));
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + QUEUES_KEY));
  
          Assertions.assertFalse(url.hasParameter(ALIVE_KEY));
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + ALIVE_KEY));
  
          Assertions.assertFalse(url.hasParameter(THREAD_NAME_KEY));
          Assertions.assertFalse(url.hasParameter(DEFAULT_KEY_PREFIX + THREAD_NAME_KEY));
  
          Assertions.assertEquals(url.getPath(), "path");
          Assertions.assertEquals(url.getUsername(), "username");
          Assertions.assertEquals(url.getPassword(), "password");
          Assertions.assertEquals(url.getParameter(PID_KEY), "1234");
          Assertions.assertEquals(url.getParameter(THREADPOOL_KEY), "foo");
          Assertions.assertEquals(url.getParameter(APPLICATION_KEY), "consumer");
          Assertions.assertEquals(url.getParameter(REMOTE_APPLICATION_KEY), "provider");
          Assertions.assertEquals(url.getParameter(REFERENCE_FILTER_KEY), "filter1,filter2,filter3");
      }
test_case.class_method_signature: ClusterUtilsTest.testMergeUrl()
test_case.full_signature: @Test public void testMergeUrl()
test_case.identifier: testMergeUrl
test_case.invocations: valueOf setPassword setUsername setPath build addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter addParameter from build addParameter addParameter addParameter addParameter mergeUrl getParameters assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertFalse hasParameter assertEquals getPath assertEquals getUsername assertEquals getPassword assertEquals getParameter assertEquals getParameter assertEquals getParameter assertEquals getParameter assertEquals getParameter
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMergeUrl()
focal_class.file: dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java
focal_class.identifier: ClusterUtils
focal_class.class_method_signature: ClusterUtils.ClusterUtils()
focal_class.full_signature: private  ClusterUtils()
focal_class.identifier: ClusterUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ClusterUtils()
focal_class.class_method_signature: ClusterUtils.mergeUrl(URL remoteUrl, Map<String, String> localMap)
focal_class.full_signature: public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap)
focal_class.identifier: mergeUrl
focal_class.modifiers: public static
focal_class.parameters: (URL remoteUrl, Map<String, String> localMap)
focal_class.return: URL
focal_class.signature: URL mergeUrl(URL remoteUrl, Map<String, String> localMap)
focal_class.class_method_signature: ClusterUtils.mergeProviderUrl(URL remoteUrl, Map<String, String> localMap)
focal_class.full_signature: public static URL mergeProviderUrl(URL remoteUrl, Map<String, String> localMap)
focal_class.identifier: mergeProviderUrl
focal_class.modifiers: public static
focal_class.parameters: (URL remoteUrl, Map<String, String> localMap)
focal_class.return: URL
focal_class.signature: URL mergeProviderUrl(URL remoteUrl, Map<String, String> localMap)
focal_method.body: public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap) {
          Map<String, String> map = new HashMap<String, String>();
          Map<String, String> remoteMap = remoteUrl.getParameters();
  
          if (remoteMap != null && remoteMap.size() > 0) {
              map.putAll(remoteMap);
  
              // Remove configurations from provider, some items should be affected by provider.
              map.remove(THREAD_NAME_KEY);
              map.remove(DEFAULT_KEY_PREFIX + THREAD_NAME_KEY);
  
              map.remove(THREADPOOL_KEY);
              map.remove(DEFAULT_KEY_PREFIX + THREADPOOL_KEY);
  
              map.remove(CORE_THREADS_KEY);
              map.remove(DEFAULT_KEY_PREFIX + CORE_THREADS_KEY);
  
              map.remove(THREADS_KEY);
              map.remove(DEFAULT_KEY_PREFIX + THREADS_KEY);
  
              map.remove(QUEUES_KEY);
              map.remove(DEFAULT_KEY_PREFIX + QUEUES_KEY);
  
              map.remove(ALIVE_KEY);
              map.remove(DEFAULT_KEY_PREFIX + ALIVE_KEY);
  
              map.remove(Constants.TRANSPORTER_KEY);
              map.remove(DEFAULT_KEY_PREFIX + Constants.TRANSPORTER_KEY);
          }
  
          if (localMap != null && localMap.size() > 0) {
              Map<String, String> copyOfLocalMap = new HashMap<>(localMap);
  
              if(map.containsKey(GROUP_KEY)){
                  copyOfLocalMap.remove(GROUP_KEY);
              }
              if(map.containsKey(VERSION_KEY)){
                  copyOfLocalMap.remove(VERSION_KEY);
              }
  
              copyOfLocalMap.remove(RELEASE_KEY);
              copyOfLocalMap.remove(DUBBO_VERSION_KEY);
              copyOfLocalMap.remove(METHODS_KEY);
              copyOfLocalMap.remove(TIMESTAMP_KEY);
              copyOfLocalMap.remove(TAG_KEY);
  
              map.putAll(copyOfLocalMap);
  
              map.put(REMOTE_APPLICATION_KEY, remoteMap.get(APPLICATION_KEY));
  
              // Combine filters and listeners on Provider and Consumer
              String remoteFilter = remoteMap.get(REFERENCE_FILTER_KEY);
              String localFilter = copyOfLocalMap.get(REFERENCE_FILTER_KEY);
              if (remoteFilter != null && remoteFilter.length() > 0
                      && localFilter != null && localFilter.length() > 0) {
                  map.put(REFERENCE_FILTER_KEY, remoteFilter + "," + localFilter);
              }
              String remoteListener = remoteMap.get(INVOKER_LISTENER_KEY);
              String localListener = copyOfLocalMap.get(INVOKER_LISTENER_KEY);
              if (remoteListener != null && remoteListener.length() > 0
                      && localListener != null && localListener.length() > 0) {
                  map.put(INVOKER_LISTENER_KEY, remoteListener + "," + localListener);
              }
          }
  
          return remoteUrl.clearParameters().addParameters(map);
      }
focal_method.class_method_signature: ClusterUtils.mergeUrl(URL remoteUrl, Map<String, String> localMap)
focal_method.full_signature: public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap)
focal_method.identifier: mergeUrl
focal_method.invocations: getParameters size putAll remove remove remove remove remove remove remove remove remove remove remove remove remove remove size containsKey remove containsKey remove remove remove remove remove remove putAll put get get get length length put get get length length put addParameters clearParameters
focal_method.modifiers: public static
focal_method.parameters: (URL remoteUrl, Map<String, String> localMap)
focal_method.return: URL
focal_method.signature: URL mergeUrl(URL remoteUrl, Map<String, String> localMap)