Merge remote-tracking branch 'origin/master'
diff --git a/README.md b/README.md
index b55dc53..cffaa7b 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
Integration test leverages [docker](https://docs.docker.com/get-started/) to setup test environment, more accurately, to start dubbo provider instance, and any other supporting systems like registry center if necessary, in docker.
-Please install `docker` and `docker-compose` first, then build the test image `dubb/sample-test`.
+Please install `docker` and `docker-compose` first, then build the test image `dubbo/sample-test`.
```bash
cd dubbo-samples
@@ -52,9 +52,9 @@
cd dubbo-samples
./test/run-tests.sh <project.basedir>
```
-
+
For example, run the `dubbo-samples-annotation` test case:
-
+
```
./test/run-tests.sh dubbo-samples-annotation
```
diff --git a/dubbo-samples-async/dubbo-samples-async-onerror/src/test/java/org/apache/dubbo/samples/governance/AsyncServiceIT.java b/dubbo-samples-async/dubbo-samples-async-onerror/src/test/java/org/apache/dubbo/samples/governance/AsyncServiceIT.java
index 548bb99..9a6d4da 100644
--- a/dubbo-samples-async/dubbo-samples-async-onerror/src/test/java/org/apache/dubbo/samples/governance/AsyncServiceIT.java
+++ b/dubbo-samples-async/dubbo-samples-async-onerror/src/test/java/org/apache/dubbo/samples/governance/AsyncServiceIT.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * 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.samples.governance;
import org.apache.dubbo.rpc.RpcContext;
diff --git a/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml b/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
index 0c74858..0cc82a1 100644
--- a/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
+++ b/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/pom.xml
@@ -41,7 +41,7 @@
<skip_maven_deploy>true</skip_maven_deploy>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<spring.version>4.3.16.RELEASE</spring.version>
- <dubbo.version>3.0.0-SNAPSHOT</dubbo.version>
+ <dubbo.version>3.0.0</dubbo.version>
<junit.version>4.12</junit.version>
</properties>
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-configuration.yml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-configuration.yml
new file mode 100644
index 0000000..a5c3ab1
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-configuration.yml
@@ -0,0 +1,65 @@
+# 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.
+
+timeout: 240
+
+services:
+ zookeeper:
+ image: zookeeper:latest
+
+ servicediscovery-migration-provider1:
+ type: app
+ basedir: dubbo-servicediscovery-migration-provider1
+ mainClass: org.apache.dubbo.demo.provider.Application
+ systemProps:
+ - zookeeper.address=zookeeper
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ checkPorts:
+ - 20881
+ checkLog: "dubbo service started"
+ depends_on:
+ - zookeeper
+
+ servicediscovery-migration-provider2:
+ type: app
+ basedir: dubbo-servicediscovery-migration-provider2
+ mainClass: org.apache.dubbo.demo.provider.Application
+ systemProps:
+ - zookeeper.address=zookeeper
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ checkPorts:
+ - 20882
+ checkLog: "dubbo service started"
+ depends_on:
+ - zookeeper
+
+ servicediscovery-migration-consumer-test:
+ type: test
+ basedir: dubbo-servicediscovery-migration-consumer
+ tests:
+ - "**/*IT.class"
+ systemProps:
+ - zookeeper.address=zookeeper
+ waitPortsBeforeRun:
+ - zookeeper:2181
+ - servicediscovery-migration-provider1:20881
+ - servicediscovery-migration-provider2:20882
+ depends_on:
+ - zookeeper
+ - servicediscovery-migration-provider1
+ - servicediscovery-migration-provider2
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-versions.conf b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-versions.conf
new file mode 100644
index 0000000..c5a87cb
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/case-versions.conf
@@ -0,0 +1,24 @@
+#
+#
+# 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.
+#
+
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version=3.*
+spring.version=4.*, 5.*
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/pom.xml
new file mode 100644
index 0000000..2ec4b40
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/pom.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-servicediscovery-migration</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-servicediscovery-migration-api</artifactId>
+
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ </properties>
+
+</project>
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/src/main/java/org/apache/dubbo/demo/DemoService.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/src/main/java/org/apache/dubbo/demo/DemoService.java
new file mode 100644
index 0000000..64672fa
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-api/src/main/java/org/apache/dubbo/demo/DemoService.java
@@ -0,0 +1,23 @@
+/*
+ * 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.demo;
+
+public interface DemoService {
+
+ String sayHello(String name);
+
+}
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/pom.xml
new file mode 100644
index 0000000..b07283b
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-servicediscovery-migration</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-servicediscovery-migration-consumer</artifactId>
+
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-servicediscovery-migration-api</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java
new file mode 100644
index 0000000..562d3d7
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/Application.java
@@ -0,0 +1,48 @@
+/*
+ * 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.demo.consumer;
+
+import org.apache.dubbo.demo.DemoService;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class Application {
+ public static void main(String[] args) throws InterruptedException {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-consumer.xml");
+ context.start();
+
+ UpgradeUtil.writeForceInterfaceRule();
+ Thread.sleep(5000);
+
+ call(context);
+
+ UpgradeUtil.writeApplicationFirstRule(100);
+ Thread.sleep(5000);
+
+ call(context);
+
+ }
+
+ private static void call(ClassPathXmlApplicationContext context) {
+ DemoService demoServiceFromNormal = context.getBean("demoServiceFromNormal", DemoService.class);
+ System.out.println("result: " + demoServiceFromNormal.sayHello("name"));
+ DemoService demoServiceFromService = context.getBean("demoServiceFromService", DemoService.class);
+ System.out.println("result: " + demoServiceFromService.sayHello("name"));
+ DemoService demoServiceFromDual = context.getBean("demoServiceFromDual", DemoService.class);
+ System.out.println("result: " + demoServiceFromDual.sayHello("name"));
+ }
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/UpgradeUtil.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/UpgradeUtil.java
new file mode 100644
index 0000000..a09118f
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/UpgradeUtil.java
@@ -0,0 +1,52 @@
+/*
+ * 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.demo.consumer;
+
+import org.apache.dubbo.common.config.configcenter.DynamicConfiguration;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+public class UpgradeUtil {
+ private static final String DUBBO_SERVICEDISCOVERY_MIGRATION = "DUBBO_SERVICEDISCOVERY_MIGRATION";
+
+ public static void writeApplicationFirstRule(int proportion) {
+ String content = "step: APPLICATION_FIRST\r\n" +
+ "proportion: " + proportion;
+
+ String RULE_KEY = ApplicationModel.getName() + ".migration";
+ DynamicConfiguration configuration = ApplicationModel.getEnvironment().getDynamicConfiguration().get();
+ configuration.publishConfig(RULE_KEY, DUBBO_SERVICEDISCOVERY_MIGRATION, content);
+ }
+
+ public static void writeForceInterfaceRule() {
+ String content = "step: FORCE_INTERFACE\r\n" +
+ "force: true";
+
+ String RULE_KEY = ApplicationModel.getName() + ".migration";
+ DynamicConfiguration configuration = ApplicationModel.getEnvironment().getDynamicConfiguration().get();
+ configuration.publishConfig(RULE_KEY, DUBBO_SERVICEDISCOVERY_MIGRATION, content);
+ }
+
+ public static void writeForceApplicationRule() {
+ String content = "step: FORCE_APPLICATION\r\n" +
+ "force: true";
+
+ String RULE_KEY = ApplicationModel.getName() + ".migration";
+ DynamicConfiguration configuration = ApplicationModel.getEnvironment().getDynamicConfiguration().get();
+ configuration.publishConfig(RULE_KEY, DUBBO_SERVICEDISCOVERY_MIGRATION, content);
+ }
+
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/dubbo.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..8c3cb25
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/dubbo.properties
@@ -0,0 +1 @@
+dubbo.application.qos.port=33333
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/log4j.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/log4j.properties
new file mode 100644
index 0000000..2424381
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/spring/dubbo-consumer.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/spring/dubbo-consumer.xml
new file mode 100644
index 0000000..8ec9ef5
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/resources/spring/dubbo-consumer.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+
+ <dubbo:application name="dubbo-servicediscovery-migration-consumer"/>
+
+ <dubbo:registry address="zookeeper://${zookeeper.address:localhost}:${zookeeper.port:2181}"/>
+
+ <dubbo:reference id="demoServiceFromNormal" check="false" group="normal" interface="org.apache.dubbo.demo.DemoService"/>
+ <dubbo:reference id="demoServiceFromService" check="false" group="service" interface="org.apache.dubbo.demo.DemoService"/>
+ <dubbo:reference id="demoServiceFromDual" check="false" group="dual" interface="org.apache.dubbo.demo.DemoService"/>
+
+</beans>
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/DemoServiceIT.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/DemoServiceIT.java
new file mode 100644
index 0000000..70ed95f
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/DemoServiceIT.java
@@ -0,0 +1,125 @@
+/*
+ * 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.demo.consumer;
+
+import org.apache.dubbo.demo.DemoService;
+import org.apache.dubbo.rpc.RpcException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = "classpath*:spring/dubbo-consumer.xml")
+public class DemoServiceIT {
+ @Autowired
+ @Qualifier("demoServiceFromNormal")
+ private DemoService demoServiceFromNormal;
+
+ @Autowired
+ @Qualifier("demoServiceFromService")
+ private DemoService demoServiceFromService;
+
+ @Autowired
+ @Qualifier("demoServiceFromDual")
+ private DemoService demoServiceFromDual;
+
+ @Test
+ public void test() throws InterruptedException {
+ // FORCE_INTERFACE --> APPLICATION_FIRST
+ testInterface();
+ testApplication();
+
+ // APPLICATION_FIRST --> FORCE_APPLICATION
+ testApplicationForce();
+
+ // FORCE_APPLICATION --> APPLICATION_FIRST
+ testApplication();
+
+ // APPLICATION_FIRST --> FORCE_INTERFACE
+ testInterface();
+
+ // FORCE_INTERFACE --> FORCE_APPLICATION
+ testApplicationForce();
+
+ // FORCE_APPLICATION --> FORCE_INTERFACE
+ testInterface();
+ }
+
+ public void testInterface() throws InterruptedException {
+ UpgradeUtil.writeForceInterfaceRule();
+ checkIfNotified();
+
+ Assert.assertTrue(demoServiceFromNormal.sayHello("client").contains("registry-type: normal"));
+ try {
+ demoServiceFromService.sayHello("client");
+ Assert.fail();
+ } catch (RpcException ignore) {
+
+ }
+ Assert.assertTrue(demoServiceFromDual.sayHello("client").contains("registry-type: normal"));
+ }
+
+ public void testApplication() throws InterruptedException {
+ UpgradeUtil.writeApplicationFirstRule(100);
+ checkIfNotified();
+
+ Assert.assertTrue(demoServiceFromNormal.sayHello("client").contains("registry-type: normal"));
+ Assert.assertTrue(demoServiceFromService.sayHello("client").contains("registry-type: service"));
+ Assert.assertTrue(demoServiceFromDual.sayHello("client").contains("registry-type: service"));
+
+
+ UpgradeUtil.writeApplicationFirstRule(50);
+ checkIfNotified();
+
+ int serviceCount = 0;
+ for (int i = 0; i < 100; i++) {
+ if (demoServiceFromDual.sayHello("client").contains("registry-type: service")) {
+ serviceCount += 1;
+ }
+ }
+ Assert.assertTrue(serviceCount < 100);
+ }
+
+ public void testApplicationForce() throws InterruptedException {
+ UpgradeUtil.writeForceApplicationRule();
+ checkIfNotified();
+
+ try {
+ demoServiceFromNormal.sayHello("client");
+ Assert.fail();
+ } catch (RpcException ignore) {
+
+ }
+ Assert.assertTrue(demoServiceFromService.sayHello("client").contains("registry-type: service"));
+ Assert.assertTrue(demoServiceFromDual.sayHello("client").contains("registry-type: service"));
+ }
+
+ private void checkIfNotified() throws InterruptedException {
+ for (int i = 0; i < 50; i++) {
+ if (FrameworkStatusReporterImpl.getReport().size() == 3) {
+ FrameworkStatusReporterImpl.clearReport();
+ return;
+ }
+ Thread.sleep(100);
+ }
+ }
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/FrameworkStatusReporterImpl.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/FrameworkStatusReporterImpl.java
new file mode 100644
index 0000000..40f7109
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/FrameworkStatusReporterImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.demo.consumer;
+
+import org.apache.dubbo.common.status.reporter.FrameworkStatusReporter;
+
+import com.google.gson.Gson;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class FrameworkStatusReporterImpl implements FrameworkStatusReporter {
+ private static final Map<String, String> report = new HashMap<>();
+
+ @Override
+ public void report(String type, Object obj) {
+ if (obj instanceof String) {
+ Object group = new Gson().fromJson((String) obj, Map.class).get("group");
+ report.put((String) group, (String) obj);
+ }
+ }
+
+ public static Map<String, String> getReport() {
+ return report;
+ }
+
+ public static void clearReport() {
+ report.clear();
+ }
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/resources/META-INF.dubbo.internal/org.apache.dubbo.common.status.reporter.FrameworkStatusReporter b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/resources/META-INF.dubbo.internal/org.apache.dubbo.common.status.reporter.FrameworkStatusReporter
new file mode 100644
index 0000000..98a8d9f
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/resources/META-INF.dubbo.internal/org.apache.dubbo.common.status.reporter.FrameworkStatusReporter
@@ -0,0 +1 @@
+test = org.apache.dubbo.demo.consumer.FrameworkStatusReporterImpl
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/pom.xml
new file mode 100644
index 0000000..f6514ff
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-servicediscovery-migration</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-servicediscovery-migration-provider1</artifactId>
+
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-servicediscovery-migration-api</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/Application.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/Application.java
new file mode 100644
index 0000000..3cbf713
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/Application.java
@@ -0,0 +1,31 @@
+/*
+ * 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.demo.provider;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Application {
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-provider.xml");
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java
new file mode 100644
index 0000000..b3cb93c
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java
@@ -0,0 +1,34 @@
+/*
+ * 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.demo.provider;
+
+import org.apache.dubbo.demo.DemoService;
+import org.apache.dubbo.rpc.RpcContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServiceFromDual implements DemoService {
+ private static final Logger logger = LoggerFactory.getLogger(DemoServiceFromDual.class);
+
+ @Override
+ public String sayHello(String name) {
+ logger.info("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress() + ", registry-type: normal";
+ }
+
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromNormal.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromNormal.java
new file mode 100644
index 0000000..0285204
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromNormal.java
@@ -0,0 +1,34 @@
+/*
+ * 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.demo.provider;
+
+import org.apache.dubbo.demo.DemoService;
+import org.apache.dubbo.rpc.RpcContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServiceFromNormal implements DemoService {
+ private static final Logger logger = LoggerFactory.getLogger(DemoServiceFromNormal.class);
+
+ @Override
+ public String sayHello(String name) {
+ logger.info("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress() + ", registry-type: normal";
+ }
+
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/dubbo.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..3997c19
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/dubbo.properties
@@ -0,0 +1,2 @@
+dubbo.application.qos.port=22222
+dubbo.application.register-mode=interface
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/log4j.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/log4j.properties
new file mode 100644
index 0000000..15a0900
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/spring/dubbo-provider.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/spring/dubbo-provider.xml
new file mode 100644
index 0000000..88844bb
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider1/src/main/resources/spring/dubbo-provider.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+
+ <dubbo:application name="dubbo-servicediscovery-migration-provider1"/>
+
+ <dubbo:registry id="normal" address="zookeeper://${zookeeper.address:localhost}:${zookeeper.port:2181}"/>
+
+ <dubbo:protocol name="dubbo" port="20881"/>
+
+ <bean id="demoServiceFromNormal" class="org.apache.dubbo.demo.provider.DemoServiceFromNormal"/>
+ <bean id="demoServiceFromDual" class="org.apache.dubbo.demo.provider.DemoServiceFromDual"/>
+
+ <!-- only to normal registry -->
+ <dubbo:service registry="normal" group="normal" interface="org.apache.dubbo.demo.DemoService" ref="demoServiceFromNormal"/>
+ <!-- to both sides -->
+ <dubbo:service group="dual" interface="org.apache.dubbo.demo.DemoService" ref="demoServiceFromDual"/>
+
+</beans>
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/pom.xml
new file mode 100644
index 0000000..d397fd8
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-servicediscovery-migration</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-servicediscovery-migration-provider2</artifactId>
+
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <skip_maven_deploy>true</skip_maven_deploy>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-servicediscovery-migration-api</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/Application.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/Application.java
new file mode 100644
index 0000000..3cbf713
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/Application.java
@@ -0,0 +1,31 @@
+/*
+ * 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.demo.provider;
+
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Application {
+ public static void main(String[] args) throws Exception {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-provider.xml");
+ context.start();
+
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java
new file mode 100644
index 0000000..60267cc
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromDual.java
@@ -0,0 +1,34 @@
+/*
+ * 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.demo.provider;
+
+import org.apache.dubbo.demo.DemoService;
+import org.apache.dubbo.rpc.RpcContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServiceFromDual implements DemoService {
+ private static final Logger logger = LoggerFactory.getLogger(DemoServiceFromDual.class);
+
+ @Override
+ public String sayHello(String name) {
+ logger.info("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress() + ", registry-type: service";
+ }
+
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromService.java b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromService.java
new file mode 100644
index 0000000..67ccd09
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/java/org/apache/dubbo/demo/provider/DemoServiceFromService.java
@@ -0,0 +1,34 @@
+/*
+ * 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.demo.provider;
+
+import org.apache.dubbo.demo.DemoService;
+import org.apache.dubbo.rpc.RpcContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DemoServiceFromService implements DemoService {
+ private static final Logger logger = LoggerFactory.getLogger(DemoServiceFromService.class);
+
+ @Override
+ public String sayHello(String name) {
+ logger.info("Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
+ return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress()+ ", registry-type: service";
+ }
+
+}
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/dubbo.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..e30fde0
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/dubbo.properties
@@ -0,0 +1,2 @@
+dubbo.application.qos.port=22222
+dubbo.application.register-mode=instance
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/log4j.properties b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/log4j.properties
new file mode 100644
index 0000000..15a0900
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+###set log levels###
+log4j.rootLogger=info, stdout
+###output to the console###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d{dd/MM/yy HH:mm:ss:SSS z}] %t %5p %c{2}: %m%n
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/spring/dubbo-provider.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/spring/dubbo-provider.xml
new file mode 100644
index 0000000..a1e5065
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/spring/dubbo-provider.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
+
+ <dubbo:application name="dubbo-servicediscovery-migration-provider2"/>
+
+ <dubbo:registry id="service-discovery" address="zookeeper://${zookeeper.address:localhost}:${zookeeper.port:2181}?registry-type=service"/>
+
+ <dubbo:protocol name="dubbo" port="20882"/>
+
+ <bean id="demoServiceFromService" class="org.apache.dubbo.demo.provider.DemoServiceFromService"/>
+ <bean id="demoServiceFromDual" class="org.apache.dubbo.demo.provider.DemoServiceFromDual"/>
+
+ <!-- only to service discovery registry -->
+ <dubbo:service registry="service-discovery" group="service" interface="org.apache.dubbo.demo.DemoService" ref="demoServiceFromService"/>
+ <!-- to both sides -->
+ <dubbo:service group="dual" interface="org.apache.dubbo.demo.DemoService" ref="demoServiceFromDual"/>
+
+</beans>
diff --git a/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml
new file mode 100644
index 0000000..9c8fd6d
--- /dev/null
+++ b/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/pom.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <groupId>org.apache.dubbo</groupId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-servicediscovery-migration</artifactId>
+
+ <modules>
+ <module>dubbo-servicediscovery-migration-api</module>
+ <module>dubbo-servicediscovery-migration-provider1</module>
+ <module>dubbo-servicediscovery-migration-provider2</module>
+ <module>dubbo-servicediscovery-migration-consumer</module>
+ </modules>
+
+ <properties>
+ <source.level>1.8</source.level>
+ <target.level>1.8</target.level>
+ <dubbo.version>3.0.0</dubbo.version>
+ <spring.version>4.3.16.RELEASE</spring.version>
+ <junit.version>4.12</junit.version>
+ <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
+ <spring-boot-maven-plugin.version>2.1.4.RELEASE</spring-boot-maven-plugin.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-framework-bom</artifactId>
+ <version>${spring.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-bom</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <version>${dubbo.version}</version>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-dependencies-zookeeper</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <!-- For jdk 11 above JavaEE annotation -->
+ <profile>
+ <id>javax.annotation</id>
+ <activation>
+ <jdk>[1.11,)</jdk>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.3.2</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${maven-compiler-plugin.version}</version>
+ <configuration>
+ <source>${source.level}</source>
+ <target>${target.level}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/dubbo-samples-cloud-native/pom.xml b/dubbo-samples-cloud-native/pom.xml
index 0746e4a..66ea6eb 100644
--- a/dubbo-samples-cloud-native/pom.xml
+++ b/dubbo-samples-cloud-native/pom.xml
@@ -30,6 +30,7 @@
<module>dubbo-call-sc</module>
<module>dubbo-call-scdubbo</module>
<module>sc-call-dubbo</module>
+ <module>dubbo-servicediscovery-migration</module>
</modules>
</project>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/Provider2.java b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/Provider2.java
index a69fcea..79a0db4 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/Provider2.java
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-api/src/main/java/org/apache/dubbo/samples/server/Provider2.java
@@ -71,7 +71,7 @@
*/
public static Map<String, String> getExternalConfiguration() {
Map<String, String> dubboConfigurations = new HashMap<>();
- dubboConfigurations.put("dubbo.registry.address", "zookeeper://" + zookeeperHost1 + ":" + zookeeperPort1);
+ dubboConfigurations.put("dubbo.registry.address", "zookeeper://" + zookeeperHost2 + ":" + zookeeperPort2);
// you will need to add the config center address if you want to use the service governance features in 2.7,
// e.g., overrides and routers, but notice it will not be used for gathering startup configurations.
dubboConfigurations.put("dubbo.config-center.address", "zookeeper://" + zookeeperHost1 + ":" + zookeeperPort1);
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-consumer.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-consumer.xml
index c6170b7..d12a6f2 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-consumer.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-consumer.xml
@@ -27,7 +27,7 @@
<dubbo:config-center address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
- <dubbo:reference id="demoService" protocol="dubbo"
+ <dubbo:reference id="demoService" protocol="dubbo" group="*"
interface="org.apache.dubbo.samples.configcenter.api.DemoService"/>
</beans>
diff --git a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-provider.xml b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-provider.xml
index deabb92..0ae3653 100644
--- a/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-provider.xml
+++ b/dubbo-samples-configcenter/dubbo-samples-configcenter-multiprotocol/src/main/resources/spring/configcenter-provider.xml
@@ -30,9 +30,9 @@
<bean id="demoService" class="org.apache.dubbo.samples.configcenter.impl.DemoServiceImpl"/>
<dubbo:service protocol="dubbo1"
interface="org.apache.dubbo.samples.configcenter.api.DemoService"
- ref="demoService"/>
+ ref="demoService" group="groupA"/>
<dubbo:service protocol="dubbo2"
interface="org.apache.dubbo.samples.configcenter.api.DemoService"
- ref="demoService" group="groupA"/>
+ ref="demoService" group="groupB"/>
</beans>
diff --git a/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml b/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml
index 525944d..3f9ab40 100644
--- a/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml
+++ b/dubbo-samples-direct/src/main/resources/spring/dubbo-direct-provider.xml
@@ -32,5 +32,9 @@
<bean id="directService" class="org.apache.dubbo.samples.direct.impl.DirectServiceImpl"/>
<dubbo:service interface="org.apache.dubbo.samples.direct.api.DirectService" ref="directService" group="test" version="1.0.0-daily"/>
+ <!-- group="test2" -->
+ <dubbo:service interface="org.apache.dubbo.samples.direct.api.DirectService" ref="directService" group="test2" version="1.0.0-daily"/>
+ <!-- group="test3" -->
+ <dubbo:service interface="org.apache.dubbo.samples.direct.api.DirectService" ref="directService" group="test3" version="1.0.0-daily"/>
</beans>
diff --git a/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java b/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
index e0b6210..834da57 100644
--- a/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
+++ b/dubbo-samples-direct/src/test/java/org/apache/dubbo/samples/direct/DirectServiceIT.java
@@ -50,7 +50,7 @@
ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
reference.setUrl("dubbo://" + providerAddress + ":20880/" + DirectService.class.getName());
reference.setVersion("1.0.0-daily");
- reference.setGroup("test");
+ reference.setGroup("test2");
reference.setGeneric(true);
reference.setApplication(application);
reference.setInterface(DirectService.class.getName());
@@ -67,7 +67,7 @@
ReferenceConfig<DirectService> reference = new ReferenceConfig<>();
reference.setUrl("dubbo://" + providerAddress + ":20880/" + DirectService.class.getName());
reference.setVersion("1.0.0-daily");
- reference.setGroup("test");
+ reference.setGroup("test3");
reference.setApplication(application);
reference.setInterface(DirectService.class.getName());
DirectService service = reference.get();
diff --git a/dubbo-samples-governance/dubbo-samples-applevel-override/src/main/resources/dubbo.properties b/dubbo-samples-governance/dubbo-samples-applevel-override/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..9e0c362
--- /dev/null
+++ b/dubbo-samples-governance/dubbo-samples-applevel-override/src/main/resources/dubbo.properties
@@ -0,0 +1,2 @@
+dubbo.application.register-mode=interface
+dubbo.application.service-discovery.migration=FORCE_INTERFACE
\ No newline at end of file
diff --git a/dubbo-samples-governance/dubbo-samples-meshrule-router/pom.xml b/dubbo-samples-governance/dubbo-samples-meshrule-router/pom.xml
index 2c50828..b75f339 100644
--- a/dubbo-samples-governance/dubbo-samples-meshrule-router/pom.xml
+++ b/dubbo-samples-governance/dubbo-samples-meshrule-router/pom.xml
@@ -30,7 +30,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.0-SNAPSHOT</dubbo.version>
+ <dubbo.version>3.0.0</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-governance/dubbo-samples-servicelevel-override/src/main/resources/dubbo.properties b/dubbo-samples-governance/dubbo-samples-servicelevel-override/src/main/resources/dubbo.properties
new file mode 100644
index 0000000..9e0c362
--- /dev/null
+++ b/dubbo-samples-governance/dubbo-samples-servicelevel-override/src/main/resources/dubbo.properties
@@ -0,0 +1,2 @@
+dubbo.application.register-mode=interface
+dubbo.application.service-discovery.migration=FORCE_INTERFACE
\ No newline at end of file
diff --git a/dubbo-samples-kubernetes/dubbo-samples-kubernetes-apiserver/pom.xml b/dubbo-samples-kubernetes/dubbo-samples-kubernetes-apiserver/pom.xml
index 1e10a17..2a6264f 100644
--- a/dubbo-samples-kubernetes/dubbo-samples-kubernetes-apiserver/pom.xml
+++ b/dubbo-samples-kubernetes/dubbo-samples-kubernetes-apiserver/pom.xml
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.0-SNAPSHOT</dubbo.version>
+ <dubbo.version>3.0.0</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-kubernetes/dubbo-samples-kubernetes-dns/pom.xml b/dubbo-samples-kubernetes/dubbo-samples-kubernetes-dns/pom.xml
index 804d83d..41b658c 100644
--- a/dubbo-samples-kubernetes/dubbo-samples-kubernetes-dns/pom.xml
+++ b/dubbo-samples-kubernetes/dubbo-samples-kubernetes-dns/pom.xml
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.0-SNAPSHOT</dubbo.version>
+ <dubbo.version>3.0.0</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-multi-registry/pom.xml b/dubbo-samples-multi-registry/pom.xml
index 8141ee3..26ebfa4 100644
--- a/dubbo-samples-multi-registry/pom.xml
+++ b/dubbo-samples-multi-registry/pom.xml
@@ -29,7 +29,8 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>2.7.7</dubbo.version>
+ <dubbo.version>2.7.11</dubbo.version>
+<!-- <dubbo.version>3.0.1-SNAPSHOT</dubbo.version>-->
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-multi-registry/src/main/java/org/apache/dubbo/samples/multi/registry/MultiRegistryConsumer.java b/dubbo-samples-multi-registry/src/main/java/org/apache/dubbo/samples/multi/registry/MultiRegistryConsumer.java
index f34ea1d..89ae451 100644
--- a/dubbo-samples-multi-registry/src/main/java/org/apache/dubbo/samples/multi/registry/MultiRegistryConsumer.java
+++ b/dubbo-samples-multi-registry/src/main/java/org/apache/dubbo/samples/multi/registry/MultiRegistryConsumer.java
@@ -28,15 +28,26 @@
public class MultiRegistryConsumer {
public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/multi-registry-consumer.xml");
+// ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/multi-registry-consumer.xml");
+// context.start();
+//
+// DemoService demoServiceFormDefault = (DemoService) context.getBean("demoServiceFormDefault");
+// HelloService helloServiceFormShanghai = (HelloService) context.getBean("helloServiceFormShanghai");
+// HelloService helloServiceFormBeijing = (HelloService) context.getBean("helloServiceFormBeijing");
+//
+// System.out.println(demoServiceFormDefault.get("service form default registry"));
+// System.out.println(helloServiceFormShanghai.sayHello("service form shanghai registry"));
+// System.out.println(helloServiceFormBeijing.sayHello("service form beijing registry"));
+
+
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/multi-registry-consumer1.xml");
context.start();
- DemoService demoServiceFormDefault = (DemoService) context.getBean("demoServiceFormDefault");
- HelloService helloServiceFormShanghai = (HelloService) context.getBean("helloServiceFormShanghai");
- HelloService helloServiceFormBeijing = (HelloService) context.getBean("helloServiceFormBeijing");
-
- System.out.println(demoServiceFormDefault.get("service form default registry"));
- System.out.println(helloServiceFormShanghai.sayHello("service form shanghai registry"));
- System.out.println(helloServiceFormBeijing.sayHello("service form beijing registry"));
+ DemoService demoService = context.getBean(DemoService.class);
+ HelloService helloService = context.getBean(HelloService.class);
+ System.out.println(demoService.get("service form default registry"));
+ System.out.println(helloService.sayHello("service form shanghai registry"));
}
+
+
}
diff --git a/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer1.xml b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer1.xml
new file mode 100644
index 0000000..84b1f44
--- /dev/null
+++ b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer1.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
+
+ <dubbo:application name="multi-registry-consumer"/>
+
+ <dubbo:registry id="beijingRegistry" address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port.1:2181}" />
+ <dubbo:registry id="shanghaiRegistry" address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port.2:2182}" />
+
+ <dubbo:reference id="demoService" registry="beijingRegistry" interface="org.apache.dubbo.samples.multi.registry.api.DemoService"/>
+ <dubbo:reference id="helloService" registry="shanghaiRegistry" interface="org.apache.dubbo.samples.multi.registry.api.HelloService"/>
+
+</beans>
+
diff --git a/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer2.xml b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer2.xml
new file mode 100644
index 0000000..aa252ec
--- /dev/null
+++ b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer2.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
+
+ <dubbo:application name="multi-registry-consumer"/>
+
+ <dubbo:registry id="shanghaiRegistry" address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port.2:2182}" />
+
+ <dubbo:reference id="demoService" interface="org.apache.dubbo.samples.multi.registry.api.DemoService"/>
+ <dubbo:reference id="helloService" interface="org.apache.dubbo.samples.multi.registry.api.HelloService"/>
+
+</beans>
+
diff --git a/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer3.xml b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer3.xml
new file mode 100644
index 0000000..8119df2
--- /dev/null
+++ b/dubbo-samples-multi-registry/src/main/resources/spring/multi-registry-consumer3.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+ -->
+
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
+ xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder/>
+
+ <dubbo:application name="multi-registry-consumer"/>
+
+ <dubbo:registry id="beijingRegistry" address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port.1:2181}" />
+
+ <dubbo:reference id="demoService" interface="org.apache.dubbo.samples.multi.registry.api.DemoService"/>
+ <dubbo:reference id="helloService" interface="org.apache.dubbo.samples.multi.registry.api.HelloService"/>
+
+</beans>
+
diff --git a/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceIT.java b/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceIT.java
index cdbe0f4..ef587b5 100644
--- a/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceIT.java
+++ b/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceIT.java
@@ -1,87 +1,87 @@
-/*
- * 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.samples.multi.registry;
-
-import org.apache.dubbo.samples.multi.registry.api.DemoService;
-import org.apache.dubbo.samples.multi.registry.api.HelloService;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import java.util.List;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:/spring/multi-registry-consumer.xml"})
-public class MultiRegistryServiceIT {
- @Autowired
- @Qualifier("demoServiceFormDefault")
- private DemoService defaultDemoService;
-
- @Autowired
- @Qualifier("demoServiceFormBeijing")
- private DemoService beijingDemoService;
-
- @Autowired
- @Qualifier("helloServiceFormBeijing")
- private HelloService beijingHelloService;
-
- @Autowired
- @Qualifier("helloServiceFormShanghai")
- private HelloService shanghaiHelloService;
-
- @Test
- public void testDefaultDemoService() throws Exception {
- Assert.assertEquals("get: demo", defaultDemoService.get("demo"));
- }
-
- @Test
- public void testBeijingDemoService() throws Exception {
- Assert.assertEquals("get: beijing", beijingDemoService.get("beijing"));
- }
-
- @Test
- public void testBeijingHelloService() throws Exception {
- Assert.assertEquals("sayHello: beijing", beijingHelloService.sayHello("beijing"));
- }
-
- @Test
- public void testShanghaiHelloService() throws Exception {
- Assert.assertEquals("sayHello: shanghai", shanghaiHelloService.sayHello("shanghai"));
- }
-
- @Test
- public void verifyProvidersFromBeijingRegistry() throws Exception {
- List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2181);
- Assert.assertEquals(1, demoServiceProviders.size());
- List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2181);
- Assert.assertEquals(1, helloServiceProviders.size());
- }
-
- @Test
- public void verifyProvidersFromShanghaiRegistry() throws Exception {
- List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2182);
- Assert.assertEquals(1, demoServiceProviders.size());
- List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2182);
- Assert.assertEquals(1, helloServiceProviders.size());
- }
-}
+///*
+// * 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.samples.multi.registry;
+//
+//import org.apache.dubbo.samples.multi.registry.api.DemoService;
+//import org.apache.dubbo.samples.multi.registry.api.HelloService;
+//
+//import org.junit.Assert;
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Qualifier;
+//import org.springframework.test.context.ContextConfiguration;
+//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+//
+//import java.util.List;
+//
+//@RunWith(SpringJUnit4ClassRunner.class)
+//@ContextConfiguration(locations = {"classpath:/spring/multi-registry-consumer.xml"})
+//public class MultiRegistryServiceIT {
+// @Autowired
+// @Qualifier("demoServiceFormDefault")
+// private DemoService defaultDemoService;
+//
+// @Autowired
+// @Qualifier("demoServiceFormBeijing")
+// private DemoService beijingDemoService;
+//
+// @Autowired
+// @Qualifier("helloServiceFormBeijing")
+// private HelloService beijingHelloService;
+//
+// @Autowired
+// @Qualifier("helloServiceFormShanghai")
+// private HelloService shanghaiHelloService;
+//
+// @Test
+// public void testDefaultDemoService() throws Exception {
+// Assert.assertEquals("get: demo", defaultDemoService.get("demo"));
+// }
+//
+// @Test
+// public void testBeijingDemoService() throws Exception {
+// Assert.assertEquals("get: beijing", beijingDemoService.get("beijing"));
+// }
+//
+// @Test
+// public void testBeijingHelloService() throws Exception {
+// Assert.assertEquals("sayHello: beijing", beijingHelloService.sayHello("beijing"));
+// }
+//
+// @Test
+// public void testShanghaiHelloService() throws Exception {
+// Assert.assertEquals("sayHello: shanghai", shanghaiHelloService.sayHello("shanghai"));
+// }
+//
+// @Test
+// public void verifyProvidersFromBeijingRegistry() throws Exception {
+// List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2181);
+// Assert.assertEquals(1, demoServiceProviders.size());
+// List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2181);
+// Assert.assertEquals(1, helloServiceProviders.size());
+// }
+//
+// @Test
+// public void verifyProvidersFromShanghaiRegistry() throws Exception {
+// List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2182);
+// Assert.assertEquals(1, demoServiceProviders.size());
+// List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2182);
+// Assert.assertEquals(1, helloServiceProviders.size());
+// }
+//}
diff --git a/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceSplitIT.java b/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceSplitIT.java
new file mode 100644
index 0000000..184c807
--- /dev/null
+++ b/dubbo-samples-multi-registry/src/test/java/org/apache/dubbo/samples/multi/registry/MultiRegistryServiceSplitIT.java
@@ -0,0 +1,83 @@
+/*
+ * 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.samples.multi.registry;
+
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
+import org.apache.dubbo.samples.multi.registry.api.DemoService;
+import org.apache.dubbo.samples.multi.registry.api.HelloService;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.List;
+
+public class MultiRegistryServiceSplitIT {
+
+ @Before
+ public void setUp() {
+ try {
+ DubboBootstrap.reset();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testConsumer1() throws Exception {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring/multi-registry-consumer1.xml");
+ DemoService demoService = applicationContext.getBean(DemoService.class);
+ HelloService helloService = applicationContext.getBean(HelloService.class);
+ Assert.assertEquals("get: demo", demoService.get("demo"));
+ Assert.assertEquals("sayHello: beijing", helloService.sayHello("beijing"));
+ }
+
+ @Test
+ public void testConsumer2() throws Exception {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring/multi-registry-consumer2.xml");
+ DemoService demoService = applicationContext.getBean(DemoService.class);
+ HelloService helloService = applicationContext.getBean(HelloService.class);
+ Assert.assertEquals("get: demo", demoService.get("demo"));
+ Assert.assertEquals("sayHello: beijing", helloService.sayHello("beijing"));
+ }
+
+ @Test
+ public void testConsumer3() throws Exception {
+ ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/spring/multi-registry-consumer3.xml");
+ DemoService demoService = applicationContext.getBean(DemoService.class);
+ HelloService helloService = applicationContext.getBean(HelloService.class);
+ Assert.assertEquals("get: demo", demoService.get("demo"));
+ Assert.assertEquals("sayHello: beijing", helloService.sayHello("beijing"));
+ }
+
+ @Test
+ public void verifyProvidersFromBeijingRegistry() throws Exception {
+ List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2181);
+ Assert.assertEquals(1, demoServiceProviders.size());
+ List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2181);
+ Assert.assertEquals(1, helloServiceProviders.size());
+ }
+
+ @Test
+ public void verifyProvidersFromShanghaiRegistry() throws Exception {
+ List<String> demoServiceProviders = ZKTools.getProviders(DemoService.class, 2182);
+ Assert.assertEquals(1, demoServiceProviders.size());
+ List<String> helloServiceProviders = ZKTools.getProviders(HelloService.class, 2182);
+ Assert.assertEquals(1, helloServiceProviders.size());
+ }
+}
diff --git a/dubbo-samples-nacos/dubbo-samples-nacos-override/pom.xml b/dubbo-samples-nacos/dubbo-samples-nacos-override/pom.xml
index 9736e7f..80e43a1 100644
--- a/dubbo-samples-nacos/dubbo-samples-nacos-override/pom.xml
+++ b/dubbo-samples-nacos/dubbo-samples-nacos-override/pom.xml
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>2.7.7</dubbo.version>
+ <dubbo.version>2.7.11</dubbo.version>
<spring.version>4.3.16.RELEASE</spring.version>
<junit.version>4.12</junit.version>
<slf4j.version>1.7.25</slf4j.version>
diff --git a/dubbo-samples-nacos/dubbo-samples-nacos-override/src/test/java/org/apache/dubbo/samples/governance/DemoServiceIT.java b/dubbo-samples-nacos/dubbo-samples-nacos-override/src/test/java/org/apache/dubbo/samples/governance/DemoServiceIT.java
index c287968..17899df8c 100644
--- a/dubbo-samples-nacos/dubbo-samples-nacos-override/src/test/java/org/apache/dubbo/samples/governance/DemoServiceIT.java
+++ b/dubbo-samples-nacos/dubbo-samples-nacos-override/src/test/java/org/apache/dubbo/samples/governance/DemoServiceIT.java
@@ -17,6 +17,7 @@
package org.apache.dubbo.samples.governance;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.samples.governance.api.DemoService;
import org.apache.dubbo.samples.governance.util.NacosUtils;
@@ -29,7 +30,11 @@
@Before
public void beforeTest() {
- //DubboBootstrap.reset();
+ try {
+ DubboBootstrap.reset();
+ } catch (Throwable ignore) {
+ // since Dubbo 2.7.11
+ }
}
@Test(expected = RpcException.class)
diff --git a/dubbo-samples-protostuff/pom.xml b/dubbo-samples-protostuff/pom.xml
index 3951f6a..21604f1 100644
--- a/dubbo-samples-protostuff/pom.xml
+++ b/dubbo-samples-protostuff/pom.xml
@@ -61,7 +61,7 @@
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
- <version>2.7.5</version>
+ <version>${dubbo.version}</version>
</dependency>
<dependency>
diff --git a/dubbo-samples-rest/src/main/resources/spring/rest-consumer.xml b/dubbo-samples-rest/src/main/resources/spring/rest-consumer.xml
index 9e2446c..64ba826 100644
--- a/dubbo-samples-rest/src/main/resources/spring/rest-consumer.xml
+++ b/dubbo-samples-rest/src/main/resources/spring/rest-consumer.xml
@@ -27,7 +27,7 @@
<dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
<dubbo:reference id="anotherUserRestService"
- interface="org.apache.dubbo.samples.rest.api.facade.AnotherUserRestService"/>
+ interface="org.apache.dubbo.samples.rest.api.facade.AnotherUserRestService" protocol="rest"/>
<!-- directly connect to provider to simulate the access to non-dubbo rest services -->
<!--<dubbo:reference id="anotherUserRestService" interface="org.apache.dubbo.demo.user.facade.AnotherUserRestService" url="rest://localhost:8888/services/"/>-->
diff --git a/dubbo-samples-scala/src/test/scala/org/apache/dubbo/samples/scala/ScalaServicesIT.scala b/dubbo-samples-scala/src/test/scala/org/apache/dubbo/samples/scala/ScalaServicesIT.scala
index 37bf29f..09c9e7a 100644
--- a/dubbo-samples-scala/src/test/scala/org/apache/dubbo/samples/scala/ScalaServicesIT.scala
+++ b/dubbo-samples-scala/src/test/scala/org/apache/dubbo/samples/scala/ScalaServicesIT.scala
@@ -1,3 +1,22 @@
+/*
+ *
+ * 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.samples.scala
import org.apache.dubbo.samples.scala.consumer.{ConsumerConfiguration, StringServiceConsumer}
diff --git a/dubbo-samples-sentinel/src/main/java/org/apache/samples/sentinel/provider/ProviderConfiguration.java b/dubbo-samples-sentinel/src/main/java/org/apache/samples/sentinel/provider/ProviderConfiguration.java
index 6c87897..553c88a 100644
--- a/dubbo-samples-sentinel/src/main/java/org/apache/samples/sentinel/provider/ProviderConfiguration.java
+++ b/dubbo-samples-sentinel/src/main/java/org/apache/samples/sentinel/provider/ProviderConfiguration.java
@@ -20,9 +20,7 @@
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
-import org.apache.dubbo.config.spring.context.annotation.DubboComponentScan;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
-import org.apache.dubbo.config.spring.context.annotation.EnableDubboLifecycle;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
diff --git a/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
index 4cfc665..64a00f2 100644
--- a/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
+++ b/dubbo-samples-spi-compatible/src/main/java/org/apache/dubbo/samples/basic/spi/CompatibleServiceDiscovery.java
@@ -54,6 +54,11 @@
}
+ //For compatible, 3.0 service discovery need isDestroy to judgement.
+ public boolean isDestroy() {
+ return false;
+ }
+
@Override
public void unregister(ServiceInstance serviceInstance) throws RuntimeException {
diff --git a/dubbo-samples-triple/pom.xml b/dubbo-samples-triple/pom.xml
index 3b8cfd6..53ea7f4 100644
--- a/dubbo-samples-triple/pom.xml
+++ b/dubbo-samples-triple/pom.xml
@@ -31,7 +31,7 @@
<properties>
<source.level>1.8</source.level>
<target.level>1.8</target.level>
- <dubbo.version>3.0.0-SNAPSHOT</dubbo.version>
+ <dubbo.version>3.0.0</dubbo.version>
<junit.version>4.12</junit.version>
<spring-test.version>4.3.16.RELEASE</spring-test.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
diff --git a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
index 1f489cf..6d18ae8 100644
--- a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
+++ b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiConsumer.java
@@ -21,7 +21,7 @@
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
-
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.apache.dubbo.hello.HelloReply;
import org.apache.dubbo.hello.HelloRequest;
@@ -29,7 +29,7 @@
import java.util.concurrent.TimeUnit;
public class ApiConsumer {
- public static void main(String[] args) throws InterruptedException, IOException {
+ public static void main(String[] args) throws IOException {
ReferenceConfig<IGreeter> ref = new ReferenceConfig<>();
ref.setInterface(IGreeter.class);
ref.setCheck(false);
@@ -38,8 +38,13 @@
ref.setProtocol(CommonConstants.TRIPLE);
ref.setLazy(true);
ref.setTimeout(100000);
- ref.setApplication(new ApplicationConfig("demo-consumer"));
- ref.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+
+ DubboBootstrap bootstrap = DubboBootstrap.getInstance();
+ bootstrap.application(new ApplicationConfig("demo-consumer"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .reference(ref)
+ .start();
+
final IGreeter iGreeter = ref.get();
System.out.println("dubbo ref started");
diff --git a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
index e052dcb..df90b39 100644
--- a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
+++ b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiProvider.java
@@ -22,18 +22,21 @@
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
-import java.util.concurrent.CountDownLatch;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
public class ApiProvider {
- public static void main(String[] args) throws InterruptedException {
+ public static void main(String[] args) {
ServiceConfig<IGreeter> service = new ServiceConfig<>();
service.setInterface(IGreeter.class);
service.setRef(new IGreeter1Impl());
- service.setProtocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051));
- service.setApplication(new ApplicationConfig("demo-provider"));
- service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
- service.export();
- System.out.println("dubbo service started");
- new CountDownLatch(1).await();
+
+ DubboBootstrap bootstrap = DubboBootstrap.getInstance();
+ bootstrap.application(new ApplicationConfig("demo-provider"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .protocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051))
+ .service(service)
+ .start()
+ .await();
+
}
}
diff --git a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperConsumer.java b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperConsumer.java
index abdb343..ce40f92 100644
--- a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperConsumer.java
+++ b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperConsumer.java
@@ -20,6 +20,7 @@
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
public class ApiWrapperConsumer {
public static void main(String[] args) {
@@ -28,8 +29,13 @@
ref.setCheck(false);
ref.setProtocol("tri");
ref.setLazy(true);
- ref.setApplication(new ApplicationConfig("demo-consumer"));
- ref.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+
+ DubboBootstrap bootstrap = DubboBootstrap.getInstance();
+ bootstrap.application(new ApplicationConfig("demo-consumer"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .reference(ref)
+ .start();
+
final IGreeter2 iGreeter = ref.get();
System.out.println("dubbo ref started");
long st = System.currentTimeMillis();
diff --git a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperProvider.java b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperProvider.java
index e8176f6..ce979fb 100644
--- a/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperProvider.java
+++ b/dubbo-samples-triple/src/main/java/com/apache/dubbo/sample/basic/ApiWrapperProvider.java
@@ -22,19 +22,21 @@
import org.apache.dubbo.config.ProtocolConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
-
-import java.io.IOException;
+import org.apache.dubbo.config.bootstrap.DubboBootstrap;
public class ApiWrapperProvider {
- public static void main(String[] args) throws IOException {
+ public static void main(String[] args) {
ServiceConfig<IGreeter2> service = new ServiceConfig<>();
service.setInterface(IGreeter2.class);
service.setRef(new IGreeter2Impl());
- service.setProtocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051));
- service.setApplication(new ApplicationConfig("demo-provider"));
- service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
- service.export();
- System.out.println("dubbo service started");
- System.in.read();
+
+ DubboBootstrap bootstrap = DubboBootstrap.getInstance();
+ bootstrap.application(new ApplicationConfig("demo-provider"))
+ .registry(new RegistryConfig("zookeeper://127.0.0.1:2181"))
+ .protocol(new ProtocolConfig(CommonConstants.TRIPLE, 50051))
+ .service(service)
+ .start()
+ .await();
+
}
}
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 7cab7e2..b150f7c 100755
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -25,10 +25,10 @@
export DEBUG=$DEBUG
echo "DEBUG=$DEBUG"
-DUBBO_VERSION=${DUBBO_VERSION:-2.7.9-SNAPSHOT}
+DUBBO_VERSION=${DUBBO_VERSION:-2.7.12}
if [ "$CANDIDATE_VERSIONS" == "" ];then
CANDIDATE_VERSIONS="dubbo.version:$DUBBO_VERSION;spring.version:4.3.16.RELEASE;spring-boot.version:1.5.13.RELEASE,2.1.1.RELEASE"
-# CANDIDATE_VERSIONS="dubbo.version:2.7.9-SNAPSHOT;spring.version:4.3.16.RELEASE,5.3.3;spring-boot.version:1.5.13.RELEASE,2.1.1.RELEASE"
+# CANDIDATE_VERSIONS="dubbo.version:2.7.12;spring.version:4.3.16.RELEASE,5.3.3;spring-boot.version:1.5.13.RELEASE,2.1.1.RELEASE"
fi
export CANDIDATE_VERSIONS=$CANDIDATE_VERSIONS
echo "CANDIDATE_VERSIONS: ${CANDIDATE_VERSIONS[@]}"