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/08 01:15:13 UTC

[servicecomb-java-chassis] branch master updated (61a51d9 -> 7a77062)

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 61a51d9  [SCB-1990] allow disable metrics endpoints by configuration
     new e75fa96  [SCB-1988] Remove dependency on registry-service-center moudle for registry-zero-config
     new 4f13859  [SCB-1989] Set up modules for demo zeroconfig&schemadiscovery registries
     new 7a77062  [SCB-1989] Add testing code for demo zeroconfig&schemadiscovery registries

The 3 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:
 .../pom.xml                                        |  12 +-
 .../servicecomb/demo/zeroconfig}/Application.java  |  16 +-
 .../servicecomb/demo/zeroconfig/ServerTest.java}   |  21 +-
 .../src/main/resources/application.yml             |   6 +-
 .../src/main/resources/logback.xml                 |   0
 .../src/main/resources/registry.yaml               |   8 +-
 .../demo/zeroconfig/ZeroConfigRegistryIT.java}     |   5 +-
 .../pom.xml                                        |  10 +-
 .../demo/zeroconfig}/SelfServiceInvoker.java       |   5 +-
 .../demo/zeroconfig}/ServerApplication.java        |   3 +-
 .../demo/zeroconfig}/ServerEndpoint.java           |   3 +-
 .../src/main/resources/application.yml             |   6 +-
 .../src/main/resources/logback.xml                 |   0
 .../pom.xml                                        |  16 +-
 demo/pom.xml                                       |   1 +
 service-registry/registry-zero-config/pom.xml      |   4 -
 .../zeroconfig/SchemaContentEndpoint.java          |  42 --
 .../client/ZeroConfigRegistryClientImpl.java       | 487 ---------------------
 .../client/TestZeroConfigRegistryClientImpl.java   | 404 -----------------
 19 files changed, 54 insertions(+), 995 deletions(-)
 copy demo/{demo-multi-registries/demo-multi-registries-client => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client}/pom.xml (85%)
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/main/java/org/apache/servicecomb/demo/registry => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig}/Application.java (83%)
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/main/java/org/apache/servicecomb/demo/registry/MultiRegistriesServerTestCase.java => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerTest.java} (75%)
 copy demo/{demo-local-registry/demo-local-registry-client => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client}/src/main/resources/application.yml (87%)
 copy demo/{demo-register-url-prefix/demo-register-url-prefix-server => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client}/src/main/resources/logback.xml (100%)
 copy demo/{demo-local-registry/demo-local-registry-client => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client}/src/main/resources/registry.yaml (84%)
 copy demo/{demo-multi-registries/demo-multi-registries-client/src/test/java/org/apache/servicecomb/demo/registry/MultiRegistriesIT.java => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/test/java/org/apache/servicecomb/demo/zeroconfig/ZeroConfigRegistryIT.java} (93%)
 copy demo/{demo-multi-registries/demo-multi-registries-server => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server}/pom.xml (89%)
 copy demo/{demo-local-registry/demo-local-registry-server/src/main/java/org/apache/servicecomb/demo/localRegistryServer => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig}/SelfServiceInvoker.java (89%)
 copy demo/{demo-multi-registries/demo-multi-registries-server/src/main/java/org/apache/servicecomb/demo/registry => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig}/ServerApplication.java (97%)
 copy demo/{demo-multi-registries/demo-multi-registries-server/src/main/java/org/apache/servicecomb/demo/registry => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig}/ServerEndpoint.java (97%)
 copy demo/{demo-local-registry/demo-local-registry-server => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server}/src/main/resources/application.yml (87%)
 copy demo/{demo-register-url-prefix/demo-register-url-prefix-server => demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server}/src/main/resources/logback.xml (100%)
 copy demo/{demo-multi-registries => demo-zeroconfig-schemadiscovery-registry}/pom.xml (82%)
 delete mode 100644 service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/SchemaContentEndpoint.java
 delete mode 100644 service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/client/ZeroConfigRegistryClientImpl.java
 delete mode 100644 service-registry/registry-zero-config/src/test/java/org/apache/servicecomb/zeroconfig/client/TestZeroConfigRegistryClientImpl.java


[servicecomb-java-chassis] 02/03: [SCB-1989] Set up modules for demo zeroconfig&schemadiscovery registries

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 4f1385944124ed5f1198972802a620030480b87e
Author: Jun Gan <ju...@gmail.com>
AuthorDate: Thu Jun 4 21:29:01 2020 -0400

    [SCB-1989] Set up modules for demo zeroconfig&schemadiscovery registries
---
 .../pom.xml                                        | 80 ++++++++++++++++++++
 .../pom.xml                                        | 88 ++++++++++++++++++++++
 .../src/main/resources/application.yml             | 29 +++++++
 .../src/main/resources/logback.xml                 | 50 ++++++++++++
 .../pom.xml                                        | 54 +++++++++++++
 demo/pom.xml                                       |  1 +
 6 files changed, 302 insertions(+)

diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
new file mode 100644
index 0000000..0f64a0f
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
@@ -0,0 +1,80 @@
+<?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-zeroconfig-schemadiscovery-registry-client</artifactId>
+  <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Client</name>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zeroconfig-schemadiscovery-registry</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+
+  <properties>
+    <demo.main>org.apache.servicecomb.demo.zeroconfig.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>
+        <plugins>
+          <plugin>
+            <groupId>io.fabric8</groupId>
+            <artifactId>docker-maven-plugin</artifactId>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
+
+
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/pom.xml
new file mode 100644
index 0000000..7edb45c
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/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-zeroconfig-schemadiscovery-registry-server</artifactId>
+  <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry Server</name>
+  <parent>
+    <groupId>org.apache.servicecomb.demo</groupId>
+    <artifactId>demo-zeroconfig-schemadiscovery-registry</artifactId>
+    <version>2.1.0-SNAPSHOT</version>
+  </parent>
+
+  <properties>
+    <demo.main>org.apache.servicecomb.demo.zeroconfig.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>
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/resources/application.yml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/resources/application.yml
new file mode 100644
index 0000000..99e7de1
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/resources/application.yml
@@ -0,0 +1,29 @@
+## ---------------------------------------------------------------------------
+## 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-zeroconfig-schemadiscovery-registry
+service_description:
+  name: demo-zeroconfig-schemadiscovery-registry-server
+  version: 0.0.2
+servicecomb:
+  rest:
+    address: 0.0.0.0:8080
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/resources/logback.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/resources/logback.xml
new file mode 100644
index 0000000..0d627f2
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/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-zeroconfig-schemadiscovery-registry/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
new file mode 100644
index 0000000..ca45dc7
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
@@ -0,0 +1,54 @@
+<?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-zeroconfig-schemadiscovery-registry</artifactId>
+  <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry</name>
+  <packaging>pom</packaging>
+  <modules>
+    <module>demo-zeroconfig-schemadiscovery-registry-client</module>
+    <module>demo-zeroconfig-schemadiscovery-registry-server</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-schema-discovery</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>registry-zero-config</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.servicecomb</groupId>
+      <artifactId>foundation-test-scaffolding</artifactId>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/demo/pom.xml b/demo/pom.xml
index d5bffc6..5e8ebd5 100644
--- a/demo/pom.xml
+++ b/demo/pom.xml
@@ -43,6 +43,7 @@
     <module>demo-register-url-prefix</module>
     <module>demo-local-registry</module>
     <module>demo-multi-registries</module>
