This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch dev-metadata
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git

commit 6999c6a3eb6c038b2648645d68fcad3bd143b6a1
Author: ken.lj <[email protected]>
AuthorDate: Fri Nov 16 16:07:42 2018 +0800

    refactor override rule
---
 .../cluster/configurator/AbstractConfigurator.java | 84 +++++++++++++++-------
 .../java/org/apache/dubbo/common/Constants.java    |  4 ++
 .../registry/integration/parser/ConfigParser.java  | 45 +++++-------
 .../integration/parser/model/ConfigItem.java       | 20 ++++--
 .../parser/model/ConfiguratorConfig.java           | 10 +++
 .../integration/parser/model/ConfiguratorRule.java | 54 --------------
 .../apache/dubbo/registry/ConfigParserTest.java    | 33 +++++----
 .../src/test/resources/AppAnyServices.yml          |  9 +--
 .../src/test/resources/AppMultiServices.yml        | 19 +++--
 .../src/test/resources/AppNoService.yml            |  8 +--
 .../test/resources/ConsumerSpecificProviders.yml   | 15 ++++
 .../src/test/resources/ServiceGroupVersion.yml     | 13 ++--
 .../src/test/resources/ServiceMultiApps.yml        |  9 +--
 .../src/test/resources/ServiceNoApp.yml            | 13 ++--
 .../src/test/resources/ServiceNoRule.yml           |  2 +-
 15 files changed, 164 insertions(+), 174 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java
 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java
index 37b4e0f..449bafd 100644
--- 
a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java
+++ 
b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java
@@ -19,6 +19,7 @@ package org.apache.dubbo.rpc.cluster.configurator;
 import org.apache.dubbo.common.Constants;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.utils.NetUtils;
+import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.rpc.cluster.Configurator;
 
 import java.util.HashSet;
@@ -51,51 +52,80 @@ public abstract class AbstractConfigurator implements 
Configurator {
         if (!configuratorUrl.getParameter(Constants.ENABLED_KEY, true) || 
configuratorUrl.getHost() == null || url == null || url.getHost() == null) {
             return url;
         }
+        /**
+         * This if branch is created since 2.7.0.
+         */
+        String apiVersion = 
configuratorUrl.getParameter(Constants.API_VERSION_KEY);
+        if (StringUtils.isNotEmpty(apiVersion)) {
+            int configuratorPort = configuratorUrl.getPort();
+            if (configuratorPort == 0) {
+                configureIfMatch(NetUtils.getLocalHost(), url, 
configuratorUrl);
+            } else {
+                if (url.getPort() == configuratorPort) {
+                    configureIfMatch(configuratorUrl.getHost(), url, 
configuratorUrl);
+                }
+            }
+        }
+        /**
+         * This else branch is deprecated and is left only to keep 
compatibility with versions before 2.7.0
+         */
+        else {
+            url = configureDeprecated(url);
+        }
+        return url;
+    }
+
+    @Deprecated
+    private URL configureDeprecated(URL url) {
         // If override url has port, means it is a provider address. We want 
to control a specific provider with this override url, it may take effect on 
the specific provider instance or on consumers holding this provider instance.
         if (configuratorUrl.getPort() != 0) {
             if (url.getPort() == configuratorUrl.getPort()) {
-                return configureIfMatch(url.getHost(), url);
+                return configureIfMatch(url.getHost(), url, configuratorUrl);
             }
         } else {// override url don't have a port, means the ip override url 
specify is a consumer address or 0.0.0.0
             // 1.If it is a consumer ip address, the intention is to control a 
specific consumer instance, it must takes effect at the consumer side, any 
provider received this override url should ignore;
             // 2.If the ip is 0.0.0.0, this override url can be used on 
consumer, and also can be used on provider
             if (url.getParameter(Constants.SIDE_KEY, 
Constants.PROVIDER).equals(Constants.CONSUMER)) {
-                return configureIfMatch(NetUtils.getLocalHost(), url);// 
NetUtils.getLocalHost is the ip address consumer registered to registry.
+                return configureIfMatch(NetUtils.getLocalHost(), url, 
configuratorUrl);// NetUtils.getLocalHost is the ip address consumer registered 
to registry.
             } else if (url.getParameter(Constants.SIDE_KEY, 
Constants.CONSUMER).equals(Constants.PROVIDER)) {
-                return configureIfMatch(Constants.ANYHOST_VALUE, url);// take 
effect on all providers, so address must be 0.0.0.0, otherwise it won't flow to 
this if branch
+                return configureIfMatch(Constants.ANYHOST_VALUE, url, 
configuratorUrl);// take effect on all providers, so address must be 0.0.0.0, 
otherwise it won't flow to this if branch
             }
         }
         return url;
     }
 
