test_class.declarator: url = URL.valueOf("dubbo://192.168.0.102:20880/org.apache.dubbo.metadata.MetadataService?&anyhost=true&application=spring-cloud-alibaba-dubbo-provider&bind.ip=192.168.0.102&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=spring-cloud-alibaba-dubbo-provider&interface=org.apache.dubbo.metadata.MetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=58350&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1557928573174&version=1.0.0")
test_class.modifier: private static
test_class.original_string: private static URL url = URL.valueOf("dubbo://192.168.0.102:20880/org.apache.dubbo.metadata.MetadataService?&anyhost=true&application=spring-cloud-alibaba-dubbo-provider&bind.ip=192.168.0.102&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=spring-cloud-alibaba-dubbo-provider&interface=org.apache.dubbo.metadata.MetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=58350&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1557928573174&version=1.0.0");
test_class.type: URL
test_class.var_name: url
test_class.declarator: url2 = URL.valueOf("rest://192.168.0.102:20880/org.apache.dubbo.metadata.MetadataService?&anyhost=true&application=spring-cloud-alibaba-dubbo-provider&bind.ip=192.168.0.102&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=spring-cloud-alibaba-dubbo-provider&interface=org.apache.dubbo.metadata.MetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=58350&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1557928573174&version=1.0.0")
test_class.modifier: private static
test_class.original_string: private static URL url2 = URL.valueOf("rest://192.168.0.102:20880/org.apache.dubbo.metadata.MetadataService?&anyhost=true&application=spring-cloud-alibaba-dubbo-provider&bind.ip=192.168.0.102&bind.port=20880&default.deprecated=false&default.dynamic=false&default.register=true&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&group=spring-cloud-alibaba-dubbo-provider&interface=org.apache.dubbo.metadata.MetadataService&methods=getAllServiceKeys,getServiceRestMetadata,getExportedURLs,getAllExportedURLs&pid=58350&register=true&release=2.7.1&revision=1.0.0&side=provider&timestamp=1557928573174&version=1.0.0");
test_class.type: URL
test_class.var_name: url2
test_class.declarator: VALUE = "{\"rest\":{\"version\":\"1.0.0\",\"dubbo\":\"2.0.2\",\"release\":\"2.7.1\",\"port\":\"20880\"},\"dubbo\":{\"version\":\"1.0.0\",\"dubbo\":\"2.0.2\",\"release\":\"2.7.1\",\"port\":\"20880\"}}"
test_class.modifier: private static final
test_class.original_string: private static final String VALUE = "{\"rest\":{\"version\":\"1.0.0\",\"dubbo\":\"2.0.2\",\"release\":\"2.7.1\",\"port\":\"20880\"},\"dubbo\":{\"version\":\"1.0.0\",\"dubbo\":\"2.0.2\",\"release\":\"2.7.1\",\"port\":\"20880\"}}";
test_class.type: String
test_class.var_name: VALUE
test_class.file: dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtilsTest.java
test_class.identifier: ServiceInstanceMetadataUtilsTest
test_case.body: @Test
      public void testMetadataServiceURLParameters() {
  
          List<URL> urls = Arrays.asList(url, url2);
  
          String parameter = ServiceInstanceMetadataUtils.getMetadataServiceParameter(urls);
  
          JSONObject jsonObject = JSON.parseObject(parameter);
  
          urls.forEach(url -> {
              JSONObject map = jsonObject.getJSONObject(url.getProtocol());
              for (Map.Entry<String, String> param : url.getParameters().entrySet()) {
                  String value = map.getString(param.getKey());
                  if (value != null) {
                      assertEquals(param.getValue(), value);
                  }
              }
          });
  
          assertEquals(VALUE, parameter);
      }