+    <module>demo-zeroconfig-schemadiscovery-registry</module>
     <module>demo-spring-boot-provider</module>
     <module>demo-spring-boot-transport</module>
     <module>demo-edge</module>


[servicecomb-java-chassis] 01/03: [SCB-1988] Remove dependency on registry-service-center moudle for registry-zero-config

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 e75fa96412bf5922d73351c4e6af38f386543b7b
Author: Jun Gan <ju...@gmail.com>
AuthorDate: Thu Jun 4 14:38:32 2020 -0400

    [SCB-1988] Remove dependency on registry-service-center moudle for registry-zero-config
---
 service-registry/registry-zero-config/pom.xml      |   4 -
 .../zeroconfig/SchemaContentEndpoint.java          |  42 --
 .../client/ZeroConfigRegistryClientImpl.java       | 487 ---------------------
 .../client/TestZeroConfigRegistryClientImpl.java   | 404 -----------------
 4 files changed, 937 deletions(-)

diff --git a/service-registry/registry-zero-config/pom.xml b/service-registry/registry-zero-config/pom.xml
index 233d414..8c336f4 100644
--- a/service-registry/registry-zero-config/pom.xml
+++ b/service-registry/registry-zero-config/pom.xml
@@ -36,10 +36,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.servicecomb</groupId>
-      <artifactId>registry-service-center</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.servicecomb</groupId>
       <artifactId>foundation-common</artifactId>
     </dependency>
     <dependency>
