You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2020/06/04 06:14:08 UTC

[servicecomb-java-chassis] branch master updated (9798ca8 -> 43b49b2)

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

liubao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git.


    from 9798ca8  [SCB-1979] load filter chains
     new d9673d3  [SCB-1978]add samples to use two different service centers
     new 662781b  [SCB-1978]modify and fix name image name error
     new 77f8f28  [SCB-1978]specify container name
     new a6714bc  [SCB-1978]upgrade docker maven plugin
     new 8b0c61a  [SCB-1978]upgrade docker maven plugin
     new 43b49b2  [SCB-1978]fix mixin plugin problem

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../demo-multi-service-center-client/pom.xml       | 225 +++++++++++++++++++++
 .../multiServiceCenterClient}/Application.java     |   7 +-
 .../multiServiceCenterClient}/IServerEndpoint.java |   4 +-
 .../multiServiceCenterClient/ServerATest.java}     |  15 +-
 .../ServerBServiceCenterConfiguration.java         |  61 ++++++
 .../multiServiceCenterClient/ServerBTest.java}     |  23 +--
 .../src/main/resources/application.yml             |  14 +-
 .../MultiServiceCenterIT.java}                     |   4 +-
 .../demo-multi-service-center-serverA}/pom.xml     |   8 +-
 .../multiServiceCenter/ServerApplication.java}     |   8 +-
 .../demo/multiServiceCenter}/ServerEndpoint.java   |   2 +-
 .../src/main/resources/application.yml             |   4 +-
 .../demo-multi-service-center-serverB}/pom.xml     |   8 +-
 .../ServerApplication.java}                        |   8 +-
 .../multiServiceCenterServerB}/ServerEndpoint.java |   2 +-
 .../src/main/resources/application.yml             |  10 +-
 .../pom.xml                                        |   9 +-
 .../servicecomb/demo/CategorizedTestCase.java      |  12 +-
 demo/pom.xml                                       |   2 +-
 .../foundation/common/utils/BeanUtils.java         |  11 +-
 pom.xml                                            |   2 +-
 .../servicecomb/serviceregistry/RegistryUtils.java |  15 +-
 .../config/ServiceRegistryConfig.java              |   2 +-
 23 files changed, 372 insertions(+), 84 deletions(-)
 create mode 100644 demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/main/java/org/apache/servicecomb/demo/registry => demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient}/Application.java (88%)
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/main/java/org/apache/servicecomb/demo/registry => demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient}/IServerEndpoint.java (90%)
 copy demo/{demo-multiple/b-client/src/main/java/org/apache/servicecomb/demo/multiple/b/client/BClient.java => demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerATest.java} (68%)
 create mode 100644 demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBServiceCenterConfiguration.java
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/main/java/org/apache/servicecomb/demo/registry/SchemaDiscoveryTestCase.java => demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBTest.java} (70%)
 copy demo/{demo-multi-registries/demo-multi-registries-client => demo-multi-service-center/demo-multi-service-center-client}/src/main/resources/application.yml (82%)
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java => demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java} (92%)
 copy demo/{demo-local-registry/demo-local-registry-server => demo-multi-service-center/demo-multi-service-center-serverA}/pom.xml (90%)
 copy demo/{demo-spring-boot-provider/demo-spring-boot-springmvc-server/src/main/java/org/apache/servicecomb/springboot/springmvc/server/SpringmvcServer.java => demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerApplication.java} (84%)
 copy demo/{demo-multi-registries/demo-multi-registries-server/src/main/java/org/apache/servicecomb/demo/registry => demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter}/ServerEndpoint.java (96%)
 copy demo/{demo-multi-registries/demo-multi-registries-server => demo-multi-service-center/demo-multi-service-center-serverA}/src/main/resources/application.yml (91%)
 copy demo/{demo-local-registry/demo-local-registry-server => demo-multi-service-center/demo-multi-service-center-serverB}/pom.xml (90%)
 copy demo/{demo-spring-boot-provider/demo-spring-boot-springmvc-server/src/main/java/org/apache/servicecomb/springboot/springmvc/server/SpringmvcServer.java => demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerApplication.java} (83%)
 copy demo/{demo-local-registry/demo-local-registry-server/src/main/java/org/apache/servicecomb/demo/localRegistryServer => demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB}/ServerEndpoint.java (96%)
 copy demo/{demo-multi-registries/demo-multi-registries-server => demo-multi-service-center/demo-multi-service-center-serverB}/src/main/resources/application.yml (87%)
 copy demo/{demo-spring-boot-transport => demo-multi-service-center}/pom.xml (86%)


[servicecomb-java-chassis] 06/06: [SCB-1978]fix mixin plugin problem

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 43b49b217f8b945c4489ca9863b8e69bfdcc337d
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 19:03:35 2020 +0800

    [SCB-1978]fix mixin plugin problem
---
 .../demo-multi-service-center-client/pom.xml       | 80 +++++++++++++---------
 1 file changed, 49 insertions(+), 31 deletions(-)

diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
index d6b89d2..cf2e23b 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
@@ -42,23 +42,6 @@
       <artifactId>demo-schema</artifactId>
     </dependency>
   </dependencies>
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>com.github.odavid.maven.plugins</groupId>
-        <artifactId>mixin-maven-plugin</artifactId>
-        <configuration>
-          <mixins>
-            <mixin>
-              <groupId>org.apache.servicecomb.demo</groupId>
-              <artifactId>docker-run-config</artifactId>
-              <version>${project.version}</version>
-            </mixin>
-          </mixins>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 
   <profiles>
     <profile>