test_case.class_method_signature: ServiceInstanceMetadataUtilsTest.testMetadataServiceURLParameters()
test_case.full_signature: @Test public void testMetadataServiceURLParameters()
test_case.identifier: testMetadataServiceURLParameters
test_case.invocations: asList getMetadataServiceParameter parseObject forEach getJSONObject getProtocol entrySet getParameters getString getKey assertEquals getValue assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMetadataServiceURLParameters()
focal_class.declarator: METADATA_SERVICE_PREFIX = "dubbo.metadata-service."
focal_class.modifier: public static final
focal_class.original_string: public static final String METADATA_SERVICE_PREFIX = "dubbo.metadata-service.";
focal_class.type: String
focal_class.var_name: METADATA_SERVICE_PREFIX
focal_class.declarator: ENDPOINTS = "dubbo.endpoints"
focal_class.modifier: public static final
focal_class.original_string: public static final String ENDPOINTS = "dubbo.endpoints";
focal_class.type: String
focal_class.var_name: ENDPOINTS
focal_class.declarator: METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "url-params"
focal_class.modifier: public static
focal_class.original_string: public static String METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "url-params";
focal_class.type: String
focal_class.var_name: METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME
focal_class.declarator: METADATA_SERVICE_URLS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "urls"
focal_class.modifier: public static final
focal_class.original_string: public static final String METADATA_SERVICE_URLS_PROPERTY_NAME = METADATA_SERVICE_PREFIX + "urls";
focal_class.type: String
focal_class.var_name: METADATA_SERVICE_URLS_PROPERTY_NAME
focal_class.declarator: EXPORTED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.metadata.revision"
focal_class.modifier: public static
focal_class.original_string: public static String EXPORTED_SERVICES_REVISION_PROPERTY_NAME = "dubbo.metadata.revision";
focal_class.type: String
focal_class.var_name: EXPORTED_SERVICES_REVISION_PROPERTY_NAME
focal_class.declarator: METADATA_STORAGE_TYPE_PROPERTY_NAME = "dubbo.metadata.storage-type"
focal_class.modifier: public static
focal_class.original_string: public static String METADATA_STORAGE_TYPE_PROPERTY_NAME = "dubbo.metadata.storage-type";
focal_class.type: String
focal_class.var_name: METADATA_STORAGE_TYPE_PROPERTY_NAME
focal_class.declarator: METADATA_CLUSTER_PROPERTY_NAME = "dubbo.metadata.cluster"
focal_class.modifier: public static
focal_class.original_string: public static String METADATA_CLUSTER_PROPERTY_NAME = "dubbo.metadata.cluster";
focal_class.type: String
focal_class.var_name: METADATA_CLUSTER_PROPERTY_NAME
focal_class.declarator: INSTANCE_REVISION_UPDATED_KEY = "dubbo.instance.revision.updated"
focal_class.modifier: public static
focal_class.original_string: public static String INSTANCE_REVISION_UPDATED_KEY = "dubbo.instance.revision.updated";
focal_class.type: String
focal_class.var_name: INSTANCE_REVISION_UPDATED_KEY
focal_class.file: dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/ServiceInstanceMetadataUtils.java
focal_class.identifier: ServiceInstanceMetadataUtils
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getMetadataServiceURLsParams(ServiceInstance serviceInstance)
focal_class.full_signature: public static Map<String, Map<String, String>> getMetadataServiceURLsParams(ServiceInstance serviceInstance)
focal_class.identifier: getMetadataServiceURLsParams
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: Map<String, Map<String, String>>
focal_class.signature: Map<String, Map<String, String>> getMetadataServiceURLsParams(ServiceInstance serviceInstance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getMetadataServiceURLParams(ServiceInstance serviceInstance, String protocol)
focal_class.full_signature: public static Map<String, String> getMetadataServiceURLParams(ServiceInstance serviceInstance, String protocol)
focal_class.identifier: getMetadataServiceURLParams
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance, String protocol)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getMetadataServiceURLParams(ServiceInstance serviceInstance, String protocol)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getMetadataServiceParameter(List<URL> urls)
focal_class.full_signature: public static String getMetadataServiceParameter(List<URL> urls)
focal_class.identifier: getMetadataServiceParameter
focal_class.modifiers: public static
focal_class.parameters: (List<URL> urls)
focal_class.return: String
focal_class.signature: String getMetadataServiceParameter(List<URL> urls)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getParams(URL providerURL)
focal_class.full_signature: private static Map<String, String> getParams(URL providerURL)
focal_class.identifier: getParams
focal_class.modifiers: private static
focal_class.parameters: (URL providerURL)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> getParams(URL providerURL)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getExportedServicesRevision(ServiceInstance serviceInstance)
focal_class.full_signature: public static String getExportedServicesRevision(ServiceInstance serviceInstance)
focal_class.identifier: getExportedServicesRevision
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: String
focal_class.signature: String getExportedServicesRevision(ServiceInstance serviceInstance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getMetadataStorageType(URL registryURL)
focal_class.full_signature: public static String getMetadataStorageType(URL registryURL)
focal_class.identifier: getMetadataStorageType
focal_class.modifiers: public static
focal_class.parameters: (URL registryURL)
focal_class.return: String
focal_class.signature: String getMetadataStorageType(URL registryURL)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getMetadataStorageType(ServiceInstance serviceInstance)
focal_class.full_signature: public static String getMetadataStorageType(ServiceInstance serviceInstance)
focal_class.identifier: getMetadataStorageType
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: String
focal_class.signature: String getMetadataStorageType(ServiceInstance serviceInstance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.setMetadataStorageType(ServiceInstance serviceInstance, String metadataType)
focal_class.full_signature: public static void setMetadataStorageType(ServiceInstance serviceInstance, String metadataType)
focal_class.identifier: setMetadataStorageType
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance, String metadataType)
focal_class.return: void
focal_class.signature: void setMetadataStorageType(ServiceInstance serviceInstance, String metadataType)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getRemoteCluster(ServiceInstance serviceInstance)
focal_class.full_signature: public static String getRemoteCluster(ServiceInstance serviceInstance)
focal_class.identifier: getRemoteCluster
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: String
focal_class.signature: String getRemoteCluster(ServiceInstance serviceInstance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.isDubboServiceInstance(ServiceInstance serviceInstance)
focal_class.full_signature: public static boolean isDubboServiceInstance(ServiceInstance serviceInstance)
focal_class.identifier: isDubboServiceInstance
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance)
focal_class.return: boolean
focal_class.signature: boolean isDubboServiceInstance(ServiceInstance serviceInstance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.setEndpoints(ServiceInstance serviceInstance, Map<String, Integer> protocolPorts)
focal_class.full_signature: public static void setEndpoints(ServiceInstance serviceInstance, Map<String, Integer> protocolPorts)
focal_class.identifier: setEndpoints
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance, Map<String, Integer> protocolPorts)
focal_class.return: void
focal_class.signature: void setEndpoints(ServiceInstance serviceInstance, Map<String, Integer> protocolPorts)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.getProtocolPort(ServiceInstance serviceInstance, String protocol)
focal_class.full_signature: public static Integer getProtocolPort(ServiceInstance serviceInstance, String protocol)
focal_class.identifier: getProtocolPort
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance serviceInstance, String protocol)
focal_class.return: Integer
focal_class.signature: Integer getProtocolPort(ServiceInstance serviceInstance, String protocol)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.calInstanceRevision(ServiceDiscovery serviceDiscovery, ServiceInstance instance)
focal_class.full_signature: public static void calInstanceRevision(ServiceDiscovery serviceDiscovery, ServiceInstance instance)
focal_class.identifier: calInstanceRevision
focal_class.modifiers: public static
focal_class.parameters: (ServiceDiscovery serviceDiscovery, ServiceInstance instance)
focal_class.return: void
focal_class.signature: void calInstanceRevision(ServiceDiscovery serviceDiscovery, ServiceInstance instance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.isInstanceUpdated(ServiceInstance instance)
focal_class.full_signature: public static boolean isInstanceUpdated(ServiceInstance instance)
focal_class.identifier: isInstanceUpdated
focal_class.modifiers: public static
focal_class.parameters: (ServiceInstance instance)
focal_class.return: boolean
focal_class.signature: boolean isInstanceUpdated(ServiceInstance instance)
focal_class.class_method_signature: ServiceInstanceMetadataUtils.refreshMetadataAndInstance()
focal_class.full_signature: public static void refreshMetadataAndInstance()
focal_class.identifier: refreshMetadataAndInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void refreshMetadataAndInstance()
focal_class.class_method_signature: ServiceInstanceMetadataUtils.setDefaultParams(Map<String, String> params, URL providerURL)
focal_class.full_signature: private static void setDefaultParams(Map<String, String> params, URL providerURL)
focal_class.identifier: setDefaultParams
focal_class.modifiers: private static
focal_class.parameters: (Map<String, String> params, URL providerURL)
focal_class.return: void
focal_class.signature: void setDefaultParams(Map<String, String> params, URL providerURL)
focal_method.body: public static String getMetadataServiceParameter(List<URL> urls) {
  
          Map<String, Map<String, String>> params = new HashMap<>();
  
          urls.stream()
                  // remove APPLICATION_KEY because service name must be present
                  .map(url -> url.removeParameter(APPLICATION_KEY))
                  // remove GROUP_KEY, always uses application name.
                  .map(url -> url.removeParameter(GROUP_KEY))
                  // remove DEPRECATED_KEY because it's always false
                  .map(url -> url.removeParameter(DEPRECATED_KEY))
                  // remove TIMESTAMP_KEY because it's nonsense
                  .map(url -> url.removeParameter(TIMESTAMP_KEY))
                  .forEach(url -> {
                      String protocol = url.getProtocol();
                      params.put(protocol, getParams(url));
                  });
  
          if (params.isEmpty()) {
              return null;
          }
  
          return JSON.toJSONString(params);
      }
focal_method.class_method_signature: ServiceInstanceMetadataUtils.getMetadataServiceParameter(List<URL> urls)
focal_method.full_signature: public static String getMetadataServiceParameter(List<URL> urls)
focal_method.identifier: getMetadataServiceParameter
focal_method.invocations: forEach map map map map stream removeParameter removeParameter removeParameter removeParameter getProtocol put getParams isEmpty toJSONString
focal_method.modifiers: public static
focal_method.parameters: (List<URL> urls)
focal_method.return: String
focal_method.signature: String getMetadataServiceParameter(List<URL> urls)