diff --git a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/SchemaContentEndpoint.java b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/SchemaContentEndpoint.java
deleted file mode 100644
index 03643b3..0000000
--- a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/SchemaContentEndpoint.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.zeroconfig;
-
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-
-import org.apache.servicecomb.zeroconfig.client.ClientUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import javax.ws.rs.core.MediaType;
-import java.util.Map;
-
-@RestSchema(schemaId = "schemaContentEndpoint")
-@RequestMapping(path = "/schemaEndpoint")
-public class SchemaContentEndpoint {
-
-  private static final Logger LOGGER = LoggerFactory.getLogger(SchemaContentEndpoint.class);
-
-  // each service self-expose this endpoint for others(consumers) to retrieve the schema content
-  @RequestMapping(path = "/schemas", produces = MediaType.TEXT_PLAIN, method = RequestMethod.GET)
-  public String getSchemaEndpoint(@RequestParam(name = "schemaId") String schemaId) {
-    Map<String, String> schemaMap = ClientUtil.getMicroserviceSelf().getSchemaMap();
-    return schemaMap.get(schemaId);
-  }
-}
\ No newline at end of file
diff --git a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/client/ZeroConfigRegistryClientImpl.java b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/client/ZeroConfigRegistryClientImpl.java
deleted file mode 100644
index f475dde..0000000
--- a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/client/ZeroConfigRegistryClientImpl.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.zeroconfig.client;
-
-import com.google.common.base.Charsets;
-import com.google.common.hash.Hashing;
-
-import javax.ws.rs.core.Response.Status;
-import org.apache.servicecomb.foundation.vertx.AsyncResultCallback;
-import org.apache.servicecomb.registry.api.registry.Microservice;
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstanceStatus;
-import org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterConfig;
-import org.apache.servicecomb.serviceregistry.api.registry.ServiceCenterInfo;
-import org.apache.servicecomb.registry.api.registry.FindInstancesResponse;
-import org.apache.servicecomb.serviceregistry.api.response.GetSchemaResponse;
-import org.apache.servicecomb.serviceregistry.api.response.HeartbeatResponse;
-import org.apache.servicecomb.registry.api.event.MicroserviceInstanceChangedEvent;
-import org.apache.servicecomb.serviceregistry.client.ServiceRegistryClient;
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstances;
-import org.apache.servicecomb.zeroconfig.server.ServerMicroserviceInstance;
-import org.apache.servicecomb.zeroconfig.server.ServerUtil;
-import org.apache.servicecomb.zeroconfig.server.ZeroConfigRegistryService;
-import org.apache.servicecomb.serviceregistry.client.http.Holder;
-import org.apache.servicecomb.registry.version.Version;
-import org.apache.servicecomb.registry.version.VersionRule;
-import org.apache.servicecomb.registry.version.VersionRuleUtils;
-import org.apache.servicecomb.registry.version.VersionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-import java.net.MulticastSocket;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import org.springframework.web.client.RestTemplate;
-
-import static org.apache.servicecomb.zeroconfig.ZeroConfigRegistryConstants.*;
-
-public class ZeroConfigRegistryClientImpl implements ServiceRegistryClient {
-
-  private static final Logger LOGGER = LoggerFactory.getLogger(ZeroConfigRegistryClientImpl.class);
-
-  private ZeroConfigRegistryService zeroConfigRegistryService;
-  private RestTemplate restTemplate;
-  private MulticastSocket multicastSocket;
-
-  public ZeroConfigRegistryClientImpl(ZeroConfigRegistryService zeroConfigRegistryService,
-      MulticastSocket multicastSocket, RestTemplate restTemplate) {
-    this.zeroConfigRegistryService = zeroConfigRegistryService;
-    this.restTemplate = restTemplate;
-    this.multicastSocket = multicastSocket;
-    try {
-      this.multicastSocket.setLoopbackMode(false);
-      this.multicastSocket.setTimeToLive(TIME_TO_LIVE);
-    } catch (IOException e) {
-      LOGGER.error("Failed configure MulticastSocket object", e);
-    }
-  }
-
-  @Override
-  public void init() {
-  }
-
-  @Override
-  public List<Microservice> getAllMicroservices() {
-    List<Microservice> allServicesList = new ArrayList<>();
-    Map<String, Map<String, ServerMicroserviceInstance>> allServicesMap = ServerUtil.microserviceInstanceMap;
-    allServicesMap.forEach((serviceId, instanceIdMap) -> {
-      instanceIdMap.forEach((instanceId, instance) -> {
-        allServicesList.add(ClientUtil.convertToClientMicroservice(instance));
-      });
-    });
-    return allServicesList;
-  }
-
-  // this method is called before Microservice registration to check whether service with this ID exists or not
-  @Override
-  public String getMicroserviceId(String appId, String microserviceName, String versionRule,
-      String environment) {
-    return ClientUtil.getMicroserviceSelf().getServiceId();
-  }
-
-  @Override
-  public String registerMicroservice(Microservice microservice) {
-    String serviceId = microservice.getServiceId();
-    if (serviceId == null || serviceId.length() == 0) {
-      serviceId = ClientUtil.generateServiceId(microservice);
-      microservice.setServiceId(serviceId);
-    }
-    // set to local variable so that it can be used to retrieve serviceName/appId/version when registering instance
-    ClientUtil.setMicroserviceSelf(microservice);
-    return serviceId;
-  }
-
-  @Override
-  public Microservice getMicroservice(String microserviceId) {
-    // for registration
-    if (ClientUtil.getMicroserviceSelf().getServiceId().equals(microserviceId)) {
-      return ClientUtil.getMicroserviceSelf();
-    } else {
-      // called when consumer discover provider for the very first time
-      ServerMicroserviceInstance serverInstance = zeroConfigRegistryService
-          .getMicroservice(microserviceId);
-      return serverInstance != null ? ClientUtil.convertToClientMicroservice(serverInstance) : null;
-    }
-  }
-
-  @Override
-  public Microservice getAggregatedMicroservice(String microserviceId) {
-    return this.getMicroservice(microserviceId);
-  }
-
-  // only used in existing UT code. Only support updating microserviceitself properties.
-  @Override
-  public boolean updateMicroserviceProperties(String microserviceId,
-      Map<String, String> serviceProperties) {
-    if (microserviceId != ClientUtil.getMicroserviceSelf().getServiceId()) {
-      return false;
-    }
-    // putAll will update values for keys exist in the map, also add new <key, value> to the map
-    ClientUtil.getMicroserviceSelf().getProperties().putAll(serviceProperties);
-    return true;
-  }
-
-  @Override
-  public boolean isSchemaExist(String microserviceId, String schemaId) {
-    LOGGER.info("isSchemaExist: microserviceId: {}, scehmaId: {}", microserviceId, schemaId);
-    String serviceId = ClientUtil.getMicroserviceSelf().getServiceId();
-    if (serviceId == null || (serviceId != null && !serviceId.equals(microserviceId))) {
-      throw new IllegalArgumentException("Invalid serviceId, serviceId=" + microserviceId);
-    }
-
-    List<String> schemaList = ClientUtil.getMicroserviceSelf().getSchemas();
-    return schemaList != null && schemaList.contains(schemaId);
-  }
-
-  @Override
-  public boolean registerSchema(String microserviceId, String schemaId, String schemaContent) {
-    LOGGER.info("registerSchema: serviceId: {}, scehmaId: {}, SchemaContent: {}", microserviceId,
-        schemaId, schemaContent);
-
-    String serviceId = ClientUtil.getMicroserviceSelf().getServiceId();
-    if (serviceId == null || (serviceId != null && !serviceId.equals(microserviceId))) {
-      throw new IllegalArgumentException("Invalid serviceId, serviceId=" + microserviceId);
-    }
-
-    ClientUtil.getMicroserviceSelf().addSchema(schemaId, schemaContent);
-    return true;
-  }
-
-  @Override
-  public String getSchema(String microserviceId, String schemaId) {
-    LOGGER.info("getSchema: microserviceId: {}, scehmaId: {}", microserviceId, schemaId);
-    // called by service registration task when registering itself
-    if (ClientUtil.getMicroserviceSelf().getServiceId().equals(microserviceId)) {
-      return ClientUtil.getMicroserviceSelf().getSchemaMap().computeIfPresent(schemaId, (k, v) -> {
-        return v;
-      });
-    } else {
-      // called by consumer to load provider's schema content for the very first time
-      String endpoint = this.getEndpointForMicroservice(microserviceId);
-      if (endpoint == null) {
-        throw new IllegalArgumentException("Provider's endpoint can NOT be Null");
-      }
-      String schemaContentEndpoint = endpoint + "/schemaEndpoint/schemas?schemaId=" + schemaId;
-      // LOGGER.info("Going to retrieve schema content from endpoint:{}", schemaContentEndpoint);
-      // Make a rest call to provider's endpoint directly to retrieve the schema content
-      String schemaContent = this.restTemplate.getForObject(schemaContentEndpoint, String.class);
-      //LOGGER.debug("Retrieved the schema content for microserviceId: {}, schemaId: {}, schemaContent: {}", microserviceId, schemaId, schemaContent);
-      return schemaContent;
-    }
-  }
-
-  private String getEndpointForMicroservice(String microserviceId) {
-    ServerMicroserviceInstance serverMicroserviceInstance = zeroConfigRegistryService
-        .getMicroservice(microserviceId);
-    LOGGER.info("getEndpointForMicroservice: serverMicroserviceInstance: {}",
-        serverMicroserviceInstance);
-    if (serverMicroserviceInstance != null && !serverMicroserviceInstance.getEndpoints()
-        .isEmpty()) {
-      return serverMicroserviceInstance.getEndpoints().get(0)
-          .replace(ENDPOINT_PREFIX_REST, ENDPOINT_PREFIX_HTTP);
-    }
-    return null;
-  }
-
-  @Override
-  public String getAggregatedSchema(String microserviceId, String schemaId) {
-    LOGGER.info("getAggregatedSchema: microserviceId: {}, scehmaId: {}", microserviceId, schemaId);
-    return this.getSchema(microserviceId, schemaId);
-  }
-
-  @Override
-  public Holder<List<GetSchemaResponse>> getSchemas(String microserviceId) {
-    // this method is just called in MicroserviceRegisterTask.java doRegister() for registration purpose
-    Holder<List<GetSchemaResponse>> resultHolder = new Holder<>();
-    if (ClientUtil.getMicroserviceSelf().getServiceId() != microserviceId) {
-      LOGGER.error("Invalid serviceId! Failed to retrieve microservice for serviceId {}",
-          microserviceId);
-      return resultHolder;
-    }
-    List<GetSchemaResponse> schemas = new ArrayList<>();
-    ClientUtil.getMicroserviceSelf().getSchemaMap().forEach((schemaId, schemaContent) -> {
-      GetSchemaResponse schema = new GetSchemaResponse();
-      schema.setSchemaId(schemaId);
-      schema.setSchema(schemaContent);
-      schema.setSummary(
-          Hashing.sha256().newHasher().putString(schemaContent, Charsets.UTF_8).hash().toString());
-      schemas.add(schema);
-    });
-    resultHolder.setStatusCode(Status.OK.getStatusCode()).setValue(schemas);
-    return resultHolder;
-  }
-
-  @Override
-  public String registerMicroserviceInstance(MicroserviceInstance instance) {
-    String serviceId = instance.getServiceId();
-    String instanceId = instance.getInstanceId(); // allow client to set the instanceId
-    if (instanceId == null || instanceId.length() == 0) {
-      instanceId = ClientUtil.generateServiceInstanceId();
-      instance.setInstanceId(instanceId);
-    }
-
-    try {
-      Map<String, String> serviceInstanceMap = ClientUtil
-          .convertToRegisterDataModel(serviceId, instanceId, instance,
-              ClientUtil.getMicroserviceSelf());
-      byte[] instanceData = serviceInstanceMap.toString().getBytes();
-      DatagramPacket instanceDataPacket = new DatagramPacket(instanceData, instanceData.length,
-          InetAddress.getByName(GROUP), PORT);
-      this.multicastSocket.send(instanceDataPacket);
-
-      // set this variable for heartbeat itself status
-      serviceInstanceMap.put(EVENT, HEARTBEAT_EVENT);
-      ClientUtil.setServiceInstanceMapForHeartbeat(serviceInstanceMap);
-
-    } catch (IOException e) {
-      LOGGER.error("Failed to register microservice instance to mdns. servcieId: {} instanceId:{}",
-          serviceId, instanceId, e);
-      return null;
-    }
-    return instanceId;
-  }
-
-  // only used in existing UT code. get microservice instances for providerId,
-  @Override
-  public List<MicroserviceInstance> getMicroserviceInstance(String consumerId, String providerId) {
-    List<MicroserviceInstance> microserviceInstanceResultList = new ArrayList<>();
-    List<ServerMicroserviceInstance> serverMicroserviceInstanceList = this.zeroConfigRegistryService
-        .getMicroserviceInstance(consumerId, providerId);
-    if (serverMicroserviceInstanceList == null || serverMicroserviceInstanceList.isEmpty()) {
-      LOGGER.error("Invalid serviceId: {}", providerId);
-      return microserviceInstanceResultList;
-    }
-
-    microserviceInstanceResultList = serverMicroserviceInstanceList.stream()
-        .map(serverInstance -> {
-          return ClientUtil.convertToClientMicroserviceInstance(serverInstance);
-        }).collect(Collectors.toList());
-
-    return microserviceInstanceResultList;
-  }
-
-  // only used in existing UT code. Only support updating microserviceitself instance properties.
-  @Override
-  public boolean updateInstanceProperties(String microserviceId, String instanceId,
-      Map<String, String> instanceProperties) {
-    Microservice selfMicroservice = ClientUtil.getMicroserviceSelf();
-    MicroserviceInstance selfInstance = selfMicroservice.getInstance();
-    if (selfInstance == null || !(selfInstance.getInstanceId().equals(instanceId))
-        || !(selfMicroservice.getServiceId().equals(microserviceId))) {
-      LOGGER.error(
-          "Invalid microserviceId, microserviceId: {} OR microserviceInstanceId, microserviceInstanceId: {}",
-          microserviceId, instanceId);
-      return false;
-    }
-
-    // putAll will update values for keys exist in the map, also add new <key, value> to the map
-    selfInstance.getProperties().putAll(instanceProperties);
-    ClientUtil.getMicroserviceSelf().setInstance(selfInstance);
-    return true;
-  }
-
-  @Override
-  public boolean unregisterMicroserviceInstance(String serviceId, String instanceId) {
-    ServerMicroserviceInstance serverMicroserviceInstance = this.zeroConfigRegistryService
-        .findServiceInstance(serviceId, instanceId);
-
-    if (serverMicroserviceInstance == null) {
-      return false;
-    }
-
-    try {
-      LOGGER.info(
-          "Start unregister microservice instance. The instance with servcieId: {} instanceId:{}",
-          serviceId, instanceId);
-      Map<String, String> unregisterEventMap = new HashMap<>();
-      unregisterEventMap.put(EVENT, UNREGISTER_EVENT);
-      unregisterEventMap.put(SERVICE_ID, serviceId);
-      unregisterEventMap.put(INSTANCE_ID, instanceId);
-      byte[] unregisterEventBytes = unregisterEventMap.toString().getBytes();
-      DatagramPacket unregisterEventDataPacket = new DatagramPacket(unregisterEventBytes,
-          unregisterEventBytes.length,
-          InetAddress.getByName(GROUP), PORT);
-      this.multicastSocket.send(unregisterEventDataPacket);
-      return true;
-    } catch (IOException e) {
-      LOGGER.error("Failed to unregister microservice instance event. servcieId: {} instanceId:{}",
-          serviceId, instanceId, e);
-      return false;
-    }
-  }
-
-  @Override
-  public HeartbeatResponse heartbeat(String microserviceId, String instanceId) {
-    HeartbeatResponse response = new HeartbeatResponse();
-    if (this.zeroConfigRegistryService.heartbeat(microserviceId, instanceId)) {
-      response.setMessage(INSTANCE_HEARTBEAT_RESPONSE_MESSAGE_OK);
-      response.setOk(true);
-    }
-    return response;
-  }
-
-  @Override
-  public void watch(String selfMicroserviceId,
-      AsyncResultCallback<MicroserviceInstanceChangedEvent> callback) {
-  }
-
-  @Override
-  public void watch(String selfMicroserviceId,
-      AsyncResultCallback<MicroserviceInstanceChangedEvent> callback,
-      AsyncResultCallback<Void> onOpen, AsyncResultCallback<Void> onClose) {
-  }
-
-  @Override
-  public List<MicroserviceInstance> findServiceInstance(String selfMicroserviceId, String appId,
-      String serviceName, String versionRule) {
-    MicroserviceInstances instances = findServiceInstances(selfMicroserviceId, appId, serviceName,
-        versionRule, null);
-    if (instances.isMicroserviceNotExist()) {
-      return null;
-    }
-    return instances.getInstancesResponse().getInstances();
-  }
-
-  /**
-   * called by RefreshableMicroserviceCache.pullInstanceFromServiceCenter when consumer call
-   * provider for the first time https://github.com/apache/servicecomb-service-center/blob/master/server/core/swagger/v4.yaml
-   *
-   * @param consumerId           in http header, NOT the query parameters ("X-ConsumerId",
-   *                             consumerId);
-   * @param appId:               = appId (Server side, Required)
-   * @param providerServiceName: = serviceName (Server side, Required)
-   * @param strVersionRule:      = version (Server side, Required) (e.g. 0.0.0.0+") 1.精确版本匹配
-   *                             2.后续版本匹配 3.最新版本 4.版本范围
-   * @param revision:            = rev (Server side, Optional. is null) for compatible with existing
-   *                             system
-   * @return MicroserviceInstances  collection of Microservice Instance for (appId,
-   * providerServiceName, strVersionRule)
-   */
-  @Override
-  public MicroserviceInstances findServiceInstances(String consumerId, String appId,
-      String providerServiceName, String strVersionRule, String revision) {
-    LOGGER.info(
-        "find service instance for consumerId: {}, providerServiceName: {}, versionRule: {}, revision: {}",
-        consumerId, providerServiceName, strVersionRule, revision);
-
-    MicroserviceInstances resultMicroserviceInstances = new MicroserviceInstances();
-    FindInstancesResponse response = new FindInstancesResponse();
-    List<MicroserviceInstance> resultInstanceList = new ArrayList<>();
-
-    // 1.  find matched appId and serviceName from "Server"
-    List<ServerMicroserviceInstance> tempServerInstanceList = this.zeroConfigRegistryService.
-        findServiceInstances(appId, providerServiceName);
-
-    // 2.  find matched instance based on the strVersionRule
-    VersionRule versionRule = VersionRuleUtils.getOrCreate(strVersionRule);
-
-    ServerMicroserviceInstance latestVersionInstance = findLatestVersionInstance(
-        tempServerInstanceList, versionRule);
-    if (latestVersionInstance != null) {
-      Version latestVersion = VersionUtils.getOrCreate(latestVersionInstance.getVersion());
-      for (ServerMicroserviceInstance serverInstance : tempServerInstanceList) {
-        Version version = VersionUtils.getOrCreate(serverInstance.getVersion());
-        if (!versionRule.isMatch(version, latestVersion)) {
-          continue;
-        }
-        resultInstanceList.add(ClientUtil.convertToClientMicroserviceInstance(serverInstance));
-      }
-    }
-
-    response.setInstances(resultInstanceList);
-    resultMicroserviceInstances.setInstancesResponse(response);
-    return resultMicroserviceInstances;
-  }
-
-  private ServerMicroserviceInstance findLatestVersionInstance(
-      List<ServerMicroserviceInstance> instanceList, VersionRule versionRule) {
-    Version latestVersion = null;
-    ServerMicroserviceInstance latestVersionInstance = null;
-    for (ServerMicroserviceInstance serverInstance : instanceList) {
-      Version version = VersionUtils.getOrCreate(serverInstance.getVersion());
-      if (!versionRule.isAccept(version)) {
-        continue;
-      }
-
-      if (latestVersion == null || version.compareTo(latestVersion) > 0) {
-        latestVersion = version;
-        latestVersionInstance = serverInstance;
-      }
-    }
-    return latestVersionInstance;
-  }
-
-
-  @Override
-  public MicroserviceInstance findServiceInstance(String serviceId, String instanceId) {
-    ServerMicroserviceInstance serverMicroserviceInstance = this.zeroConfigRegistryService
-        .findServiceInstance(serviceId, instanceId);
-    if (serverMicroserviceInstance == null) {
-      LOGGER.error(
-          "Invalid serviceId OR instanceId! Failed to retrieve Microservice Instance for serviceId {} and instanceId {}",
-          serviceId, instanceId);
-      return null;
-    }
-    return ClientUtil.convertToClientMicroserviceInstance(serverMicroserviceInstance);
-  }
-
-  // for compatibility with existing registration logic. only used in the existing UT code.
-  @Override
-  public ServiceCenterInfo getServiceCenterInfo() {
-    ServiceCenterInfo info = new ServiceCenterInfo();
-    info.setVersion("");
-    info.setBuildTag("");
-    info.setRunMode("");
-    info.setApiVersion("");
-    info.setConfig(new ServiceCenterConfig());
-    return info;
-  }
-
-  /**
-   * for compatibility with existing registration logic and flow. 1. Only called by
-   * SCBEngine.turnDownInstanceStatus to set instance status to Down 2. In zero-config context,
-   * there is no need to update status (from UP TO DOWN)as there is no physical registry center to
-   * show the status
-   */
-  @Override
-  public boolean updateMicroserviceInstanceStatus(String microserviceId, String instanceId,
-      MicroserviceInstanceStatus status) {
-    if (null == status) {
-      throw new IllegalArgumentException("null status is now allowed");
-    }
-    String selfServiceId = ClientUtil.getMicroserviceSelf().getServiceId();
-    MicroserviceInstance selfInstance = ClientUtil.getMicroserviceSelf().getInstance();
-
-    if (!microserviceId.equals(selfServiceId) || selfInstance == null || !selfInstance
-        .getInstanceId().equals(instanceId)) {
-      throw new IllegalArgumentException(
-          String.format("Invalid argument. microserviceId=%s, instanceId=%s.",
-              microserviceId,
-              instanceId));
-    }
-    selfInstance.setStatus(status);
-    return this.unregisterMicroserviceInstance(microserviceId, instanceId);
-  }
-
-}
diff --git a/service-registry/registry-zero-config/src/test/java/org/apache/servicecomb/zeroconfig/client/TestZeroConfigRegistryClientImpl.java b/service-registry/registry-zero-config/src/test/java/org/apache/servicecomb/zeroconfig/client/TestZeroConfigRegistryClientImpl.java
deleted file mode 100644
index 1974bde..0000000
--- a/service-registry/registry-zero-config/src/test/java/org/apache/servicecomb/zeroconfig/client/TestZeroConfigRegistryClientImpl.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.servicecomb.zeroconfig.client;
-
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstance;
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstanceStatus;
-import org.apache.servicecomb.serviceregistry.api.response.HeartbeatResponse;
-import org.apache.servicecomb.registry.api.registry.MicroserviceInstances;
-import org.apache.servicecomb.zeroconfig.server.ServerMicroserviceInstance;
-import org.mockito.Mock;
-
-import static org.apache.servicecomb.zeroconfig.ZeroConfigRegistryConstants.INSTANCE_ID;
-import static org.apache.servicecomb.zeroconfig.ZeroConfigRegistryConstants.INSTANCE_HEARTBEAT_RESPONSE_MESSAGE_OK;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import org.apache.servicecomb.registry.api.registry.Microservice;
-import org.apache.servicecomb.zeroconfig.server.ZeroConfigRegistryService;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.MockitoAnnotations;
-import org.springframework.web.client.RestTemplate;
-
-import java.io.IOException;
-import java.net.MulticastSocket;
-import java.util.ArrayList;
-import java.util.List;
-
-public class TestZeroConfigRegistryClientImpl {
-
-  ZeroConfigRegistryClientImpl target;
-
-  @Mock
-  ZeroConfigRegistryService zeroConfigRegistryService;
-
-  @Mock
-  MulticastSocket multicastSocket;
-
-  @Mock
-  RestTemplate restTemplate;
-
-  // testing data
-  String selfServiceId = "123";
-  String selfInstanceId = "instanceId";
-  String otherServiceId = "456";
-  String appId = "appId";
-  String serviceName = "serviceName";
-  String version = "0.0.0.1";
-  String status = "UP";
-  String host = "host";
-  String schemaId1 = "schemaId1";
-  String schemaContent1 = "schemaContent1";
-  String newSchemaId = "newSchemaId";
-  String newSchemaContent = "newSchemaContent";
-  String nonExistSchemaId = "nonExistSchemaId";
-  String endpoint1 = "endpoint1";
-  String strVersionRule = "0.0.0.0+";
-
-  @Before
-  public void setUp() {
-    MockitoAnnotations.initMocks(this);
-    target = new ZeroConfigRegistryClientImpl(zeroConfigRegistryService, multicastSocket,
-        restTemplate);
-  }
-
-  private Microservice prepareService(String serviceId, boolean withId) {
-    Microservice microservice = new Microservice();
-    if (withId) {
-      microservice.setServiceId(serviceId);
-    }
-    microservice.setServiceName(serviceName);
-    microservice.setAppId(appId);
-    microservice.setVersion(version);
-    microservice.setStatus(status);
-    List<String> schemas = new ArrayList<>();
-    schemas.add(schemaId1);
-    microservice.setSchemas(schemas);
-    microservice.addSchema(schemaId1, schemaContent1);
-    return microservice;
-  }
-
-  private MicroserviceInstance prepareInstance(String instanceId, boolean withId) {
-    MicroserviceInstance instance = new MicroserviceInstance();
-    if (withId) {
-      instance.setInstanceId(instanceId);
-    }
-    instance.setServiceId(selfServiceId);
-    List<String> endpointList = new ArrayList<>();
-    endpointList.add(endpoint1);
-    instance.setEndpoints(endpointList);
-    instance.setStatus(MicroserviceInstanceStatus.UP);
-    instance.setHostName(host);
-    return instance;
-  }
-
-  private ServerMicroserviceInstance prepareServerServiceInstance(boolean withEndpoint) {
-    ServerMicroserviceInstance serverServiceInstance = new ServerMicroserviceInstance();
-    serverServiceInstance.setServiceId(otherServiceId);
-    serverServiceInstance.setInstanceId(selfInstanceId);
-    serverServiceInstance.setServiceName(serviceName);
-    serverServiceInstance.setAppId(appId);
-    serverServiceInstance.setVersion(version);
-    serverServiceInstance.setStatus(status);
-    List<String> schemas = new ArrayList<>();
-    schemas.add(schemaId1);
-    serverServiceInstance.setSchemas(schemas);
-    if (withEndpoint) {
-      List<String> endpointList = new ArrayList<>();
-      endpointList.add(endpoint1);
-      serverServiceInstance.setEndpoints(endpointList);
-    }
-    serverServiceInstance.setHostName(host);
-    return serverServiceInstance;
-  }
-
-  @After
-  public void tearDown() throws Exception {
-
-  }
-
-  @Test
-  public void test_registerMicroservice_withID_shouldReturnSameID() {
-    Microservice selfService = prepareService(selfServiceId, true);
-    ClientUtil.setMicroserviceSelf(selfService);
-
-    String returnedServiceId = target.registerMicroservice(selfService);
-
-    Assert.assertEquals(selfServiceId, returnedServiceId);
-  }
-
-  @Test
-  public void test_registerMicroservice_withoutID_shouldReturnGeneratedID() {
-    Microservice serviceWithoutID = prepareService(selfServiceId, false);
-    ClientUtil.setMicroserviceSelf(serviceWithoutID);
-
-    String returnedServiceId = target.registerMicroservice(serviceWithoutID);
-
-    Assert.assertEquals(ClientUtil.generateServiceId(serviceWithoutID), returnedServiceId);
-  }
-
-  @Test
-  public void test_getMicroservice_forItself_shouldReturnItself_And_NotCallZeroConfigRegistryService() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    Microservice microservice = target.getMicroservice(selfServiceId);
-
-    Assert
-        .assertEquals(microservice.getServiceId(), ClientUtil.getMicroserviceSelf().getServiceId());
-    verifyZeroInteractions(zeroConfigRegistryService);
-  }
-
-  @Test
-  public void test_getMicroservice_forItself_shouldReturnOtherService_And_CallZeroConfigRegistryService() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    when(zeroConfigRegistryService.getMicroservice(otherServiceId))
-        .thenReturn(prepareServerServiceInstance(true));
-
-    Microservice returnedMicroservice = target.getMicroservice(otherServiceId);
-
-    Assert.assertEquals(otherServiceId, returnedMicroservice.getServiceId());
-    verify(zeroConfigRegistryService, times(1)).getMicroservice(otherServiceId);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void test_isSchemaExist_whenServiceIdIsNull_shouldThrowIllegalArgumentException() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, false));
-
-    target.isSchemaExist(selfServiceId, schemaId1);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void test_isSchemaExist_whenServiceIdIsNotItselfId_shouldThrowIllegalArgumentException() {
-    ClientUtil.setMicroserviceSelf(prepareService(otherServiceId, true));
-
-    target.isSchemaExist(selfServiceId, schemaId1);
-  }
-
-  @Test
-  public void test_isSchemaExist_whenServiceIdIsItselfId_shouldReturnTrue() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    boolean returnedResult = target.isSchemaExist(selfServiceId, schemaId1);
-    Assert.assertTrue(returnedResult);
-  }
-
-  @Test
-  public void test_isSchemaExist_whenSchemaNotExist_shouldReturnFalse() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    boolean returnedResult = target.isSchemaExist(selfServiceId, nonExistSchemaId);
-    Assert.assertFalse(returnedResult);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void test_registerSchema_whenServiceIdIsNull_shouldThrowIllegalArgumentException() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, false));
-
-    target.registerSchema(selfServiceId, schemaId1, schemaContent1);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void test_registerSchema_whenServiceIdIsNotItSelfId_shouldThrowIllegalArgumentException() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    target.registerSchema(otherServiceId, schemaId1, schemaContent1);
-  }
-
-  @Test
-  public void test_registerSchema_whenReigsterForItself_shouldSuceed() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    boolean returnedResult = target.registerSchema(selfServiceId, newSchemaId, newSchemaContent);
-    Assert.assertTrue(returnedResult);
-    Assert.assertEquals(newSchemaContent,
-        ClientUtil.getMicroserviceSelf().getSchemaMap().computeIfPresent(newSchemaId, (k, v) -> {
-          return v;
-        }));
-  }
-
-  @Test
-  public void test_getSchema_whenForSelfMicroservice_shouldSuceed() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    String returnedSchemaContent = target.getSchema(selfServiceId, schemaId1);
-    Assert.assertEquals(schemaContent1, returnedSchemaContent);
-  }
-
-  @Test
-  public void test_getSchema_whenForSelfMicroservice_shouldNotCallZeroConfigRegistryServiceAndSucceed() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-
-    String returnedSchemaContent = target.getSchema(selfServiceId, schemaId1);
-
-    Assert.assertEquals(schemaContent1, returnedSchemaContent);
-    verifyZeroInteractions(zeroConfigRegistryService);
-  }
-
-  @Test
-  public void test_getSchema_whenForOtherMicroservice_shouldCallZeroConfigRegistryService() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-    when(zeroConfigRegistryService.getMicroservice(otherServiceId))
-        .thenReturn(prepareServerServiceInstance(true));
-    String schemaContentEndpoint = endpoint1 + "/schemaEndpoint/schemas?schemaId=" + schemaId1;
-    when(restTemplate.getForObject(schemaContentEndpoint, String.class)).thenReturn(schemaContent1);
-
-    String returnedSchemaContent = target.getSchema(otherServiceId, schemaId1);
-
-    Assert.assertEquals(schemaContent1, returnedSchemaContent);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void test_getSchema_whenProviderEndpointIsNull_shouldThrowIllegalArgumentException() {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-    when(zeroConfigRegistryService.getMicroservice(otherServiceId))
-        .thenReturn(prepareServerServiceInstance(false));
-
-    target.getSchema(otherServiceId, schemaId1);
-
-    verifyZeroInteractions(restTemplate);
-  }
-
-  @Test
-  public void test_registerMicroserviceInstance_withNullInstanceId_shouldGenerateInstanceId_and_succeed()
-      throws IOException {
-    ClientUtil.setMicroserviceSelf(prepareService(selfServiceId, true));
-    MicroserviceInstance instanceWithoutId = prepareInstance(selfInstanceId, false);
-    when(zeroConfigRegistryService.getMicroservice(otherServiceId))
-        .thenReturn(prepareServerServiceInstance(false));
-    doNothing().when(multicastSocket).send(anyObject());
-
-    String instanceId = target.registerMicroserviceInstance(instanceWithoutId);
-
-    verify(multicastSocket, times(1)).send(anyObject());
-    Assert.assertNotNull(instanceId);
-    Assert.assertNotNull(ClientUtil.getServiceInstanceMapForHeartbeat());
-    Assert
-        .assertEquals(instanceId, ClientUtil.getServiceInstanceMapForHeartbeat().get(INSTANCE_ID));
-  }
-
-  @Test
-  public void test_unregisterMicroserviceInstance_whenInstanceNotExist_shoulReturnFalse()
-      throws IOException {
-    when(zeroConfigRegistryService.findServiceInstance(selfServiceId, selfInstanceId))
-        .thenReturn(null);
-
-    boolean returnedResult = target.unregisterMicroserviceInstance(selfServiceId, selfInstanceId);
-
-    Assert.assertFalse(returnedResult);
-    verify(multicastSocket, times(0)).send(anyObject());
-
-  }
-
-  @Test
-  public void test_unregisterMicroserviceInstance_withNullInstanceId_shouldGenerateInstanceId_and_succeed()
-      throws IOException {
-    when(zeroConfigRegistryService.findServiceInstance(selfServiceId, selfInstanceId))
-        .thenReturn(prepareServerServiceInstance(true));
-    doNothing().when(multicastSocket).send(anyObject());
-
-    boolean returnedResult = target.unregisterMicroserviceInstance(selfServiceId, selfInstanceId);
-
-    Assert.assertTrue(returnedResult);
-    verify(multicastSocket, times(1)).send(anyObject());
-  }
-
-  @Test
-  public void test_heartbeat_forUnhealthyInstance_shouldFail() {
-    when(zeroConfigRegistryService.heartbeat(selfServiceId, selfInstanceId)).thenReturn(false);
-
-    HeartbeatResponse returnedResult = target.heartbeat(selfServiceId, selfInstanceId);
-    String returnedMessage = returnedResult.getMessage();
-    boolean returnedStatusResult = returnedResult.isOk();
-
-    Assert.assertNull(returnedMessage);
-    Assert.assertFalse(returnedStatusResult);
-  }
-
-  @Test
-  public void test_heartbeat_forHealthyInstance_shouldSucceed() {
-    when(zeroConfigRegistryService.heartbeat(selfServiceId, selfInstanceId)).thenReturn(true);
-
-    HeartbeatResponse returnedResult = target.heartbeat(selfServiceId, selfInstanceId);
-    String returnedMessage = returnedResult.getMessage();
-    boolean returnedStatusResult = returnedResult.isOk();
-
-    Assert.assertEquals(INSTANCE_HEARTBEAT_RESPONSE_MESSAGE_OK, returnedMessage);
-    Assert.assertTrue(returnedStatusResult);
-  }
-
-  @Test
-  public void test_findServiceInstances_forNonExistInstance_shouldReturnEmptyResult() {
-    List<ServerMicroserviceInstance> serverMicroserviceInstancesList = new ArrayList<>();
-    when(zeroConfigRegistryService.findServiceInstances(selfServiceId, selfInstanceId))
-        .thenReturn(serverMicroserviceInstancesList);
-
-    MicroserviceInstances returnedResult = target
-        .findServiceInstances("", appId, serviceName, strVersionRule, "");
-
-    Assert.assertEquals(0, returnedResult.getInstancesResponse().getInstances().size());
-  }
-
-  @Test
-  public void test_findServiceInstances_forExistInstance_shouldReturnInstances() {
-    List<ServerMicroserviceInstance> serverMicroserviceInstancesList = new ArrayList<>();
-    serverMicroserviceInstancesList.add(prepareServerServiceInstance(true));
-    when(zeroConfigRegistryService.findServiceInstances(appId, serviceName))
-        .thenReturn(serverMicroserviceInstancesList);
-
-    MicroserviceInstances returnedResult = target
-        .findServiceInstances("", appId, serviceName, strVersionRule, "");
-    List<MicroserviceInstance> returnedInstanceList = returnedResult.getInstancesResponse()
-        .getInstances();
-
-    Assert.assertEquals(1, returnedInstanceList.size());
-    Assert.assertEquals(selfInstanceId, returnedInstanceList.get(0).getInstanceId());
-  }
-
-
-  @Test
-  public void test_findServiceInstance_forNonExistInstance_shouldReturnNull() {
-    when(zeroConfigRegistryService.findServiceInstance(selfServiceId, selfInstanceId))
-        .thenReturn(null);
-
-    MicroserviceInstance returnedResult = target.findServiceInstance(selfServiceId, selfInstanceId);
-
-    Assert.assertNull(returnedResult);
-  }
-
-  @Test
-  public void test_findServiceInstance_forExistInstance_shouldReturnInstance() {
-    when(zeroConfigRegistryService.findServiceInstance(otherServiceId, selfInstanceId))
-        .thenReturn(prepareServerServiceInstance(true));
-
-    MicroserviceInstance returnedResult = target
-        .findServiceInstance(otherServiceId, selfInstanceId);
-
-    Assert.assertNotNull(returnedResult);
-    Assert.assertEquals(otherServiceId, returnedResult.getServiceId());
-    Assert.assertEquals(selfInstanceId, returnedResult.getInstanceId());
-  }
-
-}
-


