Improve protobuf json (#269)

diff --git a/dubbo-samples-protobuf-json/case-configuration.yml b/dubbo-samples-protobuf-json/case-configuration.yml
new file mode 100644
index 0000000..ca54594
--- /dev/null
+++ b/dubbo-samples-protobuf-json/case-configuration.yml
@@ -0,0 +1,25 @@
+# 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.
+
+from: app-builtin-zookeeper.yml
+
+props:
+  project_name: dubbo-samples-protobuf-json
+  project_dir: protobuf-json-serialization-demo
+  main_class: org.apache.dubbo.sample.protobuf.provider.ProviderStarter
+  zookeeper_port: 2181
+  dubbo_port: 20880
+
diff --git a/dubbo-samples-protobuf-json/case-versions.conf b/dubbo-samples-protobuf-json/case-versions.conf
new file mode 100644
index 0000000..978f7e7
--- /dev/null
+++ b/dubbo-samples-protobuf-json/case-versions.conf
@@ -0,0 +1,6 @@
+
+# Supported component versions of the test case
+
+# Spring app
+dubbo.version=2.7*, 3.*
+spring.version=4.*, 5.*
diff --git a/dubbo-samples-protobuf-json/pom.xml b/dubbo-samples-protobuf-json/pom.xml
index e4bd739..24a1960 100644
--- a/dubbo-samples-protobuf-json/pom.xml
+++ b/dubbo-samples-protobuf-json/pom.xml
@@ -19,20 +19,25 @@
         <target.level>1.8</target.level>
         <dubbo.version>2.7.7</dubbo.version>
         <protobuf.java>3.6.0</protobuf.java>
-        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
-        <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
         <junit.version>4.12</junit.version>
         <spring.version>4.3.16.RELEASE</spring.version>
-        <dubbo.port>20880</dubbo.port>
-        <zookeeper.port>2181</zookeeper.port>
     </properties>
 
     <dependencyManagement>
         <dependencies>
             <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-framework-bom</artifactId>
+                <version>${spring.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
                 <groupId>org.apache.dubbo</groupId>
-                <artifactId>dubbo</artifactId>
+                <artifactId>dubbo-bom</artifactId>
                 <version>${dubbo.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
             </dependency>
             <dependency>
                 <groupId>org.apache.dubbo</groupId>
@@ -40,7 +45,6 @@
                 <version>${dubbo.version}</version>
                 <type>pom</type>
             </dependency>
-
             <dependency>
                 <groupId>com.google.protobuf</groupId>
                 <artifactId>protobuf-java</artifactId>
@@ -53,12 +57,6 @@
                 <scope>test</scope>
             </dependency>
 
-            <dependency>
-                <groupId>org.springframework</groupId>
-                <artifactId>spring-test</artifactId>
-                <version>${spring.version}</version>
-                <scope>test</scope>
-            </dependency>
         </dependencies>
     </dependencyManagement>
     <build>
@@ -66,7 +64,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>${maven-compiler-plugin.version}</version>
+                <version>3.7.0</version>
                 <configuration>
                     <source>${source.level}</source>
                     <target>${target.level}</target>
diff --git a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/pom.xml b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/pom.xml
index 5136d8f..52a3549 100644
--- a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/pom.xml
+++ b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/pom.xml
@@ -40,20 +40,20 @@
         <dependency>
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-dependencies-zookeeper</artifactId>
-            <version>${dubbo.version}</version>
-            <type>pom</type>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.dubbo</groupId>
-            <artifactId>dubbo-dependencies-zookeeper</artifactId>
-            <version>${dubbo.version}</version>
             <type>pom</type>
         </dependency>
         <dependency>
             <groupId>org.apache.dubbo</groupId>
             <artifactId>dubbo-metadata-definition-protobuf</artifactId>
-            <version>${dubbo.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <profiles>
diff --git a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/test/java/org/apache/dubbo/sample/protobuf/DubboProtobufJsonIT.java b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/test/java/org/apache/dubbo/sample/protobuf/DubboProtobufJsonIT.java
new file mode 100644
index 0000000..0a8b563
--- /dev/null
+++ b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/test/java/org/apache/dubbo/sample/protobuf/DubboProtobufJsonIT.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.dubbo.sample.protobuf;
+
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DubboProtobufJsonIT {
+
+    private static String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1");
+
+    @Test
+    public void testGreeting() throws Exception {
+        ReferenceConfig<GoogleProtobufService> reference = new ReferenceConfig<>();
+        ApplicationConfig applicationConfig = new ApplicationConfig("first-dubbo-consumer");
+        applicationConfig.setQosEnable(false);
+        reference.setApplication(applicationConfig);
+        reference.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
+        reference.setInterface(GoogleProtobufService.class);
+        GoogleProtobufService service = reference.get();
+        GoogleProtobufBasic.GooglePBRequestType requestType = GoogleProtobufBasic.GooglePBRequestType.newBuilder()
+                .setString("some string from client")
+                .build();
+        GoogleProtobufBasic.GooglePBResponseType responseType = service.callGoogleProtobuf(requestType);
+        System.out.println(responseType.getString());
+        Assert.assertEquals("some string from client", responseType.getString());
+    }
+}
+
diff --git a/dubbo-samples-protobuf-json/protobuf-json-serialization-implement/src/main/java/org/apache/dubbo/sample/protobuf/serialization/ProtobufSerialization.java b/dubbo-samples-protobuf-json/protobuf-json-serialization-implement/src/main/java/org/apache/dubbo/sample/protobuf/serialization/ProtobufSerialization.java
index 50c7e0f..e899244 100644
--- a/dubbo-samples-protobuf-json/protobuf-json-serialization-implement/src/main/java/org/apache/dubbo/sample/protobuf/serialization/ProtobufSerialization.java
+++ b/dubbo-samples-protobuf-json/protobuf-json-serialization-implement/src/main/java/org/apache/dubbo/sample/protobuf/serialization/ProtobufSerialization.java
@@ -32,7 +32,8 @@
  * Date: 2019-10-01
  */
 public class ProtobufSerialization implements Serialization {
-    private static final int CONTENT_TYPE_ID = 25;
+    //Serialization ID must less than SERIALIZATION_MASK and cannot be duplicated with other serializations
+    private static final int CONTENT_TYPE_ID = 30;
 
     /**
      * The content type id should not be changed in any circumstance!
diff --git a/dubbo-samples-protostuff/dubbo-samples-protostuff-provider/pom.xml b/dubbo-samples-protostuff/dubbo-samples-protostuff-provider/pom.xml
index fb033f4..3d0054d 100644
--- a/dubbo-samples-protostuff/dubbo-samples-protostuff-provider/pom.xml
+++ b/dubbo-samples-protostuff/dubbo-samples-protostuff-provider/pom.xml
@@ -28,17 +28,6 @@
     <artifactId>dubbo-samples-protostuff-provider</artifactId>
     <name>dubbo-samples-protostuff-provider</name>
 
-    <properties>
-        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
-        <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
-        <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
-        <image.name>${project.artifactId}:${dubbo.version}</image.name>
-        <java-image.name>openjdk:8</java-image.name>
-        <dubbo.port>20880</dubbo.port>
-        <zookeeper.port>2181</zookeeper.port>
-        <main-class>org.dubbo.samples.protostuff.provider.ProviderApp</main-class>
-    </properties>
-
     <dependencies>
         <dependency>
             <groupId>com.alibaba</groupId>
@@ -95,137 +84,4 @@
         </dependency>
     </dependencies>
 
-    <profiles>
-        <profile>
-            <id>dubbo-integration-test</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.dubbo</groupId>
-                        <artifactId>dubbo-maven-address-plugin</artifactId>
-                        <version>1.0-SNAPSHOT</version>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>local-address</goal>
-                                </goals>
-                                <configuration>
-                                    <localAddress>dubbo-local-address</localAddress>
-                                </configuration>
-                                <phase>initialize</phase>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                    <plugin>
-                        <groupId>com.google.cloud.tools</groupId>
-                        <artifactId>jib-maven-plugin</artifactId>
-                        <version>${jib-maven-plugin.version}</version>
-                        <configuration>
-                            <from>
-                                <image>${java-image.name}</image>
-                            </from>
-                            <to>
-                                <image>${image.name}</image>
-                            </to>
-                            <container>
-                                <mainClass>${main-class}</mainClass>
-                                <environment>
-                                    <DUBBO_IP_TO_REGISTRY>${dubbo-local-address}</DUBBO_IP_TO_REGISTRY>
-                                </environment>
-                                <jvmFlags>
-                                    <jvmFlag>-Dzookeeper.address=${dubbo-local-address}</jvmFlag>
-                                </jvmFlags>
-                            </container>
-                        </configuration>
-                        <executions>
-                            <execution>
-                                <phase>package</phase>
-                                <goals>
-                                    <goal>dockerBuild</goal>
-                                </goals>
-                            </execution>
-                        </executions>
-                    </plugin>
-
-                    <plugin>
-                        <groupId>io.fabric8</groupId>
-                        <artifactId>docker-maven-plugin</artifactId>
-                        <version>${docker-maven-plugin.version}</version>
-                        <configuration>
-                            <images>
-                                <image>
-                                    <name>zookeeper:latest</name>
-                                    <run>
-                                        <ports>
-                                            <port>${zookeeper.port}:${zookeeper.port}</port>
-                                        </ports>
-                                        <wait>
-                                            <tcp>
-                                                <host>${dubbo-local-address}</host>
-                                                <ports>
-                                                    <port>${zookeeper.port}</port>
-                                                </ports>
-                                            </tcp>
-                                        </wait>
-                                    </run>
-                                </image>
-                                <image>
-                                    <name>${image.name}</name>
-                                    <run>
-                                        <ports>
-                                            <port>${dubbo.port}:${dubbo.port}</port>
-                                        </ports>
-                                        <wait>
-                                            <time>20000</time>
-                                            <log>Spring Boot Application is await</log>
-                                       </wait>
-                                    </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>
-
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-failsafe-plugin</artifactId>
-                        <version>${maven-failsafe-plugin.version}</version>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>integration-test</goal>
-                                    <goal>verify</goal>
-                                </goals>
-                                <configuration>
-                                    <systemPropertyVariables>
-                                        <zookeeper.address>${dubbo-local-address}</zookeeper.address>
-                                    </systemPropertyVariables>
-                                    <includes>
-                                        <include>**/*IT.java</include>
-                                    </includes>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-
 </project>
diff --git a/dubbo-samples-protostuff/pom.xml b/dubbo-samples-protostuff/pom.xml
index 5e2aba2..3951f6a 100644
--- a/dubbo-samples-protostuff/pom.xml
+++ b/dubbo-samples-protostuff/pom.xml
@@ -34,15 +34,6 @@
         <spring-boot.version>2.1.1.RELEASE</spring-boot.version>
         <dubbo.version>2.7.7</dubbo.version>
         <protostuff.version>1.5.9</protostuff.version>
-        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>
-        <jib-maven-plugin.version>1.2.0</jib-maven-plugin.version>
-        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
-        <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
-        <image.name>${project.artifactId}:${dubbo.version}</image.name>
-        <java-image.name>openjdk:8</java-image.name>
-        <dubbo.port>20880</dubbo.port>
-        <zookeeper.port>2181</zookeeper.port>
-        <main-class>org.apache.dubbo.samples.annotation.AnnotationProviderBootstrap</main-class>
     </properties>
 
     <packaging>pom</packaging>
@@ -147,7 +138,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>${maven-compiler-plugin.version}</version>
+                <version>3.7.0</version>
                 <configuration>
                     <source>${source.level}</source>
                     <target>${target.level}</target>