-    private URL configureIfMatch(String host, URL url) {
+    private URL configureIfMatch(String host, URL url, URL configuratorUrl) {
         if (Constants.ANYHOST_VALUE.equals(configuratorUrl.getHost()) || 
host.equals(configuratorUrl.getHost())) {
-            String configApplication = 
configuratorUrl.getParameter(Constants.APPLICATION_KEY,
-                    configuratorUrl.getUsername());
-            String currentApplication = 
url.getParameter(Constants.APPLICATION_KEY, url.getUsername());
-            if (configApplication == null || 
Constants.ANY_VALUE.equals(configApplication)
-                    || configApplication.equals(currentApplication)) {
-                Set<String> conditionKeys = new HashSet<String>();
-                conditionKeys.add(Constants.CATEGORY_KEY);
-                conditionKeys.add(Constants.CHECK_KEY);
-                conditionKeys.add(Constants.DYNAMIC_KEY);
-                conditionKeys.add(Constants.ENABLED_KEY);
-                conditionKeys.add(Constants.GROUP_KEY);
-                conditionKeys.add(Constants.VERSION_KEY);
-                conditionKeys.add(Constants.APPLICATION_KEY);
-                conditionKeys.add(Constants.SIDE_KEY);
-                for (Map.Entry<String, String> entry : 
configuratorUrl.getParameters().entrySet()) {
-                    String key = entry.getKey();
-                    String value = entry.getValue();
-                    if (key.startsWith("~") || 
Constants.APPLICATION_KEY.equals(key) || Constants.SIDE_KEY.equals(key)) {
-                        conditionKeys.add(key);
-                        if (value != null && !Constants.ANY_VALUE.equals(value)
-                                && 
!value.equals(url.getParameter(key.startsWith("~") ? key.substring(1) : key))) {
-                            return url;
+            // TODO, to support wildcards
+            String providers = 
configuratorUrl.getParameter(Constants.OVERRIDE_PROVIDERS_KEY);
+            if (StringUtils.isEmpty(providers) || 
providers.contains(url.getAddress()) || 
providers.contains(Constants.ANYHOST_VALUE)) {
+                String configApplication = 
configuratorUrl.getParameter(Constants.APPLICATION_KEY,
+                        configuratorUrl.getUsername());
+                String currentApplication = 
url.getParameter(Constants.APPLICATION_KEY, url.getUsername());
+                if (configApplication == null || 
Constants.ANY_VALUE.equals(configApplication)
+                        || configApplication.equals(currentApplication)) {
+                    Set<String> conditionKeys = new HashSet<String>();
+                    conditionKeys.add(Constants.CATEGORY_KEY);
+                    conditionKeys.add(Constants.CHECK_KEY);
+                    conditionKeys.add(Constants.DYNAMIC_KEY);
+                    conditionKeys.add(Constants.ENABLED_KEY);
+                    conditionKeys.add(Constants.GROUP_KEY);
+                    conditionKeys.add(Constants.VERSION_KEY);
+                    conditionKeys.add(Constants.APPLICATION_KEY);
+                    conditionKeys.add(Constants.SIDE_KEY);
+                    for (Map.Entry<String, String> entry : 
configuratorUrl.getParameters().entrySet()) {
+                        String key = entry.getKey();
+                        String value = entry.getValue();
+                        if (key.startsWith("~") || 
Constants.APPLICATION_KEY.equals(key) || Constants.SIDE_KEY.equals(key)) {
+                            conditionKeys.add(key);
+                            if (value != null && 
!Constants.ANY_VALUE.equals(value)
+                                    && 
!value.equals(url.getParameter(key.startsWith("~") ? key.substring(1) : key))) {
+                                return url;
+                            }
                         }
                     }
+                    return doConfigure(url, 
configuratorUrl.removeParameters(conditionKeys));
                 }
-                return doConfigure(url, 
configuratorUrl.removeParameters(conditionKeys));
             }
         }
         return url;
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
index a6c53be..f6e48f7 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/Constants.java
@@ -728,6 +728,10 @@ public class Constants {
 
     public static final String CYCLE_REPORT_KEY = "cyclereport";
 
+    public static final String API_VERSION_KEY = "apiVersion";
+
+    public static final String OVERRIDE_PROVIDERS_KEY = "providerAddreses";
+
     public static final String[] DEFAULT_REGISTER_PROVIDER_KEYS = 
{APPLICATION_KEY, CODEC_KEY, EXCHANGER_KEY, SERIALIZATION_KEY, CLUSTER_KEY, 
CONNECTIONS_KEY, DEPRECATED_KEY,
             GROUP_KEY, LOADBALANCE_KEY, MOCK_KEY, PATH_KEY, TIMEOUT_KEY, 
TOKEN_KEY, VERSION_KEY, WARMUP_KEY, WEIGHT_KEY, TIMESTAMP_KEY, 
DUBBO_VERSION_KEY};
 
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
index 5483e3e..35ef69e 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/ConfigParser.java
@@ -18,16 +18,17 @@ package org.apache.dubbo.registry.integration.parser;
 
 import org.apache.dubbo.common.Constants;
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.utils.CollectionUtils;
 import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.registry.integration.parser.model.ConfigItem;
 import org.apache.dubbo.registry.integration.parser.model.ConfiguratorConfig;
-import org.apache.dubbo.registry.integration.parser.model.ConfiguratorRule;
 import org.yaml.snakeyaml.TypeDescription;
 import org.yaml.snakeyaml.Yaml;
 import org.yaml.snakeyaml.constructor.Constructor;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -129,33 +130,23 @@ public class ConfigParser {
             sb.append("&side=");
             sb.append(item.getSide());
         }
-        ConfiguratorRule rules = item.getRules();
-        if (rules == null || (rules.getThreadpool() == null && 
rules.getConfig() == null && rules.getCluster() == null)) {
-            throw new IllegalStateException("Invalid configurator rules!");
+        Map<String, String> parameters = item.getParameters();
+        if (parameters == null || parameters.isEmpty()) {
+            throw new IllegalStateException("Invalid configurator rule, please 
specify at least one parameter you want to change in the rule!");
         }
-        if (rules.getThreadpool() != null) {
-            rules.getThreadpool().forEach((k, v) -> {
-                sb.append("&");
-                sb.append(k);
-                sb.append("=");
-                sb.append(v);
-            });
-        }
-        if (rules.getCluster() != null) {
-            rules.getCluster().forEach((k, v) -> {
-                sb.append("&");
-                sb.append(k);
-                sb.append("=");
-                sb.append(v);
-            });
-        }
-        if (rules.getConfig() != null) {
-            rules.getConfig().forEach((k, v) -> {
-                sb.append("&");
-                sb.append(k);
-                sb.append("=");
-                sb.append(v);
-            });
+
+        parameters.forEach((k, v) -> {
+            sb.append("&");
+            sb.append(k);
+            sb.append("=");
+            sb.append(v);
+        });
+
+        if (CollectionUtils.isNotEmpty(item.getProviderAddresses())) {
+            sb.append("&");
+            sb.append(Constants.OVERRIDE_PROVIDERS_KEY);
+            sb.append("=");
+            sb.append(CollectionUtils.join(item.getProviderAddresses(), ","));
         }
 
         return sb.toString();
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfigItem.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfigItem.java
index 71d93c9..70aaf36 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfigItem.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfigItem.java
@@ -17,15 +17,17 @@
 package org.apache.dubbo.registry.integration.parser.model;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  *
  */
 public class ConfigItem {
     private List<String> addresses;
+    private List<String> providerAddresses;
     private List<String> services;
     private List<String> applications;
-    private ConfiguratorRule rules;
+    private Map<String, String> parameters;
     private String side;
 
     public List<String> getAddresses() {
@@ -52,12 +54,20 @@ public class ConfigItem {
         this.applications = applications;
     }
 
-    public ConfiguratorRule getRules() {
-        return rules;
+    public List<String> getProviderAddresses() {
+        return providerAddresses;
     }
 
-    public void setRules(ConfiguratorRule rules) {
-        this.rules = rules;
+    public void setProviderAddresses(List<String> providerAddresses) {
+        this.providerAddresses = providerAddresses;
+    }
+
+    public Map<String, String> getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(Map<String, String> parameters) {
+        this.parameters = parameters;
     }
 
     public String getSide() {
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorConfig.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorConfig.java
index 3265b21..f1d5034 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorConfig.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorConfig.java
@@ -25,11 +25,21 @@ public class ConfiguratorConfig {
     public static final String SCOPE_SERVICE = "service";
     public static final String SCOPE_APPLICATION = "application";
 
+    private String apiVersion;
     private String scope;
     private String key;
     private boolean enabled = true;
     private List<ConfigItem> configs;
 
+
+    public String getApiVersion() {
+        return apiVersion;
+    }
+
+    public void setApiVersion(String apiVersion) {
+        this.apiVersion = apiVersion;
+    }
+
     public String getScope() {
         return scope;
     }
diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorRule.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorRule.java
deleted file mode 100644
index 7fbdb87..0000000
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/parser/model/ConfiguratorRule.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.dubbo.registry.integration.parser.model;
-
-import java.util.Map;
-
-/**
- *
- */
-public class ConfiguratorRule {
-    private Map<String, String> threadpool;
-
-    private Map<String, String> cluster;
-
-    private Map<String, String> config;
-
-    public Map<String, String> getThreadpool() {
-        return threadpool;
-    }
-
-    public void setThreadpool(Map<String, String> threadpool) {
-        this.threadpool = threadpool;
-    }
-
-    public Map<String, String> getCluster() {
-        return cluster;
-    }
-
-    public void setCluster(Map<String, String> cluster) {
-        this.cluster = cluster;
-    }
-
-    public Map<String, String> getConfig() {
-        return config;
-    }
-
-    public void setConfig(Map<String, String> config) {
-        this.config = config;
-    }
-}
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ConfigParserTest.java
 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ConfigParserTest.java
index bb90b9d..0b993fe 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ConfigParserTest.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/ConfigParserTest.java
@@ -67,11 +67,8 @@ public class ConfigParserTest {
         Assert.assertNotNull(urls);
         Assert.assertEquals(2, urls.size());
         URL url = urls.get(0);
-        Assert.assertEquals(url.getAddress(), "127.0.0.1");
-        Assert.assertEquals(url.getParameter(Constants.TIMEOUT_KEY, 0), 6666);
+        Assert.assertEquals(url.getAddress(), "127.0.0.1:20880");
         Assert.assertEquals(url.getParameter(Constants.WEIGHT_KEY, 0), 222);
-        Assert.assertEquals(url.getParameter(Constants.LOADBALANCE_KEY), 
"random");
-        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY, ""), 
"");
     }
 
     @Test
@@ -82,7 +79,7 @@ public class ConfigParserTest {
         Assert.assertEquals(1, urls.size());
         URL url = urls.get(0);
         Assert.assertEquals("testgroup", 
url.getParameter(Constants.GROUP_KEY));
-        Assert.assertEquals("1.0.0", url.getParameter(Constants.GROUP_KEY));
+        Assert.assertEquals("1.0.0", url.getParameter(Constants.VERSION_KEY));
     }
 
     @Test
@@ -94,8 +91,6 @@ public class ConfigParserTest {
         URL url = urls.get(0);
         Assert.assertEquals("127.0.0.1", url.getAddress());
         Assert.assertEquals(6666, url.getParameter(Constants.TIMEOUT_KEY, 0));
-        Assert.assertEquals(222, url.getParameter(Constants.WEIGHT_KEY, 0));
-        Assert.assertEquals("random", 
url.getParameter(Constants.LOADBALANCE_KEY));
         Assert.assertNotNull(url.getParameter(Constants.APPLICATION_KEY));
     }
 
@@ -116,9 +111,8 @@ public class ConfigParserTest {
         Assert.assertEquals("127.0.0.1", url.getAddress());
         Assert.assertEquals("service1", url.getServiceInterface());
         Assert.assertEquals(6666, url.getParameter(Constants.TIMEOUT_KEY, 0));
-        Assert.assertEquals(222, url.getParameter(Constants.WEIGHT_KEY, 0));
         Assert.assertEquals("random", 
url.getParameter(Constants.LOADBALANCE_KEY));
-        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"app1");
+        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"demo-consumer");
     }
 
 
@@ -132,9 +126,8 @@ public class ConfigParserTest {
         Assert.assertEquals("127.0.0.1", url.getAddress());
         Assert.assertEquals("*", url.getServiceInterface());
         Assert.assertEquals(6666, url.getParameter(Constants.TIMEOUT_KEY, 0));
-        Assert.assertEquals(222, url.getParameter(Constants.WEIGHT_KEY, 0));
         Assert.assertEquals("random", 
url.getParameter(Constants.LOADBALANCE_KEY));
-        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"app1");
+        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"demo-consumer");
     }
 
     @Test
@@ -147,9 +140,23 @@ public class ConfigParserTest {
         Assert.assertEquals("127.0.0.1", url.getAddress());
         Assert.assertEquals("*", url.getServiceInterface());
         Assert.assertEquals(6666, url.getParameter(Constants.TIMEOUT_KEY, 0));
-        Assert.assertEquals(222, url.getParameter(Constants.WEIGHT_KEY, 0));
         Assert.assertEquals("random", 
url.getParameter(Constants.LOADBALANCE_KEY));
-        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"app1");
+        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"demo-consumer");
+    }
+
+    @Test
+    public void parseConsumerSpecificProvidersTest() {
+        InputStream yamlStream = 
this.getClass().getResourceAsStream("/ConsumerSpecificProviders.yml");
+        List<URL> urls = 
ConfigParser.parseConfigurators(streamToString(yamlStream));
+        Assert.assertNotNull(urls);
+        Assert.assertEquals(1, urls.size());
+        URL url = urls.get(0);
+        Assert.assertEquals("127.0.0.1", url.getAddress());
+        Assert.assertEquals("*", url.getServiceInterface());
+        Assert.assertEquals(6666, url.getParameter(Constants.TIMEOUT_KEY, 0));
+        Assert.assertEquals("random", 
url.getParameter(Constants.LOADBALANCE_KEY));
+        Assert.assertEquals("127.0.0.1:20880", 
url.getParameter(Constants.OVERRIDE_PROVIDERS_KEY));
+        Assert.assertEquals(url.getParameter(Constants.APPLICATION_KEY), 
"demo-consumer");
     }
 
 }
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/AppAnyServices.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/AppAnyServices.yml
index 2d6da8b..d2282bb 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/AppAnyServices.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/AppAnyServices.yml
@@ -1,16 +1,13 @@
 # Application scope, apply to all services.
 ---
+apiVersion: v2.7
 scope: application
-key: app1
+key: demo-consumer
 configs:
  - addresses: [127.0.0.1, 0.0.0.0]
    services: ['*']
-   side: provider
-   rules:
-    cluster:
+   parameters:
      loadbalance: random
      cluster: failfast
-    config:
      timeout: 6666
-     weight: 222
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/AppMultiServices.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/AppMultiServices.yml
index 7ec8c94..4839d3b 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/AppMultiServices.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/AppMultiServices.yml
@@ -1,16 +1,13 @@
 # Application scope, apply to the specified services
 ---
+apiVersion: v2.7
 scope: application
-key: app1
+key: demo-consumer
 configs:
- - addresses: [127.0.0.1, 0.0.0.0]
-   services: [service1, service2]
-   side: provider
-   rules:
-    cluster:
-     loadbalance: random
-     cluster: failfast
-    config:
-     timeout: 6666
-     weight: 222
+- addresses: [127.0.0.1, 0.0.0.0]
+  services: ['service1', 'service2']
+  parameters:
+    loadbalance: random
+    cluster: failfast
+    timeout: 6666
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/AppNoService.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/AppNoService.yml
index 3ad4eb2..68ed68d 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/AppNoService.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/AppNoService.yml
@@ -1,15 +1,13 @@
 # Application scope, no service means apply to all
 ---
+apiVersion: v2.7
 scope: application
-key: app1
+key: demo-consumer
 configs:
  - addresses:
     - 127.0.0.1
-   rules:
-    cluster:
+   parameters:
      loadbalance: random
      cluster: failfast
-    config:
      timeout: 6666
-     weight: 222
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ConsumerSpecificProviders.yml
 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ConsumerSpecificProviders.yml
new file mode 100644
index 0000000..eeca787
--- /dev/null
+++ 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ConsumerSpecificProviders.yml
@@ -0,0 +1,15 @@
+# Application scope, no service means apply to all
+---
+apiVersion: v2.7
+scope: application
+key: demo-consumer
+configs:
+- addresses:
+  - 127.0.0.1
+  providerAddresses: ['127.0.0.1:20880']
+  parameters:
+    loadbalance: random
+    cluster: failfast
+    timeout: 6666
+    weight: 222
+...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceGroupVersion.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceGroupVersion.yml
index d4ef79e..294c184 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceGroupVersion.yml
+++ 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceGroupVersion.yml
@@ -1,15 +1,10 @@
 # Service scope, without any app
 ---
+apiVersion: v2.7
 scope: service
 key: testgroup/servicekey:1.0.0
 configs:
- - addresses: [127.0.0.1]
-   side: provider
-   rules:
-    cluster:
-     loadbalance: random
-     cluster: failfast
-    config:
-     timeout: 6666
-     weight: 222
+- addresses: ['127.0.0.1:20880']
+  parameters:
+    weight: 222
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceMultiApps.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceMultiApps.yml
index a6cd6ac..61207ee 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceMultiApps.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceMultiApps.yml
@@ -1,16 +1,11 @@
 # Service scope, with multiple apps
 ---
+apiVersion: v2.7
 scope: service
 key: serviceKey
 configs:
  - addresses: [127.0.0.1, 0.0.0.0]
    applications: [app1, app2]
-   side: provider
-   rules:
-    cluster:
-     loadbalance: random
-     cluster: failfast
-    config:
+   parameters:
      timeout: 6666
-     weight: 222
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoApp.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoApp.yml
index b850ffe..3b64be0 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoApp.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoApp.yml
@@ -1,15 +1,10 @@
 # Service scope, without any app
 ---
+apiVersion: v2.7
 scope: service
 key: serviceKey
 configs:
- - addresses: [127.0.0.1, 0.0.0.0]
-   side: provider
-   rules:
-    cluster:
-     loadbalance: random
-     cluster: failfast
-    config:
-     timeout: 6666
-     weight: 222
+- addresses: ['127.0.0.1:20880', '0.0.0.0:20881']
+  parameters:
+    weight: 222
 ...
\ No newline at end of file
diff --git 
a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoRule.yml 
b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoRule.yml
index 1b09658..aa4e4b2 100644
--- a/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoRule.yml
+++ b/dubbo-registry/dubbo-registry-api/src/test/resources/ServiceNoRule.yml
@@ -1,9 +1,9 @@
 # Service scope, without  specific App
 ---
+apiVersion: v2.7
 scope: service
 key: serviceKey
 configs:
  - addresses: [127.0.0.1, 0.0.0.0]
    applications: [app1, app2]
-   side: provider
 ...
\ No newline at end of file

Reply via email to