@@ -76,9 +59,9 @@
                 <images>
                   <image>
                     <name>servicecomb/service-center</name>
-                    <alias>service-center-01</alias>
+                    <alias>service30100</alias>
                     <run>
-                      <containerNamePattern>%a</containerNamePattern>
+                      <namingStrategy>alias</namingStrategy>
                       <wait>
                         <log>server is ready</log>
                         <tcp>
@@ -95,9 +78,9 @@
                   </image>
                   <image>
                     <name>servicecomb/service-center</name>
-                    <alias>service-center-02</alias>
+                    <alias>service40100</alias>
                     <run>
-                      <containerNamePattern>%a</containerNamePattern>
+                      <namingStrategy>alias</namingStrategy>
                       <wait>
                         <log>server is ready</log>
                         <tcp>
@@ -116,15 +99,16 @@
                     <name>demo-multi-service-center-servera:${project.version}</name>
                     <alias>demo-multi-service-center-servera</alias>
                     <run>
+                      <namingStrategy>alias</namingStrategy>
                       <env>
                         <JAVA_OPTS>
-                          -Dservicecomb.service.registry.address=http://${service-center-01}:30100
+                          -Dservicecomb.service.registry.address=http://service30100:30100
                           -Dservicecomb.service.publishAddress=${docker.hostname}
                         </JAVA_OPTS>
                         <JAR_PATH>/maven/maven/demo-multi-service-center-servera-${project.version}.jar</JAR_PATH>
                       </env>
                       <links>
-                        <link>service-center-01:service-center-01</link>
+                        <link>service30100:service30100</link>
                       </links>
                       <wait>
                         <log>Register microservice instance success</log>
@@ -138,24 +122,22 @@
                       <ports>
                         <port>8080:8080</port>
                       </ports>
-                      <dependsOn>
-                        <container>service-center-01</container>
-                      </dependsOn>
                     </run>
                   </image>
                   <image>
                     <name>demo-multi-service-center-serverb:${project.version}</name>
                     <alias>demo-multi-service-center-serverb</alias>
                     <run>
+                      <namingStrategy>alias</namingStrategy>
                       <env>
                         <JAVA_OPTS>
-                          -Dservicecomb.service.registry.address=http://${service-center-02}:30100
+                          -Dservicecomb.service.registry.address=http://service40100:30100
                           -Dservicecomb.service.publishAddress=${docker.hostname}
                         </JAVA_OPTS>
                         <JAR_PATH>/maven/maven/demo-multi-service-center-serverb-${project.version}.jar</JAR_PATH>
                       </env>
                       <links>
-                        <link>service-center-02:service-center-02</link>
+                        <link>service40100:service40100</link>
                       </links>
                       <wait>
                         <log>Register microservice instance success</log>
@@ -169,9 +151,6 @@
                       <ports>
                         <port>8082:8082</port>
                       </ports>
-                      <dependsOn>
-                        <container>service-center-02</container>
-                      </dependsOn>
                     </run>
                   </image>
                 </images>
@@ -200,6 +179,45 @@
             <groupId>io.fabric8</groupId>
             <artifactId>docker-maven-plugin</artifactId>
           </plugin>
+          <plugin>
+            <groupId>org.codehaus.gmaven</groupId>
+            <artifactId>gmaven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>add-default-properties</id>
+                <phase>initialize</phase>
+                <goals>
+                  <goal>execute</goal>
+                </goals>
+                <configuration>
+                  <source>
+                    project.properties.setProperty('docker.hostname', 'localhost')
+                    log.info("Docker hostname is " + project.properties['docker.hostname'])
+                  </source>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <version>2.19.1</version>
+            <configuration>
+              <systemPropertyVariables>
+                <servicecomb.service.registry.address>http://${docker.hostname}:30100
+                </servicecomb.service.registry.address>
+              </systemPropertyVariables>
+              <argLine>${jacoco.failsafe.argLine}</argLine>
+            </configuration>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>integration-test</goal>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
         </plugins>
       </build>
     </profile>


[servicecomb-java-chassis] 03/06: [SCB-1978]specify container name

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 77f8f2847a05ad13737fee68e7460c1ee9ce77b5
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 15:31:03 2020 +0800

    [SCB-1978]specify container name
---
 .../demo-multi-service-center-client/pom.xml       |  2 +
 .../src/main/resources/logback.xml                 | 50 ----------------------
 .../src/main/resources/logback.xml                 | 50 ----------------------
 3 files changed, 2 insertions(+), 100 deletions(-)

diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
index ed2f75d..d6b89d2 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
@@ -78,6 +78,7 @@
                     <name>servicecomb/service-center</name>
                     <alias>service-center-01</alias>
                     <run>
+                      <containerNamePattern>%a</containerNamePattern>
                       <wait>
                         <log>server is ready</log>
                         <tcp>
@@ -96,6 +97,7 @@
                     <name>servicecomb/service-center</name>
                     <alias>service-center-02</alias>
                     <run>