[servicecomb-java-chassis] 03/03: [SCB-1989] Add testing code for demo zeroconfig&schemadiscovery registries

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 7a7706207dab1fb6d94f36bf3b6d37665e1939d3
Author: Jun Gan <ju...@gmail.com>
AuthorDate: Fri Jun 5 15:48:04 2020 -0400

    [SCB-1989] Add testing code for demo zeroconfig&schemadiscovery registries
---
 .../pom.xml                                        |  2 +-
 .../servicecomb/demo/zeroconfig/Application.java   | 47 ++++++++++++++
 .../servicecomb/demo/zeroconfig/ServerTest.java    | 72 ++++++++++++++++++++++
 .../src/main/resources/application.yml             | 31 ++++++++++
 .../src/main/resources/logback.xml                 | 50 +++++++++++++++
 .../src/main/resources/registry.yaml               | 27 ++++++++
 .../demo/zeroconfig/ZeroConfigRegistryIT.java      | 40 ++++++++++++
 .../demo/zeroconfig/SelfServiceInvoker.java        | 42 +++++++++++++
 .../demo/zeroconfig/ServerApplication.java         | 43 +++++++++++++
 .../demo/zeroconfig/ServerEndpoint.java            | 41 ++++++++++++
 .../pom.xml                                        |  2 +-
 11 files changed, 395 insertions(+), 2 deletions(-)

diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
index 0f64a0f..44dd323 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/pom.xml
@@ -63,7 +63,7 @@
     <profile>
       <id>docker</id>
       <properties>
-        <demo.service.name>demo-multi-registries-server</demo.service.name>
+        <demo.service.name>demo-zeroconfig-schemadiscovery-registry-server</demo.service.name>
       </properties>
       <build>
         <plugins>
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/Application.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/Application.java
new file mode 100644
index 0000000..388add8
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/Application.java
@@ -0,0 +1,47 @@
+/*
+ * 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.zeroconfig;
+
+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;
+
+@SpringBootApplication
+@EnableServiceComb
+public class Application {
+
+  public static void main(final String[] args) throws Exception {
+    new SpringApplicationBuilder().sources(Application.class).web(WebApplicationType.SERVLET)
+        .build().run(args);
+
+    runTest();
+
+    TestMgr.summary();
+    if (!TestMgr.errors().isEmpty()) {
+      throw new IllegalStateException("tests failed");
+    }
+  }
+
+  private static void runTest() throws Exception {
+    CategorizedTestCaseRunner
+        .runCategorizedTestCase("demo-zeroconfig-schemadiscovery-registry-server");
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerTest.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerTest.java
new file mode 100644
index 0000000..d508bbc
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.zeroconfig;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.servicecomb.demo.CategorizedTestCase;
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
+import org.apache.servicecomb.registry.DiscoveryManager;
+import org.apache.servicecomb.registry.api.registry.Microservice;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class ServerTest implements CategorizedTestCase {
+
+  RestTemplate template = RestTemplateBuilder.create();
+
+  @Override
+  public void testRestTransport() {
+    testServerGetName();
+    testGetAllMicroservice();
+  }
+
+  private void testGetAllMicroservice() {
+    List<Microservice> microserviceList = DiscoveryManager.INSTANCE.getAllMicroservices();
+    Set<String> names = new HashSet<>();
+
+    for (Microservice m : microserviceList) {
+      if (m.getServiceName().equals("demo-zeroconfig-schemadiscovery-registry-client")
+          || m.getServiceName().equals("demo-zeroconfig-schemadiscovery-registry-server")) {
+        names.add(m.getServiceName());
+      }
+    }
+    TestMgr.check(2, names.size());
+  }
+
+  private void testServerGetName() {
+    // invoke demo-zeroconfig-schemadiscovery-registry-server
+    TestMgr.check("2", template
+        .getForObject(
+            "cse://demo-zeroconfig-schemadiscovery-registry-server/register/url/prefix/getName?name=2",
+            String.class));
+  }
+
+  @Override
+  public void testHighwayTransport() throws Exception {
+
+  }
+
+  @Override
+  public void testAllTransport() throws Exception {
+
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/application.yml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/application.yml
new file mode 100644
index 0000000..32526c9
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/application.yml
@@ -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.
+## ---------------------------------------------------------------------------
+
+server:
+  port: 8082
+
+# java-chassis configurations
+
+APPLICATION_ID: demo-zeroconfig-schemadiscovery-registry
+service_description:
+  name: demo-zeroconfig-schemadiscovery-registry-client
+  version: 0.0.2
+servicecomb:
+  handler:
+    chain:
+      Consumer:
+        default: loadbalance
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/logback.xml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/logback.xml
new file mode 100644
index 0000000..0d627f2
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/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-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/registry.yaml b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/registry.yaml
new file mode 100644
index 0000000..0003193
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/main/resources/registry.yaml
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+demo-zeroconfig-schemadiscovery-registry-server:
+  - id: "001"
+    version: "0.0.2"
+    appid: demo-zeroconfig-schemadiscovery-registry
+    schemaIds:
+      - ServerEndpoint
+      - SchemaDiscoveryEndpoint
+    instances:
+      - endpoints:
+          - rest://localhost:8080
\ No newline at end of file
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/test/java/org/apache/servicecomb/demo/zeroconfig/ZeroConfigRegistryIT.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/test/java/org/apache/servicecomb/demo/zeroconfig/ZeroConfigRegistryIT.java
new file mode 100644
index 0000000..f73ff8b
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-client/src/test/java/org/apache/servicecomb/demo/zeroconfig/ZeroConfigRegistryIT.java
@@ -0,0 +1,40 @@
+
+/*
+ * 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.zeroconfig;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.servicecomb.demo.TestMgr;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ZeroConfigRegistryIT {
+  @Before
+  public void setUp() throws Exception {
+    TestMgr.errors().clear();
+  }
+
+  @Test
+  public void clientGetsNoError() throws Exception {
+    Application.main(new String[0]);
+
+    assertThat(TestMgr.errors().isEmpty(), is(true));
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/SelfServiceInvoker.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/SelfServiceInvoker.java
new file mode 100644
index 0000000..6387d3e
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/SelfServiceInvoker.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.zeroconfig;
+
+import java.util.concurrent.CountDownLatch;
+import org.apache.servicecomb.core.BootListener;
+import org.apache.servicecomb.provider.pojo.RpcReference;
+import org.springframework.stereotype.Component;
+
+@Component("SelfServiceInvoker")
+public class SelfServiceInvoker implements BootListener {
+  interface IServerEndpoint {
+    String getName(String name);
+  }
+
+  @RpcReference(microserviceName = "demo-zeroconfig-schemadiscovery-registry-server", schemaId = "ServerEndpoint")
+  IServerEndpoint endpoint;
+
+  public CountDownLatch latch = new CountDownLatch(1);
+
+  public String result = "";
+
+  public void onAfterRegistry(BootEvent event) {
+    result = endpoint.getName("hello");
+    latch.countDown();
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerApplication.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerApplication.java
new file mode 100644
index 0000000..3fe5f41
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerApplication.java
@@ -0,0 +1,43 @@
+/*
+ * 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.zeroconfig;
+
+import java.util.concurrent.TimeUnit;
+import org.apache.servicecomb.demo.TestMgr;
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.apache.servicecomb.springboot2.starter.EnableServiceComb;
+import org.springframework.boot.WebApplicationType;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+
+@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);
+
+    SelfServiceInvoker invoker = BeanUtils.getBean("SelfServiceInvoker");
+    invoker.latch.await(10, TimeUnit.SECONDS);
+    TestMgr.check(invoker.result, "hello");
+
+    TestMgr.summary();
+    if (!TestMgr.errors().isEmpty()) {
+      System.exit(1);
+    }
+  }
+}
diff --git a/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerEndpoint.java b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerEndpoint.java
new file mode 100644
index 0000000..551d0d0
--- /dev/null
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/demo-zeroconfig-schemadiscovery-registry-server/src/main/java/org/apache/servicecomb/demo/zeroconfig/ServerEndpoint.java
@@ -0,0 +1,41 @@
+/*
+ * 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.zeroconfig;
+
+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-zeroconfig-schemadiscovery-registry/pom.xml b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
index ca45dc7..7ad6aa6 100644
--- a/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
+++ b/demo/demo-zeroconfig-schemadiscovery-registry/pom.xml
@@ -28,8 +28,8 @@
   <name>Java Chassis::Demo::ZeroConfig-SchemaDiscovery Registry</name>
   <packaging>pom</packaging>
   <modules>
-    <module>demo-zeroconfig-schemadiscovery-registry-client</module>
     <module>demo-zeroconfig-schemadiscovery-registry-server</module>
+    <module>demo-zeroconfig-schemadiscovery-registry-client</module>
   </modules>
 
   <dependencies>