+                      <containerNamePattern>%a</containerNamePattern>
                       <wait>
                         <log>server is ready</log>
                         <tcp>
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml
deleted file mode 100644
index 0d627f2..0000000
--- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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.
-  -->
-
-<configuration scan="true">
-  <appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
-    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
-    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
-      <Marker>SERVICECOMB_MARKER</Marker>
-      <OnMismatch>DENY</OnMismatch>
-      <OnMatch>ACCEPT</OnMatch>
-    </filter>
-
-    <encoder>
-      <pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
-    </encoder>
-  </appender>
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
-    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
-      <Marker>SERVICECOMB_MARKER</Marker>
-      <OnMismatch>ACCEPT</OnMismatch>
-      <OnMatch>DENY</OnMatch>
-    </filter>
-
-    <encoder>
-      <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="info">
-    <appender-ref ref="STDOUT"/>
-    <appender-ref ref="STDOUT-TRACING"/>
-  </root>
-</configuration>
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml
deleted file mode 100644
index 0d627f2..0000000
--- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?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.
-  -->
-
-<configuration scan="true">
-  <appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
-    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
-    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
-      <Marker>SERVICECOMB_MARKER</Marker>
-      <OnMismatch>DENY</OnMismatch>
-      <OnMatch>ACCEPT</OnMatch>
-    </filter>
-
-    <encoder>
-      <pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
-    </encoder>
-  </appender>
-
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
-    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
-      <Marker>SERVICECOMB_MARKER</Marker>
-      <OnMismatch>ACCEPT</OnMismatch>
-      <OnMatch>DENY</OnMatch>
-    </filter>
-
-    <encoder>
-      <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
-    </encoder>
-  </appender>
-
-  <root level="info">
-    <appender-ref ref="STDOUT"/>
-    <appender-ref ref="STDOUT-TRACING"/>
-  </root>
-</configuration>
\ No newline at end of file


[servicecomb-java-chassis] 05/06: [SCB-1978]upgrade docker maven plugin

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 8b0c61aac9291d7387d36f47870f5b90b8b1d13d
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 15:53:19 2020 +0800

    [SCB-1978]upgrade docker maven plugin
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 49f4dc7..06d455b 100755
--- a/pom.xml
+++ b/pom.xml
@@ -305,7 +305,7 @@
         <plugin>
           <groupId>io.fabric8</groupId>
           <artifactId>docker-maven-plugin</artifactId>
-          <version>1.2.0</version>
+          <version>0.33.0</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.gmaven</groupId>


[servicecomb-java-chassis] 02/06: [SCB-1978]modify and fix name image name error

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit 662781bf52bdb277c14759c087ff66ac910620f9
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 14:36:46 2020 +0800

    [SCB-1978]modify and fix name image name error
---
 .../demo-multi-service-center-client/pom.xml               | 14 +++++++-------
 .../demo-multi-service-center-serverA/pom.xml              |  4 ++--
 .../demo-multi-service-center-serverB/pom.xml              |  4 ++--
 demo/demo-multi-service-center/pom.xml                     |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
index 65bb675..ed2f75d 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
@@ -21,7 +21,7 @@
   xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
   <artifactId>demo-multi-service-center-client</artifactId>
-  <name>Java Chassis::Demo::Multi Service Center Client</name>
+  <name>Java Chassis::Demo::Multi Service Centers::Client</name>
   <parent>
     <groupId>org.apache.servicecomb.demo</groupId>
     <artifactId>demo-multi-service-center</artifactId>
@@ -111,15 +111,15 @@
                     </run>
                   </image>
                   <image>
-                    <name>demo-multi-service-center-serverA:${project.version}</name>
-                    <alias>demo-multi-service-center-serverA</alias>
+                    <name>demo-multi-service-center-servera:${project.version}</name>
+                    <alias>demo-multi-service-center-servera</alias>
                     <run>
                       <env>
                         <JAVA_OPTS>
                           -Dservicecomb.service.registry.address=http://${service-center-01}:30100
                           -Dservicecomb.service.publishAddress=${docker.hostname}
                         </JAVA_OPTS>
-                        <JAR_PATH>/maven/maven/demo-multi-service-center-serverA-${project.version}.jar</JAR_PATH>
+                        <JAR_PATH>/maven/maven/demo-multi-service-center-servera-${project.version}.jar</JAR_PATH>
                       </env>
                       <links>
                         <link>service-center-01:service-center-01</link>
@@ -142,15 +142,15 @@
                     </run>
                   </image>
                   <image>
-                    <name>demo-multi-service-center-serverB:${project.version}</name>
-                    <alias>demo-multi-service-center-serverB</alias>
+                    <name>demo-multi-service-center-serverb:${project.version}</name>
+                    <alias>demo-multi-service-center-serverb</alias>
                     <run>
                       <env>
                         <JAVA_OPTS>
                           -Dservicecomb.service.registry.address=http://${service-center-02}:30100
                           -Dservicecomb.service.publishAddress=${docker.hostname}
                         </JAVA_OPTS>
-                        <JAR_PATH>/maven/maven/demo-multi-service-center-serverB-${project.version}.jar</JAR_PATH>
+                        <JAR_PATH>/maven/maven/demo-multi-service-center-serverb-${project.version}.jar</JAR_PATH>
                       </env>
                       <links>
                         <link>service-center-02:service-center-02</link>
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml
index 7e11ce2..8ed68c8 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml
@@ -20,8 +20,8 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
   xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>demo-multi-service-center-serverA</artifactId>
-  <name>Java Chassis::Demo::Multi Registries Server</name>
+  <artifactId>demo-multi-service-center-servera</artifactId>
+  <name>Java Chassis::Demo::Multi Service Centers::ServerA</name>
   <parent>
     <groupId>org.apache.servicecomb.demo</groupId>
     <artifactId>demo-multi-service-center</artifactId>
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml
index c933b1f..f8ebecc 100644
--- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml
@@ -20,8 +20,8 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
   xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
-  <artifactId>demo-multi-service-center-serverB</artifactId>
-  <name>Java Chassis::Demo::Multi Service Center ServerB</name>
+  <artifactId>demo-multi-service-center-serverb</artifactId>
+  <name>Java Chassis::Demo::Multi Service Centers::ServerB</name>
   <parent>
     <groupId>org.apache.servicecomb.demo</groupId>
     <artifactId>demo-multi-service-center</artifactId>
diff --git a/demo/demo-multi-service-center/pom.xml b/demo/demo-multi-service-center/pom.xml
index 9ca8ace..40e7242 100644
--- a/demo/demo-multi-service-center/pom.xml
+++ b/demo/demo-multi-service-center/pom.xml
@@ -25,7 +25,7 @@
     <version>2.1.0-SNAPSHOT</version>
   </parent>
   <artifactId>demo-multi-service-center</artifactId>
-  <name>Java Chassis::Demo::Multi Registry</name>
+  <name>Java Chassis::Demo::Multi Service Centers</name>
   <packaging>pom</packaging>
   <modules>
     <module>demo-multi-service-center-serverA</module>


[servicecomb-java-chassis] 01/06: [SCB-1978]add samples to use two different service centers

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit d9673d342d06ce06f21034eea393e69ffc9be224
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 11:52:04 2020 +0800

    [SCB-1978]add samples to use two different service centers
---
 .../demo-multi-service-center-client/pom.xml       | 205 +++++++++++++++++++++
 .../demo/multiServiceCenterClient/Application.java |  48 +++++
 .../multiServiceCenterClient/IServerEndpoint.java} |  23 +--
 .../multiServiceCenterClient/ServerATest.java}     |  29 ++-
 .../ServerBServiceCenterConfiguration.java         |  61 ++++++
 .../multiServiceCenterClient/ServerBTest.java}     |  34 ++--
 .../src/main/resources/application.yml             |  38 ++++
 .../MultiServiceCenterIT.java}                     |  32 ++--
 .../demo-multi-service-center-serverA/pom.xml      |  88 +++++++++
 .../multiServiceCenter/ServerApplication.java}     |  29 ++-
 .../demo/multiServiceCenter/ServerEndpoint.java    |  42 +++++
 .../src/main/resources/application.yml             |  32 ++++
 .../src/main/resources/logback.xml                 |  50 +++++
 .../demo-multi-service-center-serverB/pom.xml      |  88 +++++++++
 .../ServerApplication.java}                        |  29 ++-
 .../multiServiceCenterServerB/ServerEndpoint.java  |  42 +++++
 .../src/main/resources/application.yml             |  32 ++++
 .../src/main/resources/logback.xml                 |  50 +++++
 demo/demo-multi-service-center/pom.xml             |  51 +++++
 .../servicecomb/demo/CategorizedTestCase.java      |  12 +-
 demo/pom.xml                                       |   2 +-
 .../foundation/common/utils/BeanUtils.java         |  11 +-
 .../servicecomb/serviceregistry/RegistryUtils.java |  15 +-
 .../config/ServiceRegistryConfig.java              |   2 +-
 24 files changed, 921 insertions(+), 124 deletions(-)

diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
new file mode 100644
index 0000000..65bb675
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>demo-multi-service-center-client</artifactId>
+  <name>Java Chassis::Demo::Multi Service Center Client</name>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-multi-service-center</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+
+  <properties>
+    <demo.main>org.apache.servicecomb.demo.multiServiceCenterClient.Application</demo.main>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb.demo</groupId>
+      <artifactId>demo-schema</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>com.github.odavid.maven.plugins</groupId>
+        <artifactId>mixin-maven-plugin</artifactId>
+        <configuration>
+          <mixins>
+            <mixin>
+              <groupId>org.apache.servicecomb.demo</groupId>
+              <artifactId>docker-run-config</artifactId>
+              <version>${project.version}</version>
+            </mixin>
+          </mixins>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <properties>
+        <demo.service.name>demo-multi-registries-server</demo.service.name>
+      </properties>
+      <build>
+        <pluginManagement>
+          <plugins>
+            <plugin>
+              <groupId>io.fabric8</groupId>
+              <artifactId>docker-maven-plugin</artifactId>
+              <configuration>
+                <images>
+                  <image>
+                    <name>servicecomb/service-center</name>
+                    <alias>service-center-01</alias>
+                    <run>
+                      <wait>
+                        <log>server is ready</log>
+                        <tcp>
+                          <ports>
+                            <port>30100</port>
+                          </ports>
+                        </tcp>
+                        <time>60000</time>
+                      </wait>
+                      <ports>
+                        <port>30100:30100</port>
+                      </ports>
+                    </run>
+                  </image>
+                  <image>
+                    <name>servicecomb/service-center</name>
+                    <alias>service-center-02</alias>
+                    <run>
+                      <wait>
+                        <log>server is ready</log>
+                        <tcp>
+                          <ports>
+                            <port>30100</port>
+                          </ports>
+                        </tcp>
+                        <time>60000</time>
+                      </wait>
+                      <ports>
+                        <port>40100:30100</port>
+                      </ports>
+                    </run>
+                  </image>
+                  <image>
+                    <name>demo-multi-service-center-serverA:${project.version}</name>
+                    <alias>demo-multi-service-center-serverA</alias>
+                    <run>
+                      <env>
+                        <JAVA_OPTS>
+                          -Dservicecomb.service.registry.address=http://${service-center-01}:30100
+                          -Dservicecomb.service.publishAddress=${docker.hostname}
+                        </JAVA_OPTS>
+                        <JAR_PATH>/maven/maven/demo-multi-service-center-serverA-${project.version}.jar</JAR_PATH>
+                      </env>
+                      <links>
+                        <link>service-center-01:service-center-01</link>
+                      </links>
+                      <wait>
+                        <log>Register microservice instance success</log>
+                        <tcp>
+                          <ports>
+                            <port>8080</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>8080:8080</port>
+                      </ports>
+                      <dependsOn>
+                        <container>service-center-01</container>
+                      </dependsOn>
+                    </run>
+                  </image>
+                  <image>
+                    <name>demo-multi-service-center-serverB:${project.version}</name>
+                    <alias>demo-multi-service-center-serverB</alias>
+                    <run>
+                      <env>
+                        <JAVA_OPTS>
+                          -Dservicecomb.service.registry.address=http://${service-center-02}:30100
+                          -Dservicecomb.service.publishAddress=${docker.hostname}
+                        </JAVA_OPTS>
+                        <JAR_PATH>/maven/maven/demo-multi-service-center-serverB-${project.version}.jar</JAR_PATH>
+                      </env>
+                      <links>
+                        <link>service-center-02:service-center-02</link>
+                      </links>
+                      <wait>
+                        <log>Register microservice instance success</log>
+                        <tcp>
+                          <ports>
+                            <port>8082</port>
+                          </ports>
+                        </tcp>
+                        <time>120000</time>
+                      </wait>
+                      <ports>
+                        <port>8082:8082</port>
+                      </ports>
+                      <dependsOn>
+                        <container>service-center-02</container>
+                      </dependsOn>
+                    </run>
+                  </image>
+                </images>
+              </configuration>
+              <executions>
+                <execution>
+                  <id>start</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                    <goal>start</goal>
+                  </goals>
+                </execution>
+                <execution>
+                  <id>stop</id>
+                  <phase>post-integration-test</phase>
+                  <goals>
+                    <goal>stop</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+          </plugins>
+        </pluginManagement>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/Application.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/Application.java
new file mode 100644
index 0000000..e0d7d65
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/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.servicecomb.demo.multiServiceCenterClient;
+
+import org.apache.servicecomb.demo.CategorizedTestCaseRunner;
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.stereotype.Component;
+
+@SpringBootApplication
+@EnableServiceComb
+@Component
+public class Application {
+
+  public static void main(final String[] args) throws Exception {
+    new SpringApplicationBuilder().sources(Application.class)
+        .web(WebApplicationType.SERVLET).build().run(args);
+
+    runTest();
+  }
+
+  public static void runTest() throws Exception {
+    CategorizedTestCaseRunner.runCategorizedTestCase("demo-multi-service-center-serverA");
+
+    TestMgr.summary();
+    if (!TestMgr.errors().isEmpty()) {
+      throw new IllegalStateException("tests failed");
+    }
+  }
+}
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/IServerEndpoint.java
similarity index 62%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/IServerEndpoint.java
index dd144ed..9d10324 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/IServerEndpoint.java
@@ -15,25 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenterClient;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
-
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
-
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
-
-  default String getMicroserviceName() {
-    return null;
-  }
+public interface IServerEndpoint {
+  String getName(String name);
 }
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerATest.java
similarity index 57%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerATest.java
index dd144ed..9ddd4d8 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerATest.java
@@ -15,25 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenterClient;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
+import org.apache.servicecomb.demo.CategorizedTestCase;
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
 
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
+@Component
+public class ServerATest implements CategorizedTestCase {
+  @RpcReference(microserviceName = "demo-multi-service-center-serverA", schemaId = "ServerEndpoint")
+  private IServerEndpoint serverEndpoint;
 
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
-
-  default String getMicroserviceName() {
-    return null;
+  @Override
+  public void testRestTransport() throws Exception {
+    TestMgr.check("hello", serverEndpoint.getName("hello"));
   }
 }
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBServiceCenterConfiguration.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBServiceCenterConfiguration.java
new file mode 100644
index 0000000..8e73d3c
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBServiceCenterConfiguration.java
@@ -0,0 +1,61 @@
+/*
+ * 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.servicecomb.demo.multiServiceCenterClient;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.servicecomb.foundation.common.net.IpPort;
+import org.apache.servicecomb.foundation.common.net.NetUtils;
+import org.apache.servicecomb.serviceregistry.config.ServiceRegistryConfig;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.netflix.config.DynamicPropertyFactory;
+
+@Configuration
+public class ServerBServiceCenterConfiguration {
+  @Bean("serverBServiceCenterConfig")
+  public ServiceRegistryConfig serverBServiceCenterConfig() {
+    ServiceRegistryConfig config = ServiceRegistryConfig.buildFromConfiguration();
+    String address = DynamicPropertyFactory.getInstance()
+        .getStringProperty("servicecomb.service.registry-serverB.address", null)
+        .get();
+    if (address == null) {
+      throw new IllegalStateException("service center address is required.");
+    }
+    String[] urls = address.split(",");
+    List<String> uriList = Arrays.asList(urls);
+    ArrayList<IpPort> ipPortList = new ArrayList<>();
+    uriList.forEach(anUriList -> {
+      try {
+        URI uri = new URI(anUriList.trim());
+        if ("https".equals(uri.getScheme())) {
+          config.setSsl(true);
+        }
+        ipPortList.add(NetUtils.parseIpPort(uri));
+      } catch (Exception e) {
+        throw new IllegalStateException("service center address is required.", e);
+      }
+    });
+    config.setIpPort(ipPortList);
+    return config;
+  }
+}
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBTest.java
similarity index 53%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBTest.java
index dd144ed..4aa9dc2 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/ServerBTest.java
@@ -15,25 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenterClient;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
+import org.apache.servicecomb.demo.CategorizedTestCase;
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
 
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
+@Component
+public class ServerBTest implements CategorizedTestCase {
+  @RpcReference(microserviceName = "demo-multi-service-center-serverB", schemaId = "ServerEndpoint")
+  private IServerEndpoint serverEndpoint;
 
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
+  @Override
+  public void testRestTransport() throws Exception {
+    TestMgr.check("hello", serverEndpoint.getName("hello"));
+  }
 
-  default String getMicroserviceName() {
-    return null;
+  @Override
+  public String getMicroserviceName() {
+    return "demo-multi-service-center-serverB";
   }
-}
+}
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/resources/application.yml b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/resources/application.yml
new file mode 100644
index 0000000..ebba6a0
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/resources/application.yml
@@ -0,0 +1,38 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+server:
+  port: 8084
+
+# java-chassis configurations
+APPLICATION_ID: demo-multi-service-center
+service_description:
+  name: demo-multi-service-center-client
+  version: 0.0.2
+servicecomb:
+  service:
+    registry:
+      address: http://127.0.0.1:30100
+    registry-serverB:
+      address: http://127.0.0.1:40100
+  rest:
+    address: 0.0.0.0:8084
+
+  handler:
+    chain:
+      Consumer:
+        default: loadbalance
\ No newline at end of file
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
similarity index 61%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
index dd144ed..e1c9e8e 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/test/java/org/apache/servicecomb/demo/multiServiceCenterClient/MultiServiceCenterIT.java
@@ -15,25 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenterClient;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
 
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
+import org.apache.servicecomb.demo.TestMgr;
+import org.junit.Before;
+import org.junit.Test;
 
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
+public class MultiServiceCenterIT {
+  @Before
+  public void setUp() throws Exception {
+    TestMgr.errors().clear();
+  }
+
+  @Test
+  public void clientGetsNoError() throws Exception {
+    Application.main(new String[0]);
 
-  default String getMicroserviceName() {
-    return null;
+    assertThat(TestMgr.errors().isEmpty(), is(true));
   }
 }
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml
new file mode 100644
index 0000000..7e11ce2
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>demo-multi-service-center-serverA</artifactId>
+  <name>Java Chassis::Demo::Multi Registries Server</name>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-multi-service-center</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+
+  <properties>
+    <demo.main>org.apache.servicecomb.demo.multiServiceCenter.ServerApplication</demo.main>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb.demo</groupId>
+      <artifactId>demo-schema</artifactId>
+    </dependency>
+
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>com.github.odavid.maven.plugins</groupId>
+        <artifactId>mixin-maven-plugin</artifactId>
+        <configuration>
+          <mixins>
+            <mixin>
+              <groupId>org.apache.servicecomb.demo</groupId>
+              <artifactId>docker-build-config</artifactId>
+              <version>${project.version}</version>
+            </mixin>
+          </mixins>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.commonjava.maven.plugins</groupId>
+            <artifactId>directory-maven-plugin</artifactId>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerApplication.java
similarity index 58%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerApplication.java
index dd144ed..ad905c9 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerApplication.java
@@ -15,25 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenter;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
 
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
-
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
-
-  default String getMicroserviceName() {
-    return null;
+@SpringBootApplication
+@EnableServiceComb
+public class ServerApplication {
+  public static void main(final String[] args) throws Exception {
+    new SpringApplicationBuilder().sources(ServerApplication.class)
+        .web(WebApplicationType.SERVLET).build().run(args);
   }
 }
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerEndpoint.java b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerEndpoint.java
new file mode 100644
index 0000000..2e6efa6
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/java/org/apache/servicecomb/demo/multiServiceCenter/ServerEndpoint.java
@@ -0,0 +1,42 @@
+/*
+ * 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.servicecomb.demo.multiServiceCenter;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "ServerEndpoint")
+@RequestMapping(path = "/register/url/prefix", produces = MediaType.APPLICATION_JSON)
+public class ServerEndpoint {
+  private static final Logger LOGGER
+      = LoggerFactory.getLogger(ServerEndpoint.class);
+
+  @GetMapping(path = "/getName")
+  public String getName(@RequestParam(name = "name") String name) {
+    ((Invocation) ContextUtils.getInvocationContext()).getTraceIdLogger().info(LOGGER, "get name invoked.");
+    return name;
+  }
+}
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/application.yml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/application.yml
new file mode 100644
index 0000000..0ff9269
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/application.yml
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+server:
+  port: 8080
+
+# java-chassis configurations
+
+APPLICATION_ID: demo-multi-service-center
+service_description:
+  name: demo-multi-service-center-serverA
+  version: 0.0.2
+servicecomb:
+  service:
+    registry:
+      address: http://127.0.0.1:30100
+  rest:
+    address: 0.0.0.0:8080
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml
new file mode 100644
index 0000000..0d627f2
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/src/main/resources/logback.xml
@@ -0,0 +1,50 @@
+<?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.
+  -->
+
+<configuration scan="true">
+  <appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>DENY</OnMismatch>
+      <OnMatch>ACCEPT</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>ACCEPT</OnMismatch>
+      <OnMatch>DENY</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT"/>
+    <appender-ref ref="STDOUT-TRACING"/>
+  </root>
+</configuration>
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml
new file mode 100644
index 0000000..c933b1f
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>demo-multi-service-center-serverB</artifactId>
+  <name>Java Chassis::Demo::Multi Service Center ServerB</name>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-multi-service-center</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+
+  <properties>
+    <demo.main>org.apache.servicecomb.demo.multiServiceCenterServerB.ServerApplication</demo.main>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb.demo</groupId>
+      <artifactId>demo-schema</artifactId>
+    </dependency>
+
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>com.github.odavid.maven.plugins</groupId>
+        <artifactId>mixin-maven-plugin</artifactId>
+        <configuration>
+          <mixins>
+            <mixin>
+              <groupId>org.apache.servicecomb.demo</groupId>
+              <artifactId>docker-build-config</artifactId>
+              <version>${project.version}</version>
+            </mixin>
+          </mixins>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+          <plugin>
+            <groupId>org.commonjava.maven.plugins</groupId>
+            <artifactId>directory-maven-plugin</artifactId>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerApplication.java
similarity index 57%
copy from demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
copy to demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerApplication.java
index dd144ed..531e8ff 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerApplication.java
@@ -15,25 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.servicecomb.demo;
+package org.apache.servicecomb.demo.multiServiceCenterServerB;
 
-public interface CategorizedTestCase {
-  /**
-   * test case which only successful in REST transport
-   */
-  void testRestTransport() throws Exception;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
 
-  /**
-   * test case which only successful in HIGHWAY transport
-   */
-  void testHighwayTransport() throws Exception;
-
-  /**
-   * test case which successful in both REST and HIGHWAY transport
-   */
-  void testAllTransport() throws Exception;
-
-  default String getMicroserviceName() {
-    return null;
+@SpringBootApplication
+@EnableServiceComb
+public class ServerApplication {
+  public static void main(final String[] args) throws Exception {
+    new SpringApplicationBuilder().sources(ServerApplication.class)
+        .web(WebApplicationType.SERVLET).build().run(args);
   }
 }
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerEndpoint.java b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerEndpoint.java
new file mode 100644
index 0000000..af822e8
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/java/org/apache/servicecomb/demo/multiServiceCenterServerB/ServerEndpoint.java
@@ -0,0 +1,42 @@
+/*
+ * 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.servicecomb.demo.multiServiceCenterServerB;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.swagger.invocation.context.ContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@RestSchema(schemaId = "ServerEndpoint")
+@RequestMapping(path = "/register/url/prefix", produces = MediaType.APPLICATION_JSON)
+public class ServerEndpoint {
+  private static final Logger LOGGER
+      = LoggerFactory.getLogger(ServerEndpoint.class);
+
+  @GetMapping(path = "/getName")
+  public String getName(@RequestParam(name = "name") String name) {
+    ((Invocation) ContextUtils.getInvocationContext()).getTraceIdLogger().info(LOGGER, "get name invoked.");
+    return name;
+  }
+}
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/application.yml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/application.yml
new file mode 100644
index 0000000..834ca56
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/application.yml
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+server:
+  port: 8082
+
+# java-chassis configurations
+
+APPLICATION_ID: demo-multi-service-center
+service_description:
+  name: demo-multi-service-center-serverB
+  version: 0.0.2
+servicecomb:
+  service:
+    registry:
+      address: http://127.0.0.1:40100
+  rest:
+    address: 0.0.0.0:8082
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml
new file mode 100644
index 0000000..0d627f2
--- /dev/null
+++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/src/main/resources/logback.xml
@@ -0,0 +1,50 @@
+<?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.
+  -->
+
+<configuration scan="true">
+  <appender name="STDOUT-TRACING" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>DENY</OnMismatch>
+      <OnMatch>ACCEPT</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread][%X{SERVICECOMB_TRACE_ID}] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <!-- If applicable, can use ch.qos.logback.classic.filter.MarkerFilter -->
+    <filter class="org.apache.servicecomb.foundation.logback.MarkerFilter">
+      <Marker>SERVICECOMB_MARKER</Marker>
+      <OnMismatch>ACCEPT</OnMismatch>
+      <OnMatch>DENY</OnMatch>
+    </filter>
+
+    <encoder>
+      <pattern>%d [%level] [%thread] - %msg (%F:%L\)%n</pattern>
+    </encoder>
+  </appender>
+
+  <root level="info">
+    <appender-ref ref="STDOUT"/>
+    <appender-ref ref="STDOUT-TRACING"/>
+  </root>
+</configuration>
\ No newline at end of file
diff --git a/demo/demo-multi-service-center/pom.xml b/demo/demo-multi-service-center/pom.xml
new file mode 100644
index 0000000..9ca8ace
--- /dev/null
+++ b/demo/demo-multi-service-center/pom.xml
@@ -0,0 +1,51 @@
+<?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">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-parent</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>demo-multi-service-center</artifactId>
+  <name>Java Chassis::Demo::Multi Registry</name>
+  <packaging>pom</packaging>
+  <modules>
+    <module>demo-multi-service-center-serverA</module>
+    <module>demo-multi-service-center-serverB</module>
+    <module>demo-multi-service-center-client</module>
+  </modules>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>java-chassis-spring-boot-starter-servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-service-center</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-test-scaffolding</artifactId>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java b/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
index dd144ed..c526787 100644
--- a/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
+++ b/demo/demo-schema/src/main/java/org/apache/servicecomb/demo/CategorizedTestCase.java
@@ -21,17 +21,23 @@ public interface CategorizedTestCase {
   /**
    * test case which only successful in REST transport
    */
-  void testRestTransport() throws Exception;
+  default void testRestTransport() throws Exception {
+
+  }
 
   /**
    * test case which only successful in HIGHWAY transport
    */
-  void testHighwayTransport() throws Exception;
+  default void testHighwayTransport() throws Exception {
+
+  }
 
   /**
    * test case which successful in both REST and HIGHWAY transport
    */
-  void testAllTransport() throws Exception;
+  default void testAllTransport() throws Exception {
+
+  }
 
   default String getMicroserviceName() {
     return null;
diff --git a/demo/pom.xml b/demo/pom.xml
index c0d40fc..d5bffc6 100644
--- a/demo/pom.xml
+++ b/demo/pom.xml
@@ -46,8 +46,8 @@
     <module>demo-spring-boot-provider</module>
     <module>demo-spring-boot-transport</module>
     <module>demo-edge</module>
-
     <module>demo-multiple</module>
+    <module>demo-multi-service-center</module>
     <module>demo-signature</module>
     <module>perf</module>
   </modules>
diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/BeanUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/BeanUtils.java
index f5d3957..0a45452 100644
--- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/BeanUtils.java
+++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/BeanUtils.java
@@ -18,7 +18,9 @@
 package org.apache.servicecomb.foundation.common.utils;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.LinkedHashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang3.StringUtils;
@@ -131,6 +133,14 @@ public final class BeanUtils {
     return (T) context.getBean(name);
   }
 
+  public static <T> Map<String, T> getBeansOfType(Class<T> type) {
+    if (context == null) {
+      // for some test case
+      return Collections.emptyMap();
+    }
+    return context.getBeansOfType(type);
+  }
+
   /**
    * Get the implemented class of the given instance
    * @param bean the instance to get implemented class from
@@ -140,5 +150,4 @@ public final class BeanUtils {
   public static Class<?> getImplClassFromBean(Object bean) {
     return AopProxyUtils.ultimateTargetClass(bean);
   }
-
 }
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/RegistryUtils.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/RegistryUtils.java
index 5112e17..4a04459 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/RegistryUtils.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/RegistryUtils.java
@@ -31,6 +31,7 @@ import org.apache.servicecomb.config.ConfigUtil;
 import org.apache.servicecomb.config.archaius.sources.MicroserviceConfigLoader;
 import org.apache.servicecomb.foundation.common.Holder;
 import org.apache.servicecomb.foundation.common.event.EventManager;
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
 import org.apache.servicecomb.registry.DiscoveryManager;
 import org.apache.servicecomb.registry.api.event.MicroserviceInstanceRegisteredEvent;
 import org.apache.servicecomb.registry.api.registry.FindInstancesResponse;
@@ -62,8 +63,6 @@ public final class RegistryUtils {
    */
   private static volatile ServiceRegistry serviceRegistry;
 
-  private static final Map<String, ServiceRegistryConfig> EXTRA_SERVICE_REGISTRY_CONFIGS = new LinkedHashMap<>();
-
   private static final Map<String, ServiceRegistry> EXTRA_SERVICE_REGISTRIES = new LinkedHashMap<>();
 
   private static AggregateServiceRegistryCache aggregateServiceRegistryCache;
@@ -103,7 +102,8 @@ public final class RegistryUtils {
   }
 
   private static void initializeServiceRegistries(MicroserviceDefinition microserviceDefinition) {
-    EXTRA_SERVICE_REGISTRY_CONFIGS.forEach((k, v) -> {
+    Map<String, ServiceRegistryConfig> configs = BeanUtils.getBeansOfType(ServiceRegistryConfig.class);
+    configs.forEach((k, v) -> {
       ServiceRegistry serviceRegistry = ServiceRegistryFactory.create(v, microserviceDefinition);
       addExtraServiceRegistry(serviceRegistry);
     });
@@ -254,15 +254,6 @@ public final class RegistryUtils {
   }
 
   /**
-   * Add the configuration object of {@link ServiceRegistry}.
-   * The corresponding {@link ServiceRegistry} instances are instantiated later in {@link #init()}
-   */
-  public static void addExtraServiceRegistryConfig(ServiceRegistryConfig serviceRegistryConfig) {
-    validateRegistryConfig(serviceRegistryConfig);
-    EXTRA_SERVICE_REGISTRY_CONFIGS.put(serviceRegistryConfig.getRegistryName(), serviceRegistryConfig);
-  }
-
-  /**
    * @throws NullPointerException serviceRegistryConfig is null
    * @throws IllegalArgumentException config value is illegal
    */
diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
index 407d712..bfc1009 100644
--- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
+++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/serviceregistry/config/ServiceRegistryConfig.java
@@ -29,7 +29,7 @@ import org.apache.servicecomb.serviceregistry.client.http.ServiceRegistryClientI
 
 import io.vertx.core.http.HttpVersion;
 
-public final class ServiceRegistryConfig {
+public class ServiceRegistryConfig {
   public static final ServiceRegistryConfig INSTANCE = buildFromConfiguration();
 
   public static final int DEFAULT_TIMEOUT_IN_MS = 30000;


[servicecomb-java-chassis] 04/06: [SCB-1978]upgrade docker maven plugin

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git

commit a6714bc599bba0ca1a53eb96560ffe0e3c03db40
Author: liubao <bi...@qq.com>
AuthorDate: Wed Jun 3 15:41:12 2020 +0800

    [SCB-1978]upgrade docker maven plugin
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7405ed9..49f4dc7 100755
--- a/pom.xml
+++ b/pom.xml
@@ -305,7 +305,7 @@
         <plugin>
           <groupId>io.fabric8</groupId>
           <artifactId>docker-maven-plugin</artifactId>
-          <version>0.20.0</version>
+          <version>1.2.0</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.gmaven</